| 1 |
<?php |
|---|
| 2 |
// routing.php Copyright (C) 2004 Greg MacLellan (greg@mtechsolutions.ca) |
|---|
| 3 |
// Asterisk Management Portal Copyright (C) 2004 Coalescent Systems Inc. (info@coalescentsystems.ca) |
|---|
| 4 |
// |
|---|
| 5 |
//This program is free software; you can redistribute it and/or |
|---|
| 6 |
//modify it under the terms of the GNU General Public License |
|---|
| 7 |
//as published by the Free Software Foundation; either version 2 |
|---|
| 8 |
//of the License, or (at your option) any later version. |
|---|
| 9 |
// |
|---|
| 10 |
//This program is distributed in the hope that it will be useful, |
|---|
| 11 |
//but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 |
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 |
//GNU General Public License for more details. |
|---|
| 14 |
|
|---|
| 15 |
$localPrefixFile = "/etc/asterisk/localprefixes.conf"; |
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
$display='trunks'; |
|---|
| 19 |
$extdisplay=isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:''; |
|---|
| 20 |
$action = isset($_REQUEST['action'])?$_REQUEST['action']:''; |
|---|
| 21 |
$tech = strtolower(isset($_REQUEST['tech'])?$_REQUEST['tech']:''); |
|---|
| 22 |
|
|---|
| 23 |
$trunknum = ltrim($extdisplay,'OUT_'); |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
$set_globals = array("outcid","maxchans","dialoutprefix","channelid","peerdetails","usercontext","userconfig","register","keepcid"); |
|---|
| 28 |
foreach ($set_globals as $var) { |
|---|
| 29 |
if (isset($_REQUEST[$var])) { |
|---|
| 30 |
$$var = stripslashes( $_REQUEST[$var] ); |
|---|
| 31 |
} |
|---|
| 32 |
} |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
if (!isset($keepcid)) { |
|---|
| 36 |
$keepcid = "off"; |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
if (isset($_REQUEST["dialrules"])) { |
|---|
| 40 |
|
|---|
| 41 |
$dialrules = explode("\n",$_REQUEST["dialrules"]); |
|---|
| 42 |
|
|---|
| 43 |
if (is_array($dialrules)) |
|---|
| 44 |
foreach (array_keys($dialrules) as $key) { |
|---|
| 45 |
|
|---|
| 46 |
$dialrules[$key] = trim($dialrules[$key]); |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
if ($dialrules[$key] == "") unset($dialrules[$key]); |
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
if ($dialrules[$key][0] == "_") $dialrules[$key] = substr($dialrules[$key],1); |
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
$dialrules = array_values(array_unique($dialrules)); |
|---|
| 57 |
} |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
switch ($action) { |
|---|
| 61 |
case "addtrunk": |
|---|
| 62 |
$trunknum = core_trunks_add($tech, $channelid, $dialoutprefix, $maxchans, $outcid, $peerdetails, $usercontext, $userconfig, $register, $keepcid); |
|---|
| 63 |
|
|---|
| 64 |
core_trunks_addDialRules($trunknum, $dialrules); |
|---|
| 65 |
needreload(); |
|---|
| 66 |
redirect_standard(); |
|---|
| 67 |
break; |
|---|
| 68 |
case "edittrunk": |
|---|
| 69 |
core_trunks_edit($trunknum, $channelid, $dialoutprefix, $maxchans, $outcid, $peerdetails, $usercontext, $userconfig, $register, $keepcid); |
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
deleteTrunkRules($channelid); |
|---|
| 73 |
addTrunkRules($channelid, $dialrules); |
|---|
| 74 |
*/ |
|---|
| 75 |
|
|---|
| 76 |
// this can rewrite too, so edit is the same |
|---|
| 77 |
core_trunks_addDialRules($trunknum, $dialrules); |
|---|
| 78 |
needreload(); |
|---|
| 79 |
redirect_standard('extdisplay'); |
|---|
| 80 |
break; |
|---|
| 81 |
case "deltrunk": |
|---|
| 82 |
|
|---|
| 83 |
core_trunks_del($trunknum); |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
deleteTrunkRules($channelid); |
|---|
| 87 |
*/ |
|---|
| 88 |
core_trunks_deleteDialRules($trunknum); |
|---|
| 89 |
needreload(); |
|---|
| 90 |
redirect_standard(); |
|---|
| 91 |
break; |
|---|
| 92 |
case "populatenpanxx7": |
|---|
| 93 |
case "populatenpanxx10": |
|---|
| 94 |
if (preg_match("/^([2-9]\d\d)-?([2-9]\d\d)$/", $_REQUEST["npanxx"], $matches)) { |
|---|
| 95 |
|
|---|
| 96 |
$ch = curl_init(); |
|---|
| 97 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|---|
| 98 |
curl_setopt($ch, CURLOPT_URL, "http://www.localcallingguide.com/xmllocalprefix.php?npa=".$matches[1]."&nxx=".$matches[2]); |
|---|
| 99 |
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Linux; FreePBX Local Trunks Configuration)"); |
|---|
| 100 |
$str = curl_exec($ch); |
|---|
| 101 |
curl_close($ch); |
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
require_once($amp_conf['AMPWEBROOT'] . '/admin/modules/core/XML_Parser.php'); |
|---|
| 105 |
require_once($amp_conf['AMPWEBROOT'] . '/admin/modules/core/XML_Unserializer.php'); |
|---|
| 106 |
|
|---|
| 107 |
$xml = new xml_unserializer; |
|---|
| 108 |
$xml->unserialize($str); |
|---|
| 109 |
$xmldata = $xml->getUnserializedData(); |
|---|
| 110 |
|
|---|
| 111 |
if (isset($xmldata['lca-data']['prefix'])) { |
|---|
| 112 |
|
|---|
| 113 |
if ($action == 'populatenpanxx10') { |
|---|
| 114 |
|
|---|
| 115 |
// - add area code to 7 digits |
|---|
| 116 |
// - match local 10 digits |
|---|
| 117 |
// - add 1 to anything else |
|---|
| 118 |
$dialrules[] = $matches[1].'NXXXXXX'; |
|---|
| 119 |
foreach ($xmldata['lca-data']['prefix'] as $prefix) { |
|---|
| 120 |
$dialrules[] = $prefix['npa'].$prefix['nxx'].'XXXX'; |
|---|
| 121 |
} |
|---|
| 122 |
|
|---|
| 123 |
$dialrules[] = '1+NXXNXXXXXX'; |
|---|
| 124 |
} else { |
|---|
| 125 |
|
|---|
| 126 |
// - drop area code from local numbers |
|---|
| 127 |
// - match local 7 digit numbers |
|---|
| 128 |
// - add 1 to everything else |
|---|
| 129 |
foreach ($xmldata['lca-data']['prefix'] as $prefix) { |
|---|
| 130 |
$dialrules[] = $prefix['npa'].'|'.$prefix['nxx'].'XXXX'; |
|---|
| 131 |
} |
|---|
| 132 |
foreach ($xmldata['lca-data']['prefix'] as $prefix) { |
|---|
| 133 |
$dialrules[] = $prefix['nxx'].'XXXX'; |
|---|
| 134 |
} |
|---|
| 135 |
$dialrules[] = '1+NXXNXXXXXX'; |
|---|
| 136 |
$dialrules[] = '1'.$matches[1].'+NXXXXXX'; |
|---|
| 137 |
} |
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
$dialrules = array_values(array_unique($dialrules)); |
|---|
| 141 |
} else { |
|---|
| 142 |
$errormsg = _("Error fetching prefix list for: "). $_REQUEST["npanxx"]; |
|---|
| 143 |
} |
|---|
| 144 |
|
|---|
| 145 |
} else { |
|---|
| 146 |
|
|---|
| 147 |
$errormsg = _("Invalid format for NPA-NXX code (must be format: NXXNXX)"); |
|---|
| 148 |
} |
|---|
| 149 |
|
|---|
| 150 |
if (isset($errormsg)) { |
|---|
| 151 |
echo "<script language=\"javascript\">alert('".addslashes($errormsg)."');</script>"; |
|---|
| 152 |
unset($errormsg); |
|---|
| 153 |
} |
|---|
| 154 |
break; |
|---|
| 155 |
} |
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 |
|
|---|
| 160 |
$sql = "SELECT * FROM globals"; |
|---|
| 161 |
$globals = $db->getAll($sql); |
|---|
| 162 |
if(DB::IsError($globals)) { |
|---|
| 163 |
die($globals->getMessage()); |
|---|
| 164 |
} |
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
foreach ($globals as $global) { |
|---|
| 168 |
${trim($global[0])} = htmlentities($global[1]); |
|---|
| 169 |
} |
|---|
| 170 |
|
|---|
| 171 |
?> |
|---|
| 172 |
</div> |
|---|
| 173 |
|
|---|
| 174 |
<div class="rnav"> |
|---|
| 175 |
<ul> |
|---|
| 176 |
<li><a <?php echo ($extdisplay=='' ? 'class="current"':'') ?> href="config.php?display=<?php echo urlencode($display)?>"><?php echo _("Add Trunk")?></a></li> |
|---|
| 177 |
<?php |
|---|
| 178 |
|
|---|
| 179 |
$tresults = core_trunks_list(); |
|---|
| 180 |
|
|---|
| 181 |
foreach ($tresults as $tresult) { |
|---|
| 182 |
echo "\t<li><a ".($extdisplay==$tresult[0] ? 'class="current"':'')." href=\"config.php?display=".urlencode($display)."&extdisplay=".urlencode($tresult[0])."\" title=\"".urlencode($tresult[1])."\">"._("Trunk")." ".substr(ltrim($tresult[1],"AMP:"),0,15)."</a></li>\n"; |
|---|
| 183 |
} |
|---|
| 184 |
|
|---|
| 185 |
?> |
|---|
| 186 |
</ul> |
|---|
| 187 |
</div> |
|---|
| 188 |
|
|---|
| 189 |
<div class="content"> |
|---|
| 190 |
|
|---|
| 191 |
<?php |
|---|
| 192 |
|
|---|
| 193 |
if (!$tech && !$extdisplay) { |
|---|
| 194 |
?> |
|---|
| 195 |
<h2><?php echo _("Add a Trunk")?></h2> |
|---|
| 196 |
<a href="<?php echo $_SERVER['PHP_SELF'].'?display='.urlencode($display); ?>&tech=ZAP"><?php echo _("Add ZAP Trunk")?></a><br><br> |
|---|
| 197 |
<a href="<?php echo $_SERVER['PHP_SELF'].'?display='.urlencode($display); ?>&tech=IAX2"><?php echo _("Add IAX2 Trunk")?></a><br><br> |
|---|
| 198 |
<a href="<?php echo $_SERVER['PHP_SELF'].'?display='.urlencode($display); ?>&tech=SIP"><?php echo _("Add SIP Trunk")?></a><br><br> |
|---|
| 199 |
<a href="<?php echo $_SERVER['PHP_SELF'].'?display='.urlencode($display); ?>&tech=ENUM"><?php echo _("Add ENUM Trunk")?></a><br><br> |
|---|
| 200 |
<a href="<?php echo $_SERVER['PHP_SELF'].'?display='.urlencode($display); ?>&tech=CUSTOM"><?php echo _("Add Custom Trunk")?></a><br><br> |
|---|
| 201 |
<?php |
|---|
| 202 |
} else { |
|---|
| 203 |
if ($extdisplay) { |
|---|
| 204 |
|
|---|
| 205 |
//if ($trunk_tech == "IAX2") $trunk_tech = "IAX"; // same thing |
|---|
| 206 |
$tech = core_trunks_getTrunkTech($trunknum); |
|---|
| 207 |
|
|---|
| 208 |
$outcid = ${"OUTCID_".$trunknum}; |
|---|
| 209 |
$maxchans = ${"OUTMAXCHANS_".$trunknum}; |
|---|
| 210 |
$dialoutprefix = ${"OUTPREFIX_".$trunknum}; |
|---|
| 211 |
$keepcid = isset(${"OUTKEEPCID_".$trunknum})?${"OUTKEEPCID_".$trunknum}:''; |
|---|
| 212 |
|
|---|
| 213 |
if ($tech!="enum") { |
|---|
| 214 |
|
|---|
| 215 |
if (!isset($channelid)) { |
|---|
| 216 |
$channelid = core_trunks_getTrunkTrunkName($trunknum); |
|---|
| 217 |
} |
|---|
| 218 |
|
|---|
| 219 |
if ($tech!="custom") { |
|---|
| 220 |
// load from db |
|---|
| 221 |
if (!isset($peerdetails)) { |
|---|
| 222 |
$peerdetails = core_trunks_getTrunkPeerDetails($trunknum); |
|---|
| 223 |
} |
|---|
| 224 |
|
|---|
| 225 |
if (!isset($usercontext)) { |
|---|
| 226 |
$usercontext = core_trunks_getTrunkUserContext($trunknum); |
|---|
| 227 |
} |
|---|
| 228 |
|
|---|
| 229 |
if (!isset($userconfig)) { |
|---|
| 230 |
$userconfig = core_trunks_getTrunkUserConfig($trunknum); |
|---|
| 231 |
} |
|---|
| 232 |
|
|---|
| 233 |
if (!isset($register)) { |
|---|
| 234 |
$register = core_trunks_getTrunkRegister($trunknum); |
|---|
| 235 |
} |
|---|
| 236 |
} |
|---|
| 237 |
} |
|---|
| 238 |
|
|---|
| 239 |
|
|---|
| 240 |
if (!isset($_REQUEST["dialrules"])) { // we check REQUEST because dialrules() is always an array |
|---|
| 241 |
$dialrules = getTrunkDialRules($trunknum); |
|---|
| 242 |
} |
|---|
| 243 |
*/ |
|---|
| 244 |
if (!isset($dialrules)) { $dialrules = null; } |
|---|
| 245 |
if (!isset($dialrules)) { $dialrules = null; } |
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 |
if (count($dialrules) == 0) { |
|---|
| 249 |
if ($temp = core_trunks_getDialRules($trunknum)) { |
|---|
| 250 |
foreach ($temp as $key=>$val) { |
|---|
| 251 |
|
|---|
| 252 |
if (preg_match("/^rule\d+$/",$key)) { |
|---|
| 253 |
$dialrules[] = $val; |
|---|
| 254 |
} |
|---|
| 255 |
} |
|---|
| 256 |
} |
|---|
| 257 |
unset($temp); |
|---|
| 258 |
} |
|---|
| 259 |
|
|---|
| 260 |
echo "<h2>".sprintf(_("Edit %s Trunk"),strtoupper($tech))."</h2>"; |
|---|
| 261 |
?> |
|---|
| 262 |
<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> |
|---|
| 263 |
<?php |
|---|
| 264 |
|
|---|
| 265 |
|
|---|
| 266 |
$routes = core_trunks_gettrunkroutes($trunknum); |
|---|
| 267 |
$num_routes = count($routes); |
|---|
| 268 |
if ($num_routes > 0) { |
|---|
| 269 |
echo "<a href=# class=\"info\">"._("In use by")." ".$num_routes." ".($num_routes == 1 ? _("route") : _("routes"))."<span>"; |
|---|
| 270 |
foreach($routes as $route=>$priority) { |
|---|
| 271 |
echo _("Route")." <b>".$route."</b>: "._("Sequence")." <b>".$priority."</b><br>"; |
|---|
| 272 |
} |
|---|
| 273 |
echo "</span></a>"; |
|---|
| 274 |
} else { |
|---|
| 275 |
echo "<b>"._("WARNING:")."</b> <a href=# class=\"info\">"._("This trunk is not used by any routes!")."<span>"; |
|---|
| 276 |
echo _("This trunk will not be able to be used for outbound calls until a route is setup that uses it. Click on <b>Outbound Routes</b> to setup routing."); |
|---|
| 277 |
echo "</span></a>"; |
|---|
| 278 |
} |
|---|
| 279 |
echo "<br><br>"; |
|---|
| 280 |
|
|---|
| 281 |
} else { |
|---|
| 282 |
|
|---|
| 283 |
$outcid = ""; |
|---|
| 284 |
$maxchans = ""; |
|---|
| 285 |
$dialoutprefix = ""; |
|---|
| 286 |
|
|---|
| 287 |
if ($tech == "zap") { |
|---|
| 288 |
$channelid = "g0"; |
|---|
| 289 |
} else { |
|---|
| 290 |
$channelid = ""; |
|---|
| 291 |
} |
|---|
| 292 |
|
|---|
| 293 |
|
|---|
| 294 |
$peerdetails = "host=***provider ip address***\nusername=***userid***\nsecret=***password***\ntype=peer"; |
|---|
| 295 |
$usercontext = ""; |
|---|
| 296 |
$userconfig = "secret=***password***\ntype=user\ncontext=from-trunk"; |
|---|
| 297 |
$register = ""; |
|---|
| 298 |
|
|---|
| 299 |
$localpattern = "NXXXXXX"; |
|---|
| 300 |
$lddialprefix = "1"; |
|---|
| 301 |
$areacode = ""; |
|---|
| 302 |
|
|---|
| 303 |
echo "<h2>".sprintf("Add %s Trunk",strtoupper($tech))."</h2>"; |
|---|
| 304 |
} |
|---|
| 305 |
?> |
|---|
| 306 |
|
|---|
| 307 |
<form name="trunkEdit" action="config.php" method="post" onsubmit="return trunkEdit_onsubmit('<?php echo ($extdisplay ? "edittrunk" : "addtrunk") ?>');"> |
|---|
| 308 |
<input type="hidden" name="display" value="<?php echo $display?>"/> |
|---|
| 309 |
<input type="hidden" name="extdisplay" value="<?php echo $extdisplay ?>"/> |
|---|
| 310 |
<input type="hidden" name="action" value=""/> |
|---|
| 311 |
<input type="hidden" name="tech" value="<?php echo $tech?>"/> |
|---|
| 312 |
<table> |
|---|
| 313 |
<tr> |
|---|
| 314 |
<td colspan="2"> |
|---|
| 315 |
<h4><?php echo _("General Settings")?></h4> |
|---|
| 316 |
</td> |
|---|
| 317 |
</tr> |
|---|
| 318 |
<tr> |
|---|
| 319 |
<td> |
|---|
| 320 |
<a href=# class="info"><?php echo _("Outbound Caller ID")?><span><br><?php echo _("Caller ID for calls placed out on this trunk<br><br>Format: <b>\"caller name\" <#######></b>. You can also use the magic string 'hidden' to hide the CallerID sent out over Digital lines ONLY (E1/T1/J1/BRI/SIP/IAX)")?><br><br></span></a>: |
|---|
| 321 |
</td><td> |
|---|
| 322 |
<input type="text" size="20" name="outcid" value="<?php echo $outcid;?>"/> |
|---|
| 323 |
</td> |
|---|
| 324 |
</tr> |
|---|
| 325 |
<tr> |
|---|
| 326 |
<td> |
|---|
| 327 |
<a href="#" class="info"><?php echo _("Never Override CallerID")?><span><br><?php echo _("Some VoIP providers will drop the call if you try to send an invalid CallerID (one you don't 'own.' Use this to never send a CallerID that you haven't explicitly specified in this trunk or in the outbound callerid field of an extension/user. You might notice this problem if you discover that Follow-Me or RingGroups with external numbers don't work properly. Checking this box has the effect of disabling 'foreign' callerids from going out this trunk")."<br />"._("It's safe to leave this switched");?><br /><br /></span></a>: |
|---|
| 328 |
</td><td> |
|---|
| 329 |
<input type="checkbox" name="keepcid" <?php if ($keepcid=="on") {echo "checked";}?>/> |
|---|
| 330 |
</td> |
|---|
| 331 |
<tr> |
|---|
| 332 |
<td> |
|---|
| 333 |
<a href=# class="info"><?php echo _("Maximum channels")?><span><?php echo _("Controls the maximum number of channels (simultaneous calls) that can be used on this trunk, including both incoming and outgoing calls. Leave blank to specify no maximum.")?></span></a>: |
|---|
| 334 |
</td><td> |
|---|
| 335 |
<input type="text" size="3" name="maxchans" value="<?php echo htmlspecialchars($maxchans); ?>"/> |
|---|
| 336 |
</td> |
|---|
| 337 |
</tr> |
|---|
| 338 |
<tr> |
|---|
| 339 |
<td colspan="2"> |
|---|
| 340 |
<br><h4><?php echo _("Outgoing Dial Rules")?></h4> |
|---|
| 341 |
</td> |
|---|
| 342 |
</tr> |
|---|
| 343 |
<tr> |
|---|
| 344 |
<td valign="top"> |
|---|
| 345 |
<a href=# class="info"><?php echo _("Dial Rules")?><span><?php echo _("A Dial Rule controls how calls will be dialed on this trunk. It can be used to add or remove prefixes. Numbers that don't match any patterns defined here will be dialed as-is. Note that a pattern without a + or | (to add or remove a prefix) will not make any changes but will create a match. Only the first matched rule will be executed and the remaining rules will not be acted on.")?><br /><br /><b><?php echo _("Rules:")?></b><br /> |
|---|
| 346 |
<strong>X</strong> <?php echo _("matches any digit from 0-9")?><br /> |
|---|
| 347 |
<strong>Z</strong> <?php echo _("matches any digit from 1-9")?><br /> |
|---|
| 348 |
<strong>N</strong> <?php echo _("matches any digit from 2-9")?><br /> |
|---|
| 349 |
<strong>[1237-9]</strong> <?php echo _("matches any digit or letter in the brackets (in this example, 1,2,3,7,8,9)")?><br /> |
|---|
| 350 |
<strong>.</strong> <?php echo _("wildcard, matches one or more characters (not allowed before a | or +)")?><br /> |
|---|
| 351 |
<strong>|</strong> <?php echo _("removes a dialing prefix from the number (for example, 613|NXXXXXX would match when some dialed \"6135551234\" but would only pass \"5551234\" to the trunk)")?> |
|---|
| 352 |
<strong>+</strong> <?php echo _("adds a dialing prefix from the number (for example, 1613+NXXXXXX would match when some dialed \"5551234\" and would pass \"16135551234\" to the trunk)")?><br /><br /> |
|---|
| 353 |
<?php echo _("You can also use both + and |, for example: 011+0|1ZXXXXXXXXX would match \"012555555555\" and dial it as \"0112555555555\" Note that the order does not matter, eg. 0|011+1ZXXXXXXXXX does the same thing."); ?> |
|---|
| 354 |
</span></a>: |
|---|
| 355 |
</td><td valign="top"> |
|---|
| 356 |
<textarea id="dialrules" cols="20" rows="<?php |
|---|
| 357 |
if (is_array($dialrules)) { |
|---|
| 358 |
$rows = count($dialrules)+1; |
|---|
| 359 |
echo (($rows < 5) ? 5 : (($rows > 20) ? 20 : $rows) ); |
|---|
| 360 |
} else { |
|---|
| 361 |
echo "5"; |
|---|
| 362 |
} ?>" name="dialrules"><?php if(is_array($dialrules)) { echo implode("\n",$dialrules); } ?></textarea><br> |
|---|
| 363 |
|
|---|
| 364 |
<input type="submit" style="font-size:10px;" value="<?php echo _("Clean & Remove duplicates")?>" /> |
|---|
| 365 |
</td> |
|---|
| 366 |
</tr> |
|---|
| 367 |
<tr> |
|---|
| 368 |
<td> |
|---|
| 369 |
<a href=# class="info"><?php echo _("Dial rules wizards")?><span> |
|---|
| 370 |
<strong><?php echo _("Always add prefix to local numbers")?></strong> <?php echo _("is useful for VoIP trunks, where if a number is dialed as \"5551234\", it can be converted to \"16135551234\".")?><br> |
|---|
| 371 |
<strong><?php echo _("Remove prefix from local numbers")?></strong> <?php echo _("is useful for ZAP trunks, where if a local number is dialed as \"6135551234\", it can be converted to \"555-1234\".")?><br> |
|---|
| 372 |
<strong><?php echo _("Setup dialing for local trunk")?></strong> <?php echo _("This looks up your local number on www.localcallingguide.com (NA-only), and sets up so you can dial either 7 or 10 digits (regardless of what your PSTN is) on a local trunk (where you have to dial 1+areacode for long distance, but only 5551234 (7-digit dialing) or 6135551234 (10-digit dialing) for local calls")?><br> |
|---|
| 373 |
</span></a>: |
|---|
| 374 |
</td><td valign="top"> <select id="autopop" name="autopop" onChange="changeAutoPop(); "> |
|---|
| 375 |
<option value="" SELECTED><?php echo _("(pick one)")?></option> |
|---|
| 376 |
<option value="always"><?php echo _("Always add prefix to local numbers")?></option> |
|---|
| 377 |
<option value="remove"><?php echo _("Remove prefix from local numbers")?></option> |
|---|
| 378 |
<option value="lookup7"><?php echo _("Setup dialing for local trunk (7-digit dialing)")?></option> |
|---|
| 379 |
<option value="lookup10"><?php echo _("Setup dialing for local trunk (10-digit dialing)")?></option> |
|---|
| 380 |
</select> |
|---|
| 381 |
</td> |
|---|
| 382 |
</tr> |
|---|
| 383 |
<input id="npanxx" name="npanxx" type="hidden" /> |
|---|
| 384 |
<script language="javascript"> |
|---|
| 385 |
|
|---|
| 386 |
function populateLookup(digits) { |
|---|
| 387 |
<?php |
|---|
| 388 |
if (function_exists("curl_init")) { |
|---|
| 389 |
?> |
|---|
| 390 |
//var npanxx = prompt("What is your areacode + prefix (NPA-NXX)?", document.getElementById('areacode').value); |
|---|
| 391 |
do { |
|---|
| 392 |
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.".'")')?>; |
|---|
| 393 |
if (npanxx == null) return; |
|---|
| 394 |
} 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\'").'")'?>); |
|---|
| 395 |
|
|---|
| 396 |
document.getElementById('npanxx').value = npanxx; |
|---|
| 397 |
if (digits == 10) { |
|---|
| 398 |
document.trunkEdit.action.value = "populatenpanxx10"; |
|---|
| 399 |
} else { |
|---|
| 400 |
document.trunkEdit.action.value = "populatenpanxx7"; |
|---|
| 401 |
} |
|---|
| 402 |
document.trunkEdit.submit(); |
|---|
| 403 |
<?php |
|---|
| 404 |
} else { |
|---|
| 405 |
?> |
|---|
| 406 |
<?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.").'")'?>; |
|---|
| 407 |
<?php |
|---|
| 408 |
} |
|---|
| 409 |
?> |
|---|
| 410 |
} |
|---|
| 411 |
|
|---|
| 412 |
function populateAlwaysAdd() { |
|---|
| 413 |
do { |
|---|
| 414 |
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"); |
|---|
| 415 |
if (localpattern == null) return; |
|---|
| 416 |
} while (!localpattern.match('^[0-9#*ZXN\.]+$') && <?php echo '!alert("'._("Invalid pattern. Only 0-9, #, *, Z, N, X and . are allowed.").'")'?>); |
|---|
| 417 |
|
|---|
| 418 |
do { |
|---|
| 419 |
var localprefix = <?php echo 'prompt("'._("What prefix should be added to the dialing pattern?\\n\\n(ie. for US/CAN, 1+areacode, ie, \'1613\')?").'")'?>; |
|---|
| 420 |
if (localprefix == null) return; |
|---|
| 421 |
} while (!localprefix.match('^[0-9#*]+$') && <?php echo '!alert("'._("Invalid prefix. Only dialable characters (0-9, #, and *) are allowed.").'")'?>); |
|---|
| 422 |
|
|---|
| 423 |
dialrules = document.getElementById('dialrules'); |
|---|
| 424 |
if (dialrules.value[dialrules.value.length-1] != '\n') { |
|---|
| 425 |
dialrules.value = dialrules.value + '\n'; |
|---|
| 426 |
} |
|---|
| 427 |
dialrules.value = dialrules.value + localprefix + '+' + localpattern + '\n'; |
|---|
| 428 |
} |
|---|
| 429 |
|
|---|
| 430 |
function populateRemove() { |
|---|
| 431 |
do { |
|---|
| 432 |
var localprefix = <?php echo 'prompt("'._("What prefix should be removed from the number?\\n\\n(ie. for US/CAN, 1+areacode, ie, \'1613\')").'")'?>; |
|---|
| 433 |
if (localprefix == null) return; |
|---|
| 434 |
} while (!localprefix.match('^[0-9#*ZXN\.]+$') && <?php echo '!alert("'._('Invalid prefix. Only 0-9, #, *, Z, N, and X are allowed.').'")'?>); |
|---|
| 435 |
|
|---|
| 436 |
do { |
|---|
| 437 |
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"); |
|---|
| 438 |
if (localpattern == null) return; |
|---|
| 439 |
} while (!localpattern.match('^[0-9#*ZXN\.]+$') && <?php echo '!alert("'._("Invalid pattern. Only 0-9, #, *, Z, N, X and . are allowed.").'")'?>); |
|---|
| 440 |
|
|---|
| 441 |
dialrules = document.getElementById('dialrules'); |
|---|
| 442 |
if (dialrules.value[dialrules.value.length-1] != '\n') { |
|---|
| 443 |
dialrules.value = dialrules.value + '\n'; |
|---|
| 444 |
} |
|---|
| 445 |
dialrules.value = dialrules.value + localprefix + '|' + localpattern + '\n'; |
|---|
| 446 |
} |
|---|
| 447 |
|
|---|
| 448 |
function changeAutoPop() { |
|---|
| 449 |
switch(document.getElementById('autopop').value) { |
|---|
| 450 |
case "always": |
|---|
| 451 |
populateAlwaysAdd(); |
|---|
| 452 |
break; |
|---|
| 453 |
case "remove": |
|---|
| 454 |
populateRemove(); |
|---|
| 455 |
break; |
|---|
| 456 |
case "lookup7": |
|---|
| 457 |
populateLookup(7); |
|---|
| 458 |
break; |
|---|
| 459 |
case "lookup10": |
|---|
| 460 |
populateLookup(10); |
|---|
| 461 |
break; |
|---|
| 462 |
} |
|---|
| 463 |
document.getElementById('autopop').value = ''; |
|---|
| 464 |
} |
|---|
| 465 |
</script> |
|---|
| 466 |
<?php |
|---|
| 467 |
<tr> |
|---|
| 468 |
<td> |
|---|
| 469 |
<a href=# class="info">Dial rules<span>The area code this trunk is in.</span></a>: |
|---|
| 470 |
</td><td> |
|---|
| 471 |
<select id="dialrulestype" name="dialrulestype" onChange="changeRulesType();"> |
|---|
| 472 |
<?php |
|---|
| 473 |
$rules = array( "asis" => "Don't change number", |
|---|
| 474 |
"always" => "Always dial prefix+areacode", |
|---|
| 475 |
"local" => "Local 7-digit dialing", |
|---|
| 476 |
"local10" => "Local 10-digit dialing"); |
|---|
| 477 |
|
|---|
| 478 |
foreach ($rules as $value=>$display) { |
|---|
| 479 |
echo "<option value=\"".$value."\" ".(($value == $dialrulestype) ? "SELECTED" : "").">".$display."</option>"; |
|---|
| 480 |
} |
|---|
| 481 |
?> |
|---|
| 482 |
</select> |
|---|
| 483 |
|
|---|
| 484 |
</td> |
|---|
| 485 |
</tr> |
|---|
| 486 |
<tr> |
|---|
| 487 |
<td> |
|---|
| 488 |
<a href=# class="info"><?php echo _("Local dialing pattern<span>The dialing pattern to make a 'local' call.</span>")</a>: |
|---|
| 489 |
</td><td> |
|---|
| 490 |
<input id="localpattern" type="text" size="10" maxlength="20" name="localpattern" value="<?php echo $localpattern ?>"/> |
|---|
| 491 |
|
|---|
| 492 |
</td> |
|---|
| 493 |
</tr> |
|---|
| 494 |
<tr> |
|---|
| 495 |
<td> |
|---|
| 496 |
<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>: |
|---|
| 497 |
</td><td> |
|---|
| 498 |
<input id="lddialprefix" type="text" size="3" maxlength="6" name="lddialprefix" value="<?php echo $lddialprefix ?>"/> |
|---|
| 499 |
|
|---|
| 500 |
</td> |
|---|
| 501 |
</tr> |
|---|
| 502 |
<tr> |
|---|
| 503 |
<td> |
|---|
| 504 |
<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>: |
|---|
| 505 |
</td><td> |
|---|
| 506 |
<input id="areacode" type="text" size="3" maxlength="6" name="areacode" value="<?php echo $areacode ?>"/> |
|---|
| 507 |
|
|---|
| 508 |
</td> |
|---|
| 509 |
</tr> |
|---|
| 510 |
<tr> |
|---|
| 511 |
<td valign="top"> |
|---|
| 512 |
<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>: |
|---|
| 513 |
</td><td valign="top"> |
|---|
| 514 |
<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> |
|---|
| 515 |
|
|---|
| 516 |
<input id="npanxx" name="npanxx" type="hidden" /><br> |
|---|
| 517 |
<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();" /> |
|---|
| 518 |
<br><br> |
|---|
| 519 |
</td> |
|---|
| 520 |
</tr> |
|---|
| 521 |
<script language="javascript"> |
|---|
| 522 |
|
|---|
| 523 |
function checkPopulate() { |
|---|
| 524 |
//var npanxx = prompt("What is your areacode + prefix (NPA-NXX)?", document.getElementById('areacode').value); |
|---|
| 525 |
var npanxx = <?php echo 'prompt("'._("What is your areacode + prefix (NPA-NXX)?").'")'?>; |
|---|
| 526 |
|
|---|
| 527 |
if (npanxx.match("^[2-9][0-9][0-9][-]?[2-9][0-9][0-9]$")) { |
|---|
| 528 |
document.getElementById('npanxx').value = npanxx; |
|---|
| 529 |
trunkEdit.action.value = "populatenpanxx"; |
|---|
| 530 |
trunkEdit.submit(); |
|---|
| 531 |
} else if (npanxx != null) { |
|---|
| 532 |
<?php echo 'alert("'._("Invalid format for NPA-NXX code (must be format: NXXNXX)").'")'?>; |
|---|
| 533 |
} |
|---|
| 534 |
} |
|---|
| 535 |
|
|---|
| 536 |
function changeRulesType() { |
|---|
| 537 |
switch(document.getElementById('dialrulestype').value) { |
|---|
| 538 |
case "always": |
|---|
| 539 |
document.getElementById('lddialprefix').disabled = false; |
|---|
| 540 |
document.getElementById('areacode').disabled = false; |
|---|
| 541 |
document.getElementById('localprefixes').disabled = true; |
|---|
| 542 |
break; |
|---|
| 543 |
case "local": |
|---|
| 544 |
case "local10": |
|---|
| 545 |
document.getElementById('lddialprefix').disabled = false; |
|---|
| 546 |
document.getElementById('areacode').disabled = false; |
|---|
| 547 |
document.getElementById('localprefixes').disabled = false; |
|---|
| 548 |
break; |
|---|
| 549 |
case "asis": |
|---|
| 550 |
default: |
|---|
| 551 |
document.getElementById('lddialprefix').disabled = true; |
|---|
| 552 |
document.getElementById('areacode').disabled = true; |
|---|
| 553 |
document.getElementById('localprefixes').disabled = true; |
|---|
| 554 |
break; |
|---|
| 555 |
} |
|---|
| 556 |
} |
|---|
| 557 |
changeRulesType(); |
|---|
| 558 |
</script> |
|---|
| 559 |
*/?> |
|---|
| 560 |
<tr> |
|---|
| 561 |
<td> |
|---|
| 562 |
<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>: |
|---|
| 563 |
</td><td> |
|---|
| 564 |
<input type="text" size="8" name="dialoutprefix" value="<?php echo htmlspecialchars($dialoutprefix) ?>"/> |
|---|
| 565 |
</td> |
|---|
| 566 |
</tr> |
|---|
| 567 |
<?php if ($tech != "enum") { ?> |
|---|
| 568 |
<tr> |
|---|
| 569 |
<td colspan="2"> |
|---|
| 570 |
<br><h4><?php echo _("Outgoing Settings")?></h4> |
|---|
| 571 |
</td> |
|---|
| 572 |
</tr> |
|---|
| 573 |
<?php } ?> |
|---|
| 574 |
|
|---|
| 575 |
<?php |
|---|
| 576 |
switch ($tech) { |
|---|
| 577 |
case "zap": |
|---|
| 578 |
?> |
|---|
| 579 |
<tr> |
|---|
| 580 |
<td> |
|---|
| 581 |
<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>: |
|---|
| 582 |
</td><td> |
|---|
| 583 |
<input type="text" size="8" name="channelid" value="<?php echo htmlspecialchars($channelid) ?>"/> |
|---|
| 584 |
<input type="hidden" size="14" name="usercontext" value="notneeded"/> |
|---|
| 585 |
</td> |
|---|
| 586 |
</tr> |
|---|
| 587 |
<?php |
|---|
| 588 |
break; |
|---|
| 589 |
case "enum": |
|---|
| 590 |
break; |
|---|
| 591 |
case "custom": |
|---|
| 592 |
?> |
|---|
| 593 |
<tr> |
|---|
| 594 |
<td> |
|---|
| 595 |
<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>: |
|---|
| 596 |
</td><td> |
|---|
| 597 |
<input type="text" size="35" maxlength="46" name="channelid" value="<?php echo htmlspecialchars($channelid) ?>"/> |
|---|
| 598 |
<input type="hidden" size="14" name="usercontext" value="notneeded"/> |
|---|
| 599 |
</td> |
|---|
| 600 |
</tr> |
|---|
| 601 |
<?php |
|---|
| 602 |
break; |
|---|
| 603 |
default: |
|---|
| 604 |
?> |
|---|
| 605 |
<tr> |
|---|
| 606 |
<td> |
|---|
| 607 |
<a href=# class="info"><?php echo _("Trunk Name")?><span><br><?php echo _("Give this trunk a unique name. Example: myiaxtel")?><br><br></span></a>: |
|---|
| 608 |
</td><td> |
|---|
| 609 |
<input type="text" size="14" name="channelid" value="<?php echo htmlspecialchars($channelid) ?>"/> |
|---|
| 610 |
</td> |
|---|
| 611 |
</tr> |
|---|
| 612 |
<tr> |
|---|
| 613 |
<td colspan="2"> |
|---|
| 614 |
<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>: |
|---|
| 615 |
</td> |
|---|
| 616 |
</tr> |
|---|
| 617 |
<tr> |
|---|
| 618 |
<td colspan="2"> |
|---|
| 619 |
<textarea rows="10" cols="40" name="peerdetails"><?php echo htmlspecialchars($peerdetails) ?></textarea> |
|---|
| 620 |
</td> |
|---|
| 621 |
</tr> |
|---|
| 622 |
<tr> |
|---|
| 623 |
<td colspan="2"> |
|---|
| 624 |
<br><h4><?php echo _("Incoming Settings")?></h4> |
|---|
| 625 |
</td> |
|---|
| 626 |
</tr> |
|---|
| 627 |
<tr> |
|---|
| 628 |
<td> |
|---|
| 629 |
<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>: |
|---|
| 630 |
</td><td> |
|---|
| 631 |
<input type="text" size="14" name="usercontext" value="<?php echo htmlspecialchars($usercontext) ?>"/> |
|---|
| 632 |
</td> |
|---|
| 633 |
</tr> |
|---|
| 634 |
<tr> |
|---|
| 635 |
<td colspan="2"> |
|---|
| 636 |
<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>: |
|---|
| 637 |
</td> |
|---|
| 638 |
</tr> |
|---|
| 639 |
<tr> |
|---|
| 640 |
<td colspan="2"> |
|---|
| 641 |
<textarea rows="10" cols="40" name="userconfig"><?php echo htmlspecialchars($userconfig); ?></textarea> |
|---|
| 642 |
</td> |
|---|
| 643 |
</tr> |
|---|
| 644 |
<tr> |
|---|
| 645 |
<td colspan="2"> |
|---|
| 646 |
<br><h4><?php echo _("Registration")?></h4> |
|---|
| 647 |
</td> |
|---|
| 648 |
</tr> |
|---|
| 649 |
<tr> |
|---|
| 650 |
<td colspan="2"> |
|---|
| 651 |
<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>Many providers will require you to provide a DID number, ex: username:password@switch.voipprovider.com/didnumber in order for any DID matching to work.")?><br><br></span></a>: |
|---|
| 652 |
</td> |
|---|
| 653 |
</tr> |
|---|
| 654 |
<tr> |
|---|
| 655 |
<td colspan="2"> |
|---|
| 656 |
<input type="text" size="40" name="register" value="<?php echo htmlspecialchars($register) ?>"/> |
|---|
| 657 |
</td> |
|---|
| 658 |
</tr> |
|---|
| 659 |
<?php |
|---|
| 660 |
break; |
|---|
| 661 |
} |
|---|
| 662 |
?> |
|---|
| 663 |
|
|---|
| 664 |
<tr> |
|---|
| 665 |
<td colspan="2"> |
|---|
| 666 |
<h6><input name="Submit" type="submit" value="<?php echo _("Submit Changes")?>"></h6> |
|---|
| 667 |
</td> |
|---|
| 668 |
</tr> |
|---|
| 669 |
</table> |
|---|
| 670 |
|
|---|
| 671 |
<script language="javascript"> |
|---|
| 672 |
<!-- |
|---|
| 673 |
|
|---|
| 674 |
var theForm = document.trunkEdit; |
|---|
| 675 |
|
|---|
| 676 |
theForm.outcid.focus(); |
|---|
| 677 |
|
|---|
| 678 |
function trunkEdit_onsubmit(act) { |
|---|
| 679 |
var msgInvalidOutboundCID = "<?php echo _('Invalid Outbound Caller ID'); ?>"; |
|---|
| 680 |
var msgInvalidMaxChans = "<?php echo _('Invalid Maximum Channels'); ?>"; |
|---|
| 681 |
var msgInvalidDialRules = "<?php echo _('Invalid Dial Rules'); ?>"; |
|---|
| 682 |
var msgInvalidOutboundDialPrefix = "<?php echo _('Invalid Outbound Dial Prefix'); ?>"; |
|---|
| 683 |
var msgInvalidTrunkName = "<?php echo _('Invalid Trunk Name entered'); ?>"; |
|---|
| 684 |
var msgInvalidChannelName = "<?php echo _('Invalid Custom Dial String entered'); ?>"; |
|---|
| 685 |
var msgInvalidTrunkAndUserSame = "<?php echo _('Trunk Name and User Context cannot be set to the same value'); ?>"; |
|---|
| 686 |
|
|---|
| 687 |
defaultEmptyOK = true; |
|---|
| 688 |
if (!isCallerID(theForm.outcid.value)) |
|---|
| 689 |
return warnInvalid(theForm.outcid, msgInvalidOutboundCID); |
|---|
| 690 |
|
|---|
| 691 |
if (!isInteger(theForm.maxchans.value)) |
|---|
| 692 |
return warnInvalid(theForm.maxchans, msgInvalidMaxChans); |
|---|
| 693 |
|
|---|
| 694 |
if (!isDialrule(theForm.dialrules.value)) |
|---|
| 695 |
return warnInvalid(theForm.dialrules, msgInvalidDialRules); |
|---|
| 696 |
|
|---|
| 697 |
if (!isDialIdentifierSpecial(theForm.dialoutprefix.value)) |
|---|
| 698 |
return warnInvalid(theForm.dialoutprefix, msgInvalidOutboundDialPrefix); |
|---|
| 699 |
|
|---|
| 700 |
<?php if ($tech != "enum" && $tech != "custom") { ?> |
|---|
| 701 |
defaultEmptyOK = true; |
|---|
| 702 |
if (isEmpty(theForm.channelid.value) || isWhitespace(theForm.channelid.value)) |
|---|
| 703 |
return warnInvalid(theForm.channelid, msgInvalidTrunkName); |
|---|
| 704 |
|
|---|
| 705 |
if (theForm.channelid.value == theForm.usercontext.value) |
|---|
| 706 |
return warnInvalid(theForm.usercontext, msgInvalidTrunkAndUserSame); |
|---|
| 707 |
<?php } else if ($tech == "custom") { ?> |
|---|
| 708 |
if (isEmpty(theForm.channelid.value) || isWhitespace(theForm.channelid.value)) |
|---|
| 709 |
return warnInvalid(theForm.channelid, msgInvalidChannelName); |
|---|
| 710 |
|
|---|
| 711 |
if (theForm.channelid.value == theForm.usercontext.value) |
|---|
| 712 |
return warnInvalid(theForm.usercontext, msgInvalidTrunkAndUserSame); |
|---|
| 713 |
<?php } ?> |
|---|
| 714 |
|
|---|
| 715 |
theForm.action.value = act; |
|---|
| 716 |
return true; |
|---|
| 717 |
} |
|---|
| 718 |
|
|---|
| 719 |
function isDialIdentifierSpecial(s) { // special chars allowed in dial prefix (e.g. fwdOUT) |
|---|
| 720 |
var i; |
|---|
| 721 |
|
|---|
| 722 |
if (isEmpty(s)) |
|---|
| 723 |
if (isDialIdentifierSpecial.arguments.length == 1) return defaultEmptyOK; |
|---|
| 724 |
else return (isDialIdentifierSpecial.arguments[1] == true); |
|---|
| 725 |
|
|---|
| 726 |
for (i = 0; i < s.length; i++) |
|---|
| 727 |
{ |
|---|
| 728 |
var c = s.charAt(i); |
|---|
| 729 |
|
|---|
| 730 |
if ( !isDialDigitChar(c) && (c != "w") && (c != "W") && (c != "q") && (c != "Q") && (c != "+") ) return false; |
|---|
| 731 |
} |
|---|
| 732 |
|
|---|
| 733 |
return true; |
|---|
| 734 |
} |
|---|
| 735 |
//--> |
|---|
| 736 |
</script> |
|---|
| 737 |
|
|---|
| 738 |
</form> |
|---|
| 739 |
<?php |
|---|
| 740 |
} |
|---|
| 741 |
?> |
|---|
| 742 |
|
|---|
| 743 |
|
|---|
| 744 |
|
|---|