Changeset 9265
- Timestamp:
- 03/18/10 01:07:40 (2 years ago)
- Files:
-
- modules/branches/2.8/sipstation/module.xml (modified) (2 diffs)
- modules/branches/2.8/sipstation/routes.html.php (modified) (2 diffs)
- modules/branches/2.8/sipstation/sipstation.html.php (modified) (1 diff)
- modules/branches/2.8/sipstation/sipstation.utility.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.8/sipstation/module.xml
r9253 r9265 2 2 <rawname>sipstation</rawname> 3 3 <name>SIPSTATION</name> 4 <version>2.8.0. 1</version>4 <version>2.8.0.2</version> 5 5 <type>setup</type> 6 6 <category>Basic</category> … … 14 14 <license>COMMERCIAL</license> 15 15 <changelog> 16 *2.8.0.2* switch to new trunk dialrule apis 16 17 *2.8.0.1* report proper TEMPNOTAVAIL status when server replies with that, minor changes to install script 17 18 *2.8.0.0* update to use new Outbound Route APIs modules/branches/2.8/sipstation/routes.html.php
r9124 r9265 51 51 if (isset($_POST['areacode']) && trim($_POST['areacode']) != "") { 52 52 53 /* We are adding a prefix, make sure it is 3 digits, then rip out any existing54 7 digit dialing prefix in the current pattern before inserting this at the55 top. Validation is kind of 'ghetto', we cleans it,53 /* We are adding a prefix, make sure it is 3 digits, then grab what's there 54 rip it out if it is in there, push it on top and if the two differ, update 55 if replacing, the old one will be further down and be dumped as a duplicate 56 56 */ 57 57 $areacode = preg_replace("/[^0-9]/" ,"",trim($_POST['areacode'])); 58 58 if (strlen($areacode) == 3) { 59 $areacode = "1$areacode+NXXXXXX";60 59 foreach (array($trunknum1,$trunknum2) as $trunk) { 61 $dialrules = array(); 62 if ($temp = core_trunks_getDialRules($trunk)) { 63 foreach ($temp as $key=>$val) { 64 $temp2[] = $val; // for later comparison 65 // extract all ruleXX keys 66 if (preg_match("/^rule\d+$/",$key)) { 67 if (!preg_match("/^1[\d]{3}\+NXXXXXX$/",$val)) { 68 $dialrules[] = $val; 69 } 70 } 60 $dialrules = core_trunks_get_dialrules($trunk); 61 if (is_array($dialrules) && count($dialrules)) { 62 foreach ($dialrules as $rule) { 63 $match = $rule['match_pattern_pass']; 64 $prefix = $rule['match_pattern_prefix']; 65 $prepend = $rule['prepend_digits']; 66 67 $dialrules_tmp[] = array('match_pattern_prefix' => $prefix, 'match_pattern_pass' => $match, 'prepend_digits' => $prepend); 68 if ($match != 'NXXXXXX' || $prepend != $areacode || $prefix != '') { 69 $dialrules_2[] = array('match_pattern_prefix' => $prefix, 'match_pattern_pass' => $match, 'prepend_digits' => $prepend); 70 } 71 71 } 72 72 } else { 73 $temp = array(); 73 $dialrules_2 = array(); 74 $dialrules_tmp = array(); 74 75 } 75 array_unshift($dialrules,$areacode); 76 if ($temp2 != $dialrules) { 77 core_trunks_addDialRules($trunk, $dialrules); 76 array_unshift($dialrules_2, array('match_pattern_prefix' => '', 'match_pattern_pass' => 'NXXXXXX', 'prepend_digits' => $areacode)); 77 78 if ($dialrules_2 != $dialrules_tmp) { 79 core_trunks_update_dialrules($trunk, $dialrules_2, true); 78 80 $need_reload = true; 79 81 } 80 unset($ temp);81 unset($ temp2);82 unset($dialrules_2); 83 unset($dialrules_tmp); 82 84 unset($dialrules); 83 85 } … … 130 132 $json_array['status_message'] = sprintf(_("Successfully configured %s routes to use your SIP trunks"),$cnt); 131 133 } elseif ($need_reload) { 132 $json_array['status_message'] = _("Your Area Code was updated");134 $json_array['status_message'] = sprintf(_("Your Area Code was updated to %s"),$areacode); 133 135 } else { 134 $json_array['status_message'] = _("No updates were required, no thing was changed in");136 $json_array['status_message'] = _("No updates were required, no routes or areacode were changed"); 135 137 } 136 138 } else { modules/branches/2.8/sipstation/sipstation.html.php
r9124 r9265 141 141 // 142 142 $json_array['areacode'] = ""; 143 if ($temp = core_trunks_getDialRules($trunknum1)) { 144 foreach ($temp as $key=>$val) { 145 // extract all ruleXX keys 146 if (preg_match("/^rule\d+$/",$key)) { 147 if (preg_match("/^1([\d]{3})\+NXXXXXX$/",$val,$matches)) { 148 $json_array['areacode'] = $matches[1]; 149 break; 150 } 143 $dialrules = core_trunks_get_dialrules($trunknum1); 144 if (is_array($dialrules) && count($dialrules)) { 145 foreach ($dialrules as $rule) { 146 if (preg_match('/^1{0,1}(\d{3})$/',$rule['prepend_digits'],$matches)) { 147 $json_array['areacode'] = $matches[1]; 148 break; 151 149 } 152 150 } modules/branches/2.8/sipstation/sipstation.utility.php
r9218 r9265 348 348 $peerdetails .= "username=$sip_user\nsecret=$sip_pass\nhost="; 349 349 $register = "$sip_user:$sip_pass@"; 350 $dialrules = array();351 350 352 351 for ($i=1;$i<3;$i++) { … … 368 367 } else { 369 368 $trunknum = core_trunks_add($tech, $channelid, '', '', $default_did, $peerdetails.$gw, '', '', $register.$gw, $keepcid, '', $disabletrunk); 370 core_trunks_addDialRules($trunknum, $dialrules);371 369 $globalvar = "OUT_".$trunknum; 372 370 $need_reload = true;
