Changeset 8582

Show
Ignore:
Timestamp:
01/10/10 17:39:29 (2 years ago)
Author:
p_lindheimer
Message:

re #1718 adds GUI and needed functionality in core to force CIDs out trunks blocked for foreign CIDS, only serverside validation no js yet so not closing

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.7/core/functions.inc.php

    r8579 r8582  
    20642064      $ext->add($context, $exten, 'bypass', new ext_set('EMERGENCYCID', '${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)}')); 
    20652065      $ext->add($context, $exten, '', new ext_set('TRUNKOUTCID', '${OUTCID_${ARG1}}')); 
    2066       $ext->add($context, $exten, '', new ext_gotoif('$[ $["${EMERGENCYROUTE:1:2}" = ""] | $["${EMERGENCYCID:1:2}" = ""] ]', 'trunkcid'));  // check EMERGENCY ROUTE 
     2066      $ext->add($context, $exten, '', new ext_gotoif('$["${EMERGENCYROUTE:1:2}" = "" | "${EMERGENCYCID:1:2}" = ""]', 'trunkcid'));  // check EMERGENCY ROUTE 
    20672067      $ext->add($context, $exten, '', new ext_set('CALLERID(all)', '${EMERGENCYCID}'));  // emergency cid for device 
    20682068      $ext->add($context, $exten, 'exit', new ext_macroexit()); 
    20692069 
    20702070 
    2071       $ext->add($context, $exten, 'trunkcid', new ext_execif('$["${TRUNKOUTCID:1:2}" != ""]', 'Set', 'CALLERID(all)=${TRUNKOUTCID}')); 
    2072  
    2073       $ext->add($context, $exten, 'usercid', new ext_execif('$["${USEROUTCID:1:2}" != ""]', 'Set', 'CALLERID(all)=${USEROUTCID}'));  // check CID override for extension 
     2071      $ext->add($context, $exten, 'trunkcid', new ext_execif('$["${TRUNKOUTCID}" != ""]', 'Set', 'CALLERID(all)=${TRUNKOUTCID}')); 
     2072      $ext->add($context, $exten, 'usercid', new ext_execif('$["${USEROUTCID}" != ""]', 'Set', 'CALLERID(all)=${USEROUTCID}'));  // check CID override for extension 
     2073      /* TRUNKCIDOVERRIDE is used by followme and can be used by other functions. It forces the specified CID except for the case of an Emergency CID on an Emergency Route 
     2074         FORCEDOUTCID_trunknum is not yet used. It's purpose will be to force a trunk to always use a specific CID in all conditions except when used in an emergency route. 
     2075         An EMERGENCYCID present on an EMERGENCYROUTE will continue to take prcedence over all else. 
     2076       */ 
     2077      $ext->add($context, $exten, '', new ext_execif('$["${TRUNKCIDOVERRIDE}" != "" | "${FORCEDOUTCID_${ARG1}}" != ""]', 'Set', 'CALLERID(all)=${IF($["${FORCEDOUTCID_${ARG1}}"=""]?${TRUNKCIDOVERRIDE}:${FORCEDOUTCID_${ARG1}})}')); 
    20742078      if ($ast_lt_16) {  
    20752079        $ext->add($context, $exten, 'hidecid', new ext_execif('$["${CALLERID(name)}"="hidden"]', 'SetCallerPres', 'prohib_passed_screen')); 
  • modules/branches/2.7/findmefollow/functions.inc.php

    r8577 r8582  
    192192          changecid: 
    193193            default   - works as always, same as if not present 
    194             did       - set to the DID that the call came in on or leave alone 
    195194            fixed     - set to the fixedcid 
    196195            extern    - set to the fixedcid if the call is from the outside only 
     196            did       - set to the DID that the call came in on or leave alone, treated as foreign 
     197            forcedid  - set to the DID that the call came in on or leave alone, not treated as foreign 
    197198           
    198199          BLKVM_BASE - has the exten num called, hoaky if that goes away but for now use it 
     
    204205 
    205206          $exten = 's-fixed'; 
    206           $ext->add($contextname, $exten, '', new ext_execif('$["${REGEX("^[\+]?[0-9]+$" ${DB(AMPUSER/${BLKVM_BASE}/followme/fixedcid)})}" = "1"]', 'Set', '__REALCALLERIDNUM=${DB(AMPUSER/${BLKVM_BASE}/followme/fixedcid)}')); 
     207          $ext->add($contextname, $exten, '', new ext_execif('$["${REGEX("^[\+]?[0-9]+$" ${DB(AMPUSER/${BLKVM_BASE}/followme/fixedcid)})}" = "1"]', 'Set', '__TRUNKCIDOVERRIDE=${DB(AMPUSER/${BLKVM_BASE}/followme/fixedcid)}')); 
     208          $ext->add($contextname, $exten, '', new ext_return('')); 
     209 
     210          $exten = 's-extern'; 
     211          $ext->add($contextname, $exten, '', new ext_execif('$["${REGEX("^[\+]?[0-9]+$" ${DB(AMPUSER/${BLKVM_BASE}/followme/fixedcid)})}" == "1" & "${FROM_DID}" != ""]', 'Set', '__TRUNKCIDOVERRIDE=${DB(AMPUSER/${BLKVM_BASE}/followme/fixedcid)}')); 
    207212          $ext->add($contextname, $exten, '', new ext_return('')); 
    208213 
     
    211216          $ext->add($contextname, $exten, '', new ext_return('')); 
    212217 
    213           $exten = 's-extern'; 
    214           $ext->add($contextname, $exten, '', new ext_execif('$["${REGEX("^[\+]?[0-9]+$" ${DB(AMPUSER/${BLKVM_BASE}/followme/fixedcid)})}" == "1" & "${FROM_DID}" != ""]', 'Set', '__REALCALLERIDNUM=${DB(AMPUSER/${BLKVM_BASE}/followme/fixedcid)}')); 
     218          $exten = 's-forcedid'; 
     219          $ext->add($contextname, $exten, '', new ext_execif('$["${REGEX("^[\+]?[0-9]+$" ${FROM_DID})}" = "1"]', 'Set', '__TRUNKCIDOVERRIDE=${FROM_DID}')); 
    215220          $ext->add($contextname, $exten, '', new ext_return('')); 
    216221 
     
    225230} 
    226231 
    227 function findmefollow_add($grpnum,$strategy,$grptime,$grplist,$postdest,$grppre='',$annmsg_id='',$dring,$needsconf,$remotealert_id,$toolate_id,$ringing,$pre_ring,$ddial) { 
     232function findmefollow_add($grpnum,$strategy,$grptime,$grplist,$postdest,$grppre='',$annmsg_id='',$dring,$needsconf,$remotealert_id,$toolate_id,$ringing,$pre_ring,$ddial,$changecid='default',$fixedcid='') { 
    228233  global $amp_conf; 
    229234  global $astman; 
     
    245250    $ddialvalue = ($ddial == 'CHECKED')?'EXTENSION':'DIRECT'; 
    246251    $astman->database_put("AMPUSER",$grpnum."/followme/ddial",$ddialvalue); 
     252 
     253    $astman->database_put("AMPUSER",$grpnum."/followme/changecid",$changecid); 
     254    $fixedcid = preg_replace("/[^0-9\+]/" ,"", trim($fixedcid)); 
     255    $astman->database_put("AMPUSER",$grpnum."/followme/fixedcid",$fixedcid); 
    247256  } else { 
    248257    fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 
     
    348357      $astdb_grplist = $astman->database_get("AMPUSER",$grpnum."/followme/grplist"); 
    349358      $astdb_grpconf = $astman->database_get("AMPUSER",$grpnum."/followme/grpconf"); 
     359 
     360      $astdb_changecid = strtolower($astman->database_get("AMPUSER",$grpnum."/followme/changecid")); 
     361      switch($astdb_changecid) { 
     362        case 'default': 
     363        case 'did': 
     364        case 'forcedid': 
     365        case 'fixed': 
     366        case 'extern': 
     367          break; 
     368        default: 
     369          $astdb_changecid = 'default'; 
     370      } 
     371      $results['changecid'] = $astdb_changecid; 
     372      $fixedcid = $astman->database_get("AMPUSER",$grpnum."/followme/fixedcid"); 
     373      $results['fixedcid'] = preg_replace("/[^0-9\+]/" ,"", trim($fixedcid)); 
    350374    } else { 
    351375      fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 
  • modules/branches/2.7/findmefollow/page.findmefollow.php

    r6678 r8582  
    3131isset($_REQUEST['pre_ring'])?$pre_ring = $_REQUEST['pre_ring']:$pre_ring='0'; 
    3232isset($_REQUEST['ddial'])?$ddial = $_REQUEST['ddial']:$ddial=''; 
     33isset($_REQUEST['changecid'])?$changecid = $_REQUEST['changecid']:$changecid='default'; 
     34isset($_REQUEST['fixedcid'])?$fixedcid = $_REQUEST['fixedcid']:$fixedcid=''; 
    3335 
    3436 
     
    7375    //add group 
    7476    if ($action == 'addGRP') { 
    75       findmefollow_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$grppre,$annmsg_id,$dring,$needsconf,$remotealert_id,$toolate_id,$ringing,$pre_ring,$ddial); 
     77      findmefollow_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$grppre,$annmsg_id,$dring,$needsconf,$remotealert_id,$toolate_id,$ringing,$pre_ring,$ddial,$changecid,$fixedcid); 
    7678 
    7779      needreload(); 
     
    8991    if ($action == 'edtGRP') { 
    9092      findmefollow_del($account);  
    91       findmefollow_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$grppre,$annmsg_id,$dring,$needsconf,$remotealert_id,$toolate_id,$ringing,$pre_ring,$ddial); 
     93      findmefollow_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$grppre,$annmsg_id,$dring,$needsconf,$remotealert_id,$toolate_id,$ringing,$pre_ring,$ddial,$changecid,$fixedcid); 
    9294 
    9395      needreload(); 
     
    129131 
    130132    $thisgrp = findmefollow_get($extdisplay, 1); 
     133    freepbx_debug($thisgrp); 
    131134    $grpliststr = isset($thisgrp['grplist']) ? $thisgrp['grplist'] : ''; 
    132135    $grplist = explode("-", $grpliststr); 
     
    143146    $pre_ring    = isset($thisgrp['pre_ring'])    ? $thisgrp['pre_ring']    : ''; 
    144147    $ddial       = isset($thisgrp['ddial'])       ? $thisgrp['ddial']       : ''; 
     148    $changecid   = isset($thisgrp['changecid'])   ? $thisgrp['changecid']   : 'default'; 
     149    $fixedcid    = isset($thisgrp['fixedcid'])    ? $thisgrp['fixedcid']    : ''; 
    145150    $goto = isset($thisgrp['postdest'])?$thisgrp['postdest']:((isset($thisgrp['voicemail']) && $thisgrp['voicemail'] != 'novm')?"ext-local,vmu$extdisplay,1":''); 
    146151    unset($grpliststr); 
     
    345350      </tr> 
    346351 
     352      <tr><td colspan="2"><h5><?php echo _("Call Confirmation Configuration") ?><hr></h5></td></tr> 
     353 
    347354      <tr> 
    348355        <td><a href="#" class="info"><?php echo _("Confirm Calls")?><span><?php echo _('Enable this if you\'re calling external numbers that need confirmation - eg, a mobile phone may go to voicemail which will pick up the call. Enabling this requires the remote side push 1 on their phone before the call is put through. This feature only works with the ringall/ringall-prim  ring strategy')?></span></a>:</td> 
     
    388395      </tr> 
    389396<?php } ?> 
     397 
     398      <tr><td colspan="2"><h5><?php echo _("Change External CID Configuration") ?><hr></h5></td></tr> 
     399      <tr> 
     400        <td> 
     401        <a href="#" class="info"><?php echo _("Mode")?> 
     402        <span> 
     403          <b><?php echo _("Default")?></b>:  <?php echo _("Transmits the Callers CID if allowed by the trunk.")?><br> 
     404          <b><?php echo _("Fixed CID Value")?></b>:  <?php echo _("Always transmit the Fixed CID Value below.")?><br> 
     405          <b><?php echo _("Outside Calls Fixed CID Value")?></b>: <?php echo _("Transmit the Fixed CID Value below on calls that come in from outside only. Internal extension to extension calls will continue to operate in default mode.")?><br> 
     406          <b><?php echo _("Use Dialed Number")?></b>: <?php echo _("Transmit the number that was dialed as the CID for calls coming from outside. Internal extension to extension calls will continue to operate in default mode. There must be a DID on the inbound route for this. This will be BLOCKED on trunks that block foreign callerid")?><br> 
     407          <b><?php echo _("Force Dialed Number")?></b>: <?php echo _("Transmit the number that was dialed as the CID for calls coming from outside. Internal extension to extension calls will continue to operate in default mode. There must be a DID on the inbound route for this. This WILL be transmitred on trunks that block foreign callerid")?><br> 
     408        </span> 
     409        </a> 
     410        </td> 
     411        <td> 
     412          <select name="changecid" tabindex="<?php echo ++$tabindex;?>"> 
     413          <?php 
     414            $default = (isset($changecid) ? $changecid : 'default'); 
     415            echo '<option value="default" '.($default == 'default' ? 'SELECTED' : '').'>'._("Default"); 
     416            echo '<option value="fixed" '.($default == 'fixed' ? 'SELECTED' : '').'>'._("Fixed CID Value"); 
     417            echo '<option value="extern" '.($default == 'extern' ? 'SELECTED' : '').'>'._("Outside Calls Fixed CID Value"); 
     418            echo '<option value="did" '.($default == 'did' ? 'SELECTED' : '').'>'._("Used Dialed Number"); 
     419            echo '<option value="forcedid" '.($default == 'forcedid' ? 'SELECTED' : '').'>'._("Force Dialed Number"); 
     420          ?>     
     421          </select> 
     422        </td> 
     423      </tr> 
     424 
     425      <tr> 
     426        <td><a href="#" class="info"><?php echo _("Fixed CID Value")?>:<span><?php echo _('Fixed value to replace the CID with used with some of the modes above. Should be in a format of digits only with an option of E164 format using a leading "+".')?></span></a></td> 
     427        <td><input size="18" type="text" name="fixedcid" value="<?php  echo $fixedcid ?>" tabindex="<?php echo ++$tabindex;?>"></td> 
     428      </tr> 
    390429       
    391430      <tr><td colspan="2"><br><h5><?php echo _("Destination if no answer")?>:<hr></h5></td></tr>