Changeset 8582
- Timestamp:
- 01/10/10 17:39:29 (2 years ago)
- Files:
-
- modules/branches/2.7/core/functions.inc.php (modified) (1 diff)
- modules/branches/2.7/findmefollow/functions.inc.php (modified) (6 diffs)
- modules/branches/2.7/findmefollow/page.findmefollow.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.7/core/functions.inc.php
r8579 r8582 2064 2064 $ext->add($context, $exten, 'bypass', new ext_set('EMERGENCYCID', '${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)}')); 2065 2065 $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 ROUTE2066 $ext->add($context, $exten, '', new ext_gotoif('$["${EMERGENCYROUTE:1:2}" = "" | "${EMERGENCYCID:1:2}" = ""]', 'trunkcid')); // check EMERGENCY ROUTE 2067 2067 $ext->add($context, $exten, '', new ext_set('CALLERID(all)', '${EMERGENCYCID}')); // emergency cid for device 2068 2068 $ext->add($context, $exten, 'exit', new ext_macroexit()); 2069 2069 2070 2070 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}})}')); 2074 2078 if ($ast_lt_16) { 2075 2079 $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 192 192 changecid: 193 193 default - works as always, same as if not present 194 did - set to the DID that the call came in on or leave alone195 194 fixed - set to the fixedcid 196 195 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 197 198 198 199 BLKVM_BASE - has the exten num called, hoaky if that goes away but for now use it … … 204 205 205 206 $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)}')); 207 212 $ext->add($contextname, $exten, '', new ext_return('')); 208 213 … … 211 216 $ext->add($contextname, $exten, '', new ext_return('')); 212 217 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}')); 215 220 $ext->add($contextname, $exten, '', new ext_return('')); 216 221 … … 225 230 } 226 231 227 function findmefollow_add($grpnum,$strategy,$grptime,$grplist,$postdest,$grppre='',$annmsg_id='',$dring,$needsconf,$remotealert_id,$toolate_id,$ringing,$pre_ring,$ddial ) {232 function findmefollow_add($grpnum,$strategy,$grptime,$grplist,$postdest,$grppre='',$annmsg_id='',$dring,$needsconf,$remotealert_id,$toolate_id,$ringing,$pre_ring,$ddial,$changecid='default',$fixedcid='') { 228 233 global $amp_conf; 229 234 global $astman; … … 245 250 $ddialvalue = ($ddial == 'CHECKED')?'EXTENSION':'DIRECT'; 246 251 $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); 247 256 } else { 248 257 fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); … … 348 357 $astdb_grplist = $astman->database_get("AMPUSER",$grpnum."/followme/grplist"); 349 358 $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)); 350 374 } else { 351 375 fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); modules/branches/2.7/findmefollow/page.findmefollow.php
r6678 r8582 31 31 isset($_REQUEST['pre_ring'])?$pre_ring = $_REQUEST['pre_ring']:$pre_ring='0'; 32 32 isset($_REQUEST['ddial'])?$ddial = $_REQUEST['ddial']:$ddial=''; 33 isset($_REQUEST['changecid'])?$changecid = $_REQUEST['changecid']:$changecid='default'; 34 isset($_REQUEST['fixedcid'])?$fixedcid = $_REQUEST['fixedcid']:$fixedcid=''; 33 35 34 36 … … 73 75 //add group 74 76 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); 76 78 77 79 needreload(); … … 89 91 if ($action == 'edtGRP') { 90 92 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); 92 94 93 95 needreload(); … … 129 131 130 132 $thisgrp = findmefollow_get($extdisplay, 1); 133 freepbx_debug($thisgrp); 131 134 $grpliststr = isset($thisgrp['grplist']) ? $thisgrp['grplist'] : ''; 132 135 $grplist = explode("-", $grpliststr); … … 143 146 $pre_ring = isset($thisgrp['pre_ring']) ? $thisgrp['pre_ring'] : ''; 144 147 $ddial = isset($thisgrp['ddial']) ? $thisgrp['ddial'] : ''; 148 $changecid = isset($thisgrp['changecid']) ? $thisgrp['changecid'] : 'default'; 149 $fixedcid = isset($thisgrp['fixedcid']) ? $thisgrp['fixedcid'] : ''; 145 150 $goto = isset($thisgrp['postdest'])?$thisgrp['postdest']:((isset($thisgrp['voicemail']) && $thisgrp['voicemail'] != 'novm')?"ext-local,vmu$extdisplay,1":''); 146 151 unset($grpliststr); … … 345 350 </tr> 346 351 352 <tr><td colspan="2"><h5><?php echo _("Call Confirmation Configuration") ?><hr></h5></td></tr> 353 347 354 <tr> 348 355 <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> … … 388 395 </tr> 389 396 <?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> 390 429 391 430 <tr><td colspan="2"><br><h5><?php echo _("Destination if no answer")?>:<hr></h5></td></tr>
