📄 page.trunks.php
字号:
//var npanxx = prompt("What is your areacode + prefix (NPA-NXX)?", document.getElementById('areacode').value); do { var npanxx = <?php echo 'prompt("'._("What is your areacode + prefix (NPA-NXX)?\\n\\n(Note: this database contains North American numbers only, and is not guaranteed to be 100% accurate. You will still have the option of modifying results.)\\n\\nThis may take a few seconds.".'")')?>; if (npanxx == null) return; } while (!npanxx.match("^[2-9][0-9][0-9][-]?[2-9][0-9][0-9]$") && <?php echo '!alert("'._("Invalid NPA-NXX. Must be of the format \'NXX-NXX\'").'")'?>); document.getElementById('npanxx').value = npanxx; trunkEdit.action.value = "populatenpanxx"; trunkEdit.submit();<?php } else { // curl is not installed?> <?php echo 'alert("'._("Error: Cannot continue!\\n\\nPrefix lookup requires cURL support in PHP on the server. Please install or enable cURL support in your PHP installation to use this function. See http://www.php.net/curl for more information.").'")'?>;<?php }?> } function populateAlwaysAdd() { do { var localpattern = <?php echo 'prompt("'._("What is the local dialing pattern?\\n\\n(ie. NXXNXXXXXX for US/CAN 10-digit dialing, NXXXXXX for 7-digit)").'"'?>,"NXXXXXX"); if (localpattern == null) return; } while (!localpattern.match('^[0-9#*ZXN\.]+$') && <?php echo '!alert("'._("Invalid pattern. Only 0-9, #, *, Z, N, X and . are allowed.").'")'?>); do { var localprefix = <?php echo 'prompt("'._("What prefix should be added to the dialing pattern?\\n\\n(ie. for US/CAN, 1+areacode, ie, \'1613\')?").'")'?>; if (localprefix == null) return; } while (!localprefix.match('^[0-9#*]+$') && <?php echo '!alert("'._("Invalid prefix. Only dialable characters (0-9, #, and *) are allowed.").'")'?>); dialrules = document.getElementById('dialrules'); if (dialrules.value[dialrules.value.length-1] != '\n') { dialrules.value = dialrules.value + '\n'; } dialrules.value = dialrules.value + localprefix + '+' + localpattern + '\n'; } function populateRemove() { do { var localprefix = <?php echo 'prompt("'._("What prefix should be removed from the number?\\n\\n(ie. for US/CAN, 1+areacode, ie, \'1613\')").'")'?>; if (localprefix == null) return; } while (!localprefix.match('^[0-9#*ZXN\.]+$') && <?php echo '!alert("'._('Invalid prefix. Only 0-9, #, *, Z, N, and X are allowed.').'")'?>); do { 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"); if (localpattern == null) return; } while (!localpattern.match('^[0-9#*ZXN\.]+$') && <?php echo '!alert("'._("Invalid pattern. Only 0-9, #, *, Z, N, X and . are allowed.").'")'?>); dialrules = document.getElementById('dialrules'); if (dialrules.value[dialrules.value.length-1] != '\n') { dialrules.value = dialrules.value + '\n'; } dialrules.value = dialrules.value + localprefix + '|' + localpattern + '\n'; } function changeAutoPop() { switch(document.getElementById('autopop').value) { case "always": populateAlwaysAdd(); break; case "remove": populateRemove(); break; case "lookup": populateLookup(); break; } document.getElementById('autopop').value = ''; } </script><?php /* //DIALRULES <tr> <td> <a href=# class="info">Dial rules<span>The area code this trunk is in.</span></a>: </td><td> <select id="dialrulestype" name="dialrulestype" onChange="changeRulesType();"><?php $rules = array( "asis" => "Don't change number", "always" => "Always dial prefix+areacode", "local" => "Local 7-digit dialing", "local10" => "Local 10-digit dialing"); foreach ($rules as $value=>$display) { echo "<option value=\"".$value."\" ".(($value == $dialrulestype) ? "SELECTED" : "").">".$display."</option>"; }?> </select> </td> </tr> <tr> <td> <a href=# class="info"><?php echo _("Local dialing pattern<span>The dialing pattern to make a 'local' call.</span>")</a>: </td><td> <input id="localpattern" type="text" size="10" maxlength="20" name="localpattern" value="<?php echo $localpattern ?>"/> </td> </tr> <tr> <td> <a href=# class="info"><?php echo _("Long-distance dial prefix<span>The prefix for dialing long-distance numbers. In north america, this should be \"1\".</span>")?></a>: </td><td> <input id="lddialprefix" type="text" size="3" maxlength="6" name="lddialprefix" value="<?php echo $lddialprefix ?>"/> </td> </tr> <tr> <td> <a href=# class="info"><?php echo _("Local LD prefix<span>The area code this trunk is in. Any 7-digit numbers that don't match a number in the below list will have dialprefix+areacode added to them. </span>")?></a>: </td><td> <input id="areacode" type="text" size="3" maxlength="6" name="areacode" value="<?php echo $areacode ?>"/> </td> </tr> <tr> <td valign="top"> <a href=# class="info"><?php echo _("Local prefixes<span>This should be a list of local areacodes + prefixes to use for local dialing.</span>")?></a>: </td><td valign="top"> <textarea id="localprefixes" cols="8" rows="<?php $rows = count($localprefixes)+1; echo (($rows < 5) ? 5 : (($rows > 20) ? 20 : $rows) ); ?>" name="localprefixes"><?php echo implode("\n",$localprefixes);?></textarea><br> <input id="npanxx" name="npanxx" type="hidden" /><br> <a href=# class="info"><?php echo _("Populate with local rules<span>Do a lookup from http://members.dandy.net/~czg/search.html to find all local-reachable area codes and phone numbers.</span>")?></a>: <input type="button" value="Go" onClick="checkPopulate();" /> <br><br> </td> </tr> <script language="javascript"> function checkPopulate() { //var npanxx = prompt("What is your areacode + prefix (NPA-NXX)?", document.getElementById('areacode').value); var npanxx = <?php echo 'prompt("'._("What is your areacode + prefix (NPA-NXX)?").'")'?>; if (npanxx.match("^[2-9][0-9][0-9][-]?[2-9][0-9][0-9]$")) { document.getElementById('npanxx').value = npanxx; trunkEdit.action.value = "populatenpanxx"; trunkEdit.submit(); } else if (npanxx != null) { <?php echo 'alert("'._("Invalid format for NPA-NXX code (must be format: NXXNXX)").'")'?>; } } function changeRulesType() { switch(document.getElementById('dialrulestype').value) { case "always": document.getElementById('lddialprefix').disabled = false; document.getElementById('areacode').disabled = false; document.getElementById('localprefixes').disabled = true; break; case "local": case "local10": document.getElementById('lddialprefix').disabled = false; document.getElementById('areacode').disabled = false; document.getElementById('localprefixes').disabled = false; break; case "asis": default: document.getElementById('lddialprefix').disabled = true; document.getElementById('areacode').disabled = true; document.getElementById('localprefixes').disabled = true; break; } } changeRulesType(); </script>*/?> <tr> <td> <a href=# class="info"><?php echo _("Outbound Dial Prefix")?><span><?php echo _("The outbound dialing prefix is used to prefix a dialing string to all outbound calls placed on this trunk. For example, if this trunk is behind another PBX or is a Centrex line, then you would put 9 here to access an outbound line.<br><br>Most users should leave this option blank.")?></span></a>: </td><td> <input type="text" size="8" name="dialoutprefix" value="<?php echo htmlspecialchars($dialoutprefix) ?>"/> </td> </tr> <?php if ($tech != "enum") { ?> <tr> <td colspan="2"> <br><h4><?php echo _("Outgoing Settings")?></h4> </td> </tr> <?php } ?> <?php switch ($tech) { case "zap": ?> <tr> <td> <a href=# class="info"><?php echo _("Zap Identifier (trunk name)")?><span><br><?php echo _("ZAP channels are referenced either by a group number or channel number (which is defined in zapata.conf). <br><br>The default setting is <b>g0</b> (group zero).")?><br><br></span></a>: </td><td> <input type="text" size="8" name="channelid" value="<?php echo htmlspecialchars($channelid) ?>"/> <input type="hidden" size="14" name="usercontext" value="notneeded"/> </td> </tr> <?php break; case "enum": break; case "custom": ?> <tr> <td> <a href=# class="info"><?php echo _("Custom Dial String")?><span><?php echo _("Define the custom Dial String. Include the token")?> $OUTNUM$ <?php echo _("wherever the number to dial should go.<br><br><b>examples:</b><br><br>CAPI/XXXXXXXX/")?>$OUTNUM$<?php echo _("/b<br>H323/")?>$OUTNUM$@XX.XX.XX.XX<br>OH323/$OUTNUM$@XX.XX.XX.XX:XXXX<br>vpb/1-1/$OUTNUM$</span></a>: </td><td> <input type="text" size="35" maxlength="46" name="channelid" value="<?php echo htmlspecialchars($channelid) ?>"/> <input type="hidden" size="14" name="usercontext" value="notneeded"/> </td> </tr> <?php break; default: ?> <tr> <td> <a href=# class="info"><?php echo _("Trunk Name")?><span><br><?php echo _("Give this trunk a unique name. Example: myiaxtel")?><br><br></span></a>: </td><td> <input type="text" size="14" name="channelid" value="<?php echo htmlspecialchars($channelid) ?>"/> </td> </tr> <tr> <td colspan="2"> <a href=# class="info"><?php echo _("PEER Details")?><span><br><?php echo _("Modify the default PEER connection parameters for your VoIP provider.<br><br>You may need to add to the default lines listed below, depending on your provider.")?><br><br></span></a>: </td> </tr> <tr> <td colspan="2"> <textarea rows="10" cols="40" name="peerdetails"><?php echo htmlspecialchars($peerdetails) ?></textarea> </td> </tr> <tr> <td colspan="2"> <br><h4><?php echo _("Incoming Settings")?></h4> </td> </tr> <tr> <td> <a href=# class="info"><?php echo _("USER Context")?><span><br><?php echo _("This is most often the account name or number your provider expects.<br><br>This USER Context will be used to define the below user details.")?></span></a>: </td><td> <input type="text" size="14" name="usercontext" value="<?php echo htmlspecialchars($usercontext) ?>"/> </td> </tr> <tr> <td colspan="2"> <a href=# class="info"><?php echo _("USER Details")?><span><br><?php echo _("Modify the default USER connection parameters for your VoIP provider.")?><br><br><?php echo _("You may need to add to the default lines listed below, depending on your provider.")?><br><br></span></a>: </td> </tr> <tr> <td colspan="2"> <textarea rows="10" cols="40" name="userconfig"><?php echo htmlspecialchars($userconfig); ?></textarea> </td> </tr> <tr> <td colspan="2"> <br><h4><?php echo _("Registration")?></h4> </td> </tr> <tr> <td colspan="2"> <a href=# class="info"><?php echo _("Register String")?><span><br><?php echo _("Most VoIP providers require your system to REGISTER with theirs. Enter the registration line here.<br><br>example:<br><br>username:password@switch.voipprovider.com")?><br><br></span></a>: </td> </tr> <tr> <td colspan="2"> <input type="text" size="40" name="register" value="<?php echo htmlspecialchars($register) ?>"/> </td> </tr> <?php break; } ?> <tr> <td colspan="2"> <h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6> </td> </tr> </table><script language="javascript"><!--var theForm = document.trunkEdit;theForm.outcid.focus();function trunkEdit_onsubmit(act) { var msgInvalidOutboundCID = "<?php echo _('Invalid Outbound Caller ID'); ?>"; var msgInvalidMaxChans = "<?php echo _('Invalid Maximum Channels'); ?>"; var msgInvalidDialRules = "<?php echo _('Invalid Dial Rules'); ?>"; var msgInvalidOutboundDialPrefix = "<?php echo _('Invalid Outbound Dial Prefix'); ?>"; var msgInvalidTrunkName = "<?php echo _('Invalid Trunk Name entered'); ?>"; var msgInvalidChannelName = "<?php echo _('Invalid Custom Dial String entered'); ?>"; var msgInvalidTrunkAndUserSame = "<?php echo _('Trunk Name and User Context cannot be set to the same value'); ?>"; defaultEmptyOK = true; if (!isCallerID(theForm.outcid.value)) return warnInvalid(theForm.outcid, msgInvalidOutboundCID); if (!isInteger(theForm.maxchans.value)) return warnInvalid(theForm.maxchans, msgInvalidMaxChans); if (!isDialpattern(theForm.dialrules.value)) return warnInvalid(theForm.dialrules, msgInvalidDialRules); if (!isDialIdentifierSpecial(theForm.dialoutprefix.value)) return warnInvalid(theForm.dialoutprefix, msgInvalidOutboundDialPrefix); <?php if ($tech != "enum" && $tech != "custom") { ?> defaultEmptyOK = true; if (isEmpty(theForm.channelid.value) || isWhitespace(theForm.channelid.value)) return warnInvalid(theForm.channelid, msgInvalidTrunkName); if (theForm.channelid.value == theForm.usercontext.value) return warnInvalid(theForm.usercontext, msgInvalidTrunkAndUserSame); <?php } else if ($tech == "custom") { ?> if (isEmpty(theForm.channelid.value) || isWhitespace(theForm.channelid.value)) return warnInvalid(theForm.channelid, msgInvalidChannelName); if (theForm.channelid.value == theForm.usercontext.value) return warnInvalid(theForm.usercontext, msgInvalidTrunkAndUserSame); <?php } ?> theForm.action.value = act; return true;}function isDialIdentifierSpecial(s) { // special chars allowed in dial prefix (e.g. fwdOUT) var i; if (isEmpty(s)) if (isDialIdentifierSpecial.arguments.length == 1) return defaultEmptyOK; else return (isDialIdentifierSpecial.arguments[1] == true); for (i = 0; i < s.length; i++) { var c = s.charAt(i); if ( !isDialDigitChar(c) && (c != "w") && (c != "W") && (c != "q") && (c != "Q") ) return false; } return true;}//--></script> </form><?php }?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -