Ticket #2591: trunks.patch
| File trunks.patch, 10.2 kB (added by ded, 4 years ago) |
|---|
-
page.trunks.php
old new 1 <?php /* $Id: page.trunks.php 5 353 2007-12-05 22:09:16Z p_lindheimer $ */1 <?php /* $Id: page.trunks.php 5615 2008-01-26 19:50:13Z p_lindheimer $ */ 2 2 // routing.php Copyright (C) 2004 Greg MacLellan (greg@mtechsolutions.ca) 3 3 // Asterisk Management Portal Copyright (C) 2004 Coalescent Systems Inc. (info@coalescentsystems.ca) 4 4 // … … 13 13 //GNU General Public License for more details. 14 14 15 15 16 17 16 $display='trunks'; 18 17 $extdisplay=isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:''; 19 18 $action = isset($_REQUEST['action'])?$_REQUEST['action']:''; … … 172 171 break; 173 172 } 174 173 175 176 177 174 //get all rows from globals 178 175 $sql = "SELECT * FROM globals"; 179 176 $globals = $db->getAll($sql); … … 197 194 $tresults = core_trunks_list(); 198 195 199 196 foreach ($tresults as $tresult) { 200 $background = ($tresult[2] == 'on')?'#DDD':' #FFF';201 echo "\t<li><a ".($extdisplay==$tresult[0] ? 'class="current"':'')." href=\"config.php?display=".urlencode($display)."&extdisplay=".urlencode($tresult[0])."\" title=\"".urlencode($tresult[1])."\" style=\"background: $background;\" >"._("Trunk")." ".substr( ltrim($tresult[1],"AMP:"),0,15)."</a></li>\n";197 $background = ($tresult[2] == 'on')?'#DDD':''; 198 echo "\t<li><a ".($extdisplay==$tresult[0] ? 'class="current"':'')." href=\"config.php?display=".urlencode($display)."&extdisplay=".urlencode($tresult[0])."\" title=\"".urlencode($tresult[1])."\" style=\"background: $background;\" >"._("Trunk")." ".substr(str_replace('AMP:', '', $tresult[1]),0,15)."</a></li>\n"; 202 199 } 203 200 204 201 ?> … … 217 214 <a href="<?php echo $_SERVER['PHP_SELF'].'?display='.urlencode($display); ?>&tech=SIP"><?php echo _("Add SIP Trunk")?></a><br><br> 218 215 <a href="<?php echo $_SERVER['PHP_SELF'].'?display='.urlencode($display); ?>&tech=ENUM"><?php echo _("Add ENUM Trunk")?></a><br><br> 219 216 <a href="<?php echo $_SERVER['PHP_SELF'].'?display='.urlencode($display); ?>&tech=CUSTOM"><?php echo _("Add Custom Trunk")?></a><br><br> 217 <a href="<?php echo $_SERVER['PHP_SELF'].'?display='.urlencode($display); ?>&tech=DUNDI"><?php echo _("Add DUNDi Trunk")?></a><br><br> 220 218 <?php 221 219 } else { 222 220 if ($extdisplay) { … … 231 229 $failtrunk = isset(${"OUTFAIL_".$trunknum})?${"OUTFAIL_".$trunknum}:''; 232 230 $failtrunk_enable = ($failtrunk == "")?'':'CHECKED'; 233 231 $disabletrunk = isset(${"OUTDISABLE_".$trunknum})?${"OUTDISABLE_".$trunknum}:''; 232 234 233 235 234 if ($tech!="enum") { 236 235 … … 238 237 $channelid = core_trunks_getTrunkTrunkName($trunknum); 239 238 } 240 239 241 if ($tech!="custom" ) { // custom trunks will not have user/peer details in database table240 if ($tech!="custom" && $tech!="dundi") { // custom trunks will not have user/peer details in database table 242 241 // load from db 243 242 if (!isset($peerdetails)) { 244 243 $peerdetails = core_trunks_getTrunkPeerDetails($trunknum); … … 269 268 } 270 269 unset($temp); 271 270 } 272 271 273 272 echo "<h2>".sprintf(_("Edit %s Trunk"),strtoupper($tech))."</h2>"; 274 273 ?> 275 274 <p><a title="<?php echo $channelid ?>" href="config.php?display=<?php echo urlencode($display) ?>&extdisplay=<?php echo urlencode($extdisplay) ?>&action=deltrunk"><?php echo _("Delete Trunk")?> <?php echo substr($channelid,0,20); ?></a></p> … … 313 312 $areacode = ""; 314 313 315 314 echo "<h2>".sprintf("Add %s Trunk",strtoupper($tech))."</h2>"; 315 316 316 } 317 switch ($tech) { 318 case 'dundi': 319 $helptext = _("FreePBX offers limited support for DUNDi trunks and additional manual configuration is required. The trunk name should correspond to the [mappings] section of the remote dundi.conf systems. For example, you may have a mapping on the remote system, and corresponding configurations in dundi.conf locally, that looks as follows:<br /><br />[mappings]<br />priv => dundi-extens,0,IAX2,priv:${SECRET}@218.23.42.26/${NUMBER},noparital<br /><br />In this example, you would create this trunk and name it priv. You would then create the corresponding IAX2 trunk with proper settings to work with DUNDi. This can be done by making an IAX2 trunk in FreePBX or by using the iax_custom.conf file.<br />The dundi-extens context in this example must be created in extensions_custom.conf. This can simply include contexts such as ext-local, ext-intercom-users, ext-paging and so forth to provide access to the corresponding extensions and features provided by these various contexts and generated by FreePBX."); 320 break; 321 default: 322 $helptext = ''; 323 } 324 if ($helptext != '') { 325 if ($extdisplay) { 326 echo "<br /><br />"; 327 } 328 echo $helptext; 329 } 330 317 331 ?> 318 332 319 333 <form name="trunkEdit" action="config.php" method="post" onsubmit="return trunkEdit_onsubmit('<?php echo ($extdisplay ? "edittrunk" : "addtrunk") ?>');"> … … 345 359 <?php 346 360 if ($tech == "sip" || substr($tech,0,3) == "iax") { 347 361 ?> 348 <a href=# class="info"><?php echo _("Maximum Channels")?><span><?php echo sprintf(_("Controls the maximum number of outbound channels (simultaneous calls) that can be used on this trunk. To count inbound calls against this maximum, use the auto-generated context: %s as the inbound trunk's context. (see extensions_additional.conf) Leave blank to specify no maximum."),((isset($channelid) && trim($channelid)!="")?"from-trunk-$ channelid":"from-trunk-[trunkname]"))?></span></a>:362 <a href=# class="info"><?php echo _("Maximum Channels")?><span><?php echo sprintf(_("Controls the maximum number of outbound channels (simultaneous calls) that can be used on this trunk. To count inbound calls against this maximum, use the auto-generated context: %s as the inbound trunk's context. (see extensions_additional.conf) Leave blank to specify no maximum."),((isset($channelid) && trim($channelid)!="")?"from-trunk-$tech-$channelid":"from-trunk-[trunkname]"))?></span></a>: 349 363 <?php 350 364 } else { 351 365 ?> … … 494 508 do { 495 509 var localprefix = <?php echo 'prompt("'._("What prefix should be removed from the number?\\n\\n(ie. for US/CAN, 1+areacode, ie, \'1613\')").'")'?>; 496 510 if (localprefix == null) return; 497 } while (!localprefix.match('^[0-9#*ZXN\.]+$') && <?php echo '!alert("'._( 'Invalid prefix. Only 0-9, #, *, Z, N, and X are allowed.').'")'?>);511 } while (!localprefix.match('^[0-9#*ZXN\.]+$') && <?php echo '!alert("'._("Invalid prefix. Only 0-9, #, *, Z, N, and X are allowed.").'")'?>); 498 512 499 513 do { 500 514 var localpattern = <?php echo 'prompt("'._("What is the dialing pattern for local numbers after")?> "+localprefix+"? \n\n<?php echo _("(ie. NXXNXXXXXX for US/CAN 10-digit dialing, NXXXXXX for 7-digit)").'"'?>,"NXXXXXX"); … … 663 677 </tr> 664 678 <?php 665 679 break; 680 case "dundi": 681 ?> 682 <tr> 683 <td> 684 <a href=# class="info"><?php echo _("DUNDi Mapping")?><span><?php echo _("This is the name of the DUNDi mapping as defined in the [mappings] section of remote dundi.conf peers. This corresponds to the 'include' section of the peer details in the local dundi.conf file. This requires manual configuration of DUNDi to use this trunk.")?></span></a>: 685 </td><td> 686 <input type="text" size="35" maxlength="46" name="channelid" value="<?php echo htmlspecialchars($channelid) ?>"/> 687 <input type="hidden" size="14" name="usercontext" value="notneeded"/> 688 </td> 689 </tr> 690 <?php 691 break; 666 692 default: 667 693 ?> 668 694 <tr> … … 740 766 theForm.outcid.focus(); 741 767 742 768 function trunkEdit_onsubmit(act) { 743 var msgInvalidOutboundCID = "<?php echo _( 'Invalid Outbound Caller ID'); ?>";744 var msgInvalidMaxChans = "<?php echo _( 'Invalid Maximum Channels'); ?>";745 var msgInvalidDialRules = "<?php echo _( 'Invalid Dial Rules'); ?>";746 var msgInvalidOutboundDialPrefix = "<?php echo _( 'Invalid Outbound Dial Prefix'); ?>";747 var msgInvalidTrunkName = "<?php echo _( 'Invalid Trunk Name entered'); ?>";748 var msgInvalidChannelName = "<?php echo _( 'Invalid Custom Dial String entered'); ?>";749 var msgInvalidTrunkAndUserSame = "<?php echo _( 'Trunk Name and User Context cannot be set to the same value'); ?>";750 var msgConfirmBlankContext = "<?php echo _( 'User Context was left blank and User Details will not be saved!'); ?>";751 var msgNeverOverrideCIDValue = "<?php echo _( 'You must define an Outbound Caller ID when Choosing Never Override CallerID'); ?>";769 var msgInvalidOutboundCID = "<?php echo _("Invalid Outbound Caller ID"); ?>"; 770 var msgInvalidMaxChans = "<?php echo _("Invalid Maximum Channels"); ?>"; 771 var msgInvalidDialRules = "<?php echo _("Invalid Dial Rules"); ?>"; 772 var msgInvalidOutboundDialPrefix = "<?php echo _("Invalid Outbound Dial Prefix"); ?>"; 773 var msgInvalidTrunkName = "<?php echo _("Invalid Trunk Name entered"); ?>"; 774 var msgInvalidChannelName = "<?php echo _("Invalid Custom Dial String entered"); ?>"; 775 var msgInvalidTrunkAndUserSame = "<?php echo _("Trunk Name and User Context cannot be set to the same value"); ?>"; 776 var msgConfirmBlankContext = "<?php echo _("User Context was left blank and User Details will not be saved!"); ?>"; 777 var msgNeverOverrideCIDValue = "<?php echo _("You must define an Outbound Caller ID when Choosing Never Override CallerID"); ?>"; 752 778 753 779 defaultEmptyOK = true; 754 780 … … 767 793 if (!isDialIdentifierSpecial(theForm.dialoutprefix.value)) 768 794 return warnInvalid(theForm.dialoutprefix, msgInvalidOutboundDialPrefix); 769 795 770 <?php if ($tech != "enum" && $tech != "custom" ) { ?>796 <?php if ($tech != "enum" && $tech != "custom" && $tech != "dundi") { ?> 771 797 defaultEmptyOK = true; 772 798 if (isEmpty(theForm.channelid.value) || isWhitespace(theForm.channelid.value)) 773 799 return warnInvalid(theForm.channelid, msgInvalidTrunkName); 774 800 775 801 if (theForm.channelid.value == theForm.usercontext.value) 776 802 return warnInvalid(theForm.usercontext, msgInvalidTrunkAndUserSame); 777 <?php } else if ($tech == "custom" ) { ?>803 <?php } else if ($tech == "custom" || $tech == "dundi") { ?> 778 804 if (isEmpty(theForm.channelid.value) || isWhitespace(theForm.channelid.value)) 779 805 return warnInvalid(theForm.channelid, msgInvalidChannelName); 780 806
