Changeset 8839
- Timestamp:
- 02/16/10 23:36:28 (2 years ago)
- Files:
-
- modules/branches/2.7/ringgroups/functions.inc.php (modified) (6 diffs)
- modules/branches/2.7/ringgroups/module.xml (modified) (2 diffs)
- modules/branches/2.7/ringgroups/page.ringgroups.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.7/ringgroups/functions.inc.php
r8769 r8839 118 118 $ext->add($contextname, $grpnum, 'skipov', new ext_setvar('RRNODEST', '${NODEST}')); 119 119 $ext->add($contextname, $grpnum, 'skipvmblk', new ext_setvar('__NODEST', '${EXTEN}')); 120 121 $ext->add($contextname, $grpnum, '', new ext_gosubif('$[${DB_EXISTS(RINGGROUP/'.$grpnum.'/changecid)} = 1 & "${DB(RINGGROUP/'.$grpnum.'/changecid)}" != "default" & "${DB(RINGGROUP/'.$grpnum.'/changecid)}" != ""]', 'sub-rgsetcid,s,1')); 120 122 121 123 // deal with group CID prefix … … 196 198 $ext->add($contextname, $grpnum, 'nodest', new ext_noop('SKIPPING DEST, CALL CAME FROM Q/RG: ${RRNODEST}')); 197 199 } 200 /* 201 ASTDB Settings: 202 RINGGROUP/nnn/changecid default | did | fixed | extern 203 RINGGROUP/nnn/fixedcid XXXXXXXX 204 205 changecid: 206 default - works as always, same as if not present 207 fixed - set to the fixedcid 208 extern - set to the fixedcid if the call is from the outside only 209 did - set to the DID that the call came in on or leave alone, treated as foreign 210 forcedid - set to the DID that the call came in on or leave alone, not treated as foreign 211 212 BLKVM_BASE - has the exten num called, hoaky if that goes away but for now use it 213 */ 214 if (count($ringlist)) { 215 $contextname = 'sub-rgsetcid'; 216 $exten = 's'; 217 $ext->add($contextname, $exten, '', new ext_goto('1','s-${DB(RINGGROUP/${BLKVM_BASE}/changecid)}')); 218 219 $exten = 's-fixed'; 220 $ext->add($contextname, $exten, '', new ext_execif('$["${REGEX("^[\+]?[0-9]+$" ${DB(RINGGROUP/${BLKVM_BASE}/fixedcid)})}" = "1"]', 'Set', '__TRUNKCIDOVERRIDE=${DB(RINGGROUP/${BLKVM_BASE}/fixedcid)}')); 221 $ext->add($contextname, $exten, '', new ext_return('')); 222 223 $exten = 's-extern'; 224 $ext->add($contextname, $exten, '', new ext_execif('$["${REGEX("^[\+]?[0-9]+$" ${DB(RINGGROUP/${BLKVM_BASE}/fixedcid)})}" == "1" & "${FROM_DID}" != ""]', 'Set', '__TRUNKCIDOVERRIDE=${DB(RINGGROUP/${BLKVM_BASE}/fixedcid)}')); 225 $ext->add($contextname, $exten, '', new ext_return('')); 226 227 $exten = 's-did'; 228 $ext->add($contextname, $exten, '', new ext_execif('$["${REGEX("^[\+]?[0-9]+$" ${FROM_DID})}" = "1"]', 'Set', '__REALCALLERIDNUM=${FROM_DID}')); 229 $ext->add($contextname, $exten, '', new ext_return('')); 230 231 $exten = 's-forcedid'; 232 $ext->add($contextname, $exten, '', new ext_execif('$["${REGEX("^[\+]?[0-9]+$" ${FROM_DID})}" = "1"]', 'Set', '__TRUNKCIDOVERRIDE=${FROM_DID}')); 233 $ext->add($contextname, $exten, '', new ext_return('')); 234 235 $exten = '_s-.'; 236 $ext->add($contextname, $exten, '', new ext_noop('Unknown value for RINGGROUP/${BLKVM_BASE}/changecid of ${DB(RINGGROUP/${BLKVM_BASE}/changecid)} set to "default"')); 237 $ext->add($contextname, $exten, '', new ext_setvar('DB(RINGGROUP/${BLKVM_BASE}/changecid)', 'default')); 238 $ext->add($contextname, $exten, '', new ext_return('')); 239 } 198 240 } 199 241 break; … … 201 243 } 202 244 203 function ringgroups_add($grpnum,$strategy,$grptime,$grplist,$postdest,$desc,$grppre='',$annmsg_id='',$alertinfo,$needsconf,$remotealert_id,$toolate_id,$ringing,$cwignore,$cfignore ) {245 function ringgroups_add($grpnum,$strategy,$grptime,$grplist,$postdest,$desc,$grppre='',$annmsg_id='',$alertinfo,$needsconf,$remotealert_id,$toolate_id,$ringing,$cwignore,$cfignore,$changecid='default',$fixedcid='') { 204 246 global $db; 205 247 … … 217 259 $sql = "INSERT INTO ringgroups (grpnum, strategy, grptime, grppre, grplist, annmsg_id, postdest, description, alertinfo, needsconf, remotealert_id, toolate_id, ringing, cwignore, cfignore) VALUES ('".$db->escapeSimple($grpnum)."', '".$db->escapeSimple($strategy)."', ".$db->escapeSimple($grptime).", '".$db->escapeSimple($grppre)."', '".$db->escapeSimple($grplist)."', '".$annmsg_id."', '".$db->escapeSimple($postdest)."', '".$db->escapeSimple($desc)."', '".$db->escapeSimple($alertinfo)."', '$needsconf', '$remotealert_id', '$toolate_id', '$ringing', '$cwignore', '$cfignore')"; 218 260 $results = sql($sql); 261 262 // from followme, put these in astdb, should migrate more settings to astdb from sql so that user portal control can be 263 // added. So consider this a start. 264 if ($astman) { 265 $astman->database_put("RINGGROUP",$grpnum."/changecid",$changecid); 266 $fixedcid = preg_replace("/[^0-9\+]/" ,"", trim($fixedcid)); 267 $astman->database_put("RINGGROUP",$grpnum."/fixedcid",$fixedcid); 268 } else { 269 fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 270 } 219 271 return true; 220 272 } … … 224 276 225 277 $results = sql("DELETE FROM ringgroups WHERE grpnum = '".$db->escapeSimple($grpnum)."'","query"); 278 if ($astman) { 279 $astman->database_deltree("RINGGROUP/".$grpnum); 280 } else { 281 fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 282 } 226 283 } 227 284 … … 296 353 297 354 $results = sql("SELECT grpnum, strategy, grptime, grppre, grplist, annmsg_id, postdest, description, alertinfo, needsconf, remotealert_id, toolate_id, ringing, cwignore, cfignore FROM ringgroups WHERE grpnum = '".$db->escapeSimple($grpnum)."'","getRow",DB_FETCHMODE_ASSOC); 355 if ($astman) { 356 $astdb_changecid = strtolower($astman->database_get("RINGGROUP",$grpnum."/changecid")); 357 switch($astdb_changecid) { 358 case 'default': 359 case 'did': 360 case 'forcedid': 361 case 'fixed': 362 case 'extern': 363 break; 364 default: 365 $astdb_changecid = 'default'; 366 } 367 $results['changecid'] = $astdb_changecid; 368 $fixedcid = $astman->database_get("RINGGROUP",$grpnum."/fixedcid"); 369 $results['fixedcid'] = preg_replace("/[^0-9\+]/" ,"", trim($fixedcid)); 370 } else { 371 fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); 372 } 298 373 return $results; 299 374 } modules/branches/2.7/ringgroups/module.xml
r8189 r8839 2 2 <rawname>ringgroups</rawname> 3 3 <name>Ring Groups</name> 4 <version>2. 6.0.1</version>4 <version>2.7.0.0</version> 5 5 <publisher>FreePBX</publisher> 6 6 <license>GPLv2+</license> … … 11 11 </description> 12 12 <changelog> 13 *2.7.0.0* #4050 13 14 *2.6.0.1* #3610 14 15 *2.6.0.0* #3697 modules/branches/2.7/ringgroups/page.ringgroups.php
r8103 r8839 31 31 isset($_REQUEST['ringing'])?$ringing = $_REQUEST['ringing']:$ringing=''; 32 32 33 isset($_REQUEST['changecid'])?$changecid = $_REQUEST['changecid']:$changecid='default'; 34 isset($_REQUEST['fixedcid'])?$fixedcid = $_REQUEST['fixedcid']:$fixedcid=''; 35 33 36 if (isset($_REQUEST['goto0']) && isset($_REQUEST[$_REQUEST['goto0']."0"])) { 34 37 $goto = $_REQUEST[$_REQUEST['goto0']."0"]; … … 77 80 $conflict_url = framework_display_extension_usage_alert($usage_arr); 78 81 79 } elseif (ringgroups_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$description,$grppre,$annmsg_id,$alertinfo,$needsconf,$remotealert_id,$toolate_id,$ringing,$cwignore,$cfignore )) {82 } elseif (ringgroups_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$description,$grppre,$annmsg_id,$alertinfo,$needsconf,$remotealert_id,$toolate_id,$ringing,$cwignore,$cfignore,$changecid,$fixedcid)) { 80 83 needreload(); 81 84 redirect_standard(); … … 93 96 if ($action == 'edtGRP') { 94 97 ringgroups_del($account); 95 ringgroups_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$description,$grppre,$annmsg_id,$alertinfo,$needsconf,$remotealert_id,$toolate_id,$ringing,$cwignore,$cfignore );98 ringgroups_add($account,$strategy,$grptime,implode("-",$grplist),$goto,$description,$grppre,$annmsg_id,$alertinfo,$needsconf,$remotealert_id,$toolate_id,$ringing,$cwignore,$cfignore,$changecid,$fixedcid); 96 99 needreload(); 97 100 redirect_standard('extdisplay'); … … 139 142 $toolate_id = $thisgrp['toolate_id']; 140 143 $ringing = $thisgrp['ringing']; 144 $changecid = isset($thisgrp['changecid']) ? $thisgrp['changecid'] : 'default'; 145 $fixedcid = isset($thisgrp['fixedcid']) ? $thisgrp['fixedcid'] : ''; 141 146 unset($grpliststr); 142 147 unset($thisgrp); … … 390 395 </tr> 391 396 <?php } ?> 397 <tr><td colspan="2"><h5><?php echo _("Change External CID Configuration") ?><hr></h5></td></tr> 398 <tr> 399 <td> 400 <a href="#" class="info"><?php echo _("Mode")?>: 401 <span> 402 <b><?php echo _("Default")?></b>: <?php echo _("Transmits the Callers CID if allowed by the trunk.")?><br> 403 <b><?php echo _("Fixed CID Value")?></b>: <?php echo _("Always transmit the Fixed CID Value below.")?><br> 404 <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> 405 <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> 406 <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 transmitted on trunks that block foreign callerid")?><br> 407 </span> 408 </a> 409 </td> 410 <td> 411 <select name="changecid" id="changecid" tabindex="<?php echo ++$tabindex;?>"> 412 <?php 413 $default = (isset($changecid) ? $changecid : 'default'); 414 echo '<option value="default" '.($default == 'default' ? 'SELECTED' : '').'>'._("Default"); 415 echo '<option value="fixed" '.($default == 'fixed' ? 'SELECTED' : '').'>'._("Fixed CID Value"); 416 echo '<option value="extern" '.($default == 'extern' ? 'SELECTED' : '').'>'._("Outside Calls Fixed CID Value"); 417 echo '<option value="did" '.($default == 'did' ? 'SELECTED' : '').'>'._("Use Dialed Number"); 418 echo '<option value="forcedid" '.($default == 'forcedid' ? 'SELECTED' : '').'>'._("Force Dialed Number"); 419 $fixedcid_disabled = ($default != 'fixed' && $default != 'extern') ? 'disabled = "disabled"':''; 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="30" type="text" name="fixedcid" id="fixedcid" value="<?php echo $fixedcid ?>" tabindex="<?php echo ++$tabindex;?>" <?php echo $fixedcid_disabled ?>></td> 428 </tr> 429 392 430 <?php 393 431 // implementation of module hook … … 416 454 <script language="javascript"> 417 455 <!-- 456 457 $(document).ready(function(){ 458 $("#changecid").change(function(){ 459 state = (this.value == "fixed" || this.value == "extern") ? "" : "disabled"; 460 $("#fixedcid").attr("disabled",state); 461 }); 462 }); 418 463 419 464 function insertExten() { … … 455 500 return warnInvalid(theForm.grplist, msgInvalidExtList); 456 501 502 if (!theForm.fixedcid.disabled) { 503 fixedcid = $.trim(theForm.fixedcid.value); 504 if (!fixedcid.match('^[+]{0,1}[0-9]+$')) { 505 return warnInvalid(theForm.fixedcid, msgInvalidCID); 506 } 507 } 508 457 509 defaultEmptyOK = false; 458 510 if (!isInteger(theForm.grptime.value)) {
