Changeset 9087
- Timestamp:
- 03/07/10 00:02:51 (3 years ago)
- Files:
-
- modules/branches/2.8/core/functions.inc.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.8/core/functions.inc.php
r9081 r9087 1576 1576 1577 1577 if (false) { // new outbound routes 1578 $ext->addInclude('from-internal-additional','outbound-allroutes ');1579 $ext->add('outbound-allroutes ', '_!', '', new ext_macro('user-callerid,SKIPTTL'));1578 $ext->addInclude('from-internal-additional','outbound-allroutes-byid'); 1579 $ext->add('outbound-allroutes-byid', '_!', '', new ext_macro('user-callerid,SKIPTTL')); 1580 1580 $routes = core_routing_list(); 1581 1581 $trunk_table = core_trunks_listbyid(); … … 1586 1586 if (is_array($times) && count($times)) { 1587 1587 foreach ($times as $time) { 1588 $ext->addInclude('outbound-allroutes ',$context.'|'.$time[1]);1588 $ext->addInclude('outbound-allroutes-byid',$context.'|'.$time[1]); 1589 1589 } 1590 1590 } else { 1591 $ext->addInclude('outbound-allroutes ',$context);1591 $ext->addInclude('outbound-allroutes-byid',$context); 1592 1592 } 1593 1593 } else { 1594 $ext->addInclude('outbound-allroutes ',$context);1594 $ext->addInclude('outbound-allroutes-byid',$context); 1595 1595 } 1596 1596 … … 1600 1600 foreach ($patterns as $pattern) { 1601 1601 $exten = $pattern['match_pattern_prefix'].$pattern['match_pattern_pass']; 1602 $cid = $pattern['match_cid']; 1603 1604 //TODO: does the plus need to be backslashed? 1605 if (!preg_match("/^[0-9*+]+$/",$exten)) { 1606 // note # is not here, as asterisk doesn't recoginize it as a normal digit, thus it requires _ pattern matching 1607 // it's not strictly digits, so it must have patterns, so prepend a _ 1608 $exten = "_".$exten; 1609 } 1610 if (!preg_match("/^[0-9*+]+$/",$cid)) { 1611 // note # is not here, as asterisk doesn't recoginize it as a normal digit, thus it requires _ pattern matching 1612 // it's not strictly digits, so it must have patterns, so prepend a _ 1613 $cid = "_".$cid; 1614 } 1615 if ($cid != '') { 1616 $exten .= '/'.$cid; 1617 } 1618 1602 1619 $ext->add($context, $exten, '', new ext_noop('Macro(user-callerid): executed in outbound-allroutes PRI 1')); 1603 1620 if ($route['emergencyy_route'] != '') { … … 4533 4550 4534 4551 function core_trunks_listbyid() { 4535 $result = sql('SELECT * from `trunks` ORDER BY `trunkid`' );4552 $result = sql('SELECT * from `trunks` ORDER BY `trunkid`','getAll',DB_FETCHMODE_ASSOC); 4536 4553 $trunk_list = array(); 4537 4554 foreach ($result as $trunk) { 4555 if ($trunk['name'] == '') { 4556 $tech = strtoupper($trunk['tech']); 4557 switch ($tech) { 4558 case 'IAX': 4559 $trunk['name'] = 'IAX2/'.$trunk['channelid']; 4560 break; 4561 case 'CUSTOM': 4562 $trunk['name'] = 'AMP:'.$trunk['channelid']; 4563 break; 4564 default: 4565 $trunk['name'] = $tech.'/'.$trunk['channelid']; 4566 break; 4567 } 4568 } 4538 4569 $trunk_list[$trunk['trunkid']] = $trunk; 4539 4570 } … … 4792 4823 function core_routing_get($route_id) { 4793 4824 global $db; 4794 $sql = 'SELECT * FROM `outbound_routes` WHERE route_id='.$db->escapeSimple($ cidnum);4825 $sql = 'SELECT * FROM `outbound_routes` WHERE route_id='.$db->escapeSimple($route_id); 4795 4826 $route = sql($sql,"getRow",DB_FETCHMODE_ASSOC); 4796 4827 return $route; … … 4813 4844 die_freepbx($sequence->getDebugInfo()); 4814 4845 } 4815 echo "route_id: $route_id, seq: $seq\n";4816 print_r($sequence);4817 4846 4818 4847 $key = array_search($route_id,$sequence); … … 4897 4926 // function core_routing_rename($oldname, $newname) 4898 4927 function core_routing_renamebyid($route_id, $new_name) { 4899 $db;4928 global $db; 4900 4929 $route_id = $db->escapeSimple($route_id); 4901 4930 $new_name = $db->escapeSimple($new_name); … … 4905 4934 // function core_routing_getroutepatterns($route) 4906 4935 function core_routing_getroutepatternsbyid($route_id) { 4907 $db;4936 global $db; 4908 4937 $route_id = $db->escapeSimple($route_id); 4909 4938 $sql = "SELECT * FROM `outbound_route_patterns` WHERE `route_id` = $route_id ORDER BY `match_pattern_prefix`, `match_pattern_pass`"; … … 4914 4943 // function core_routing_getroutetrunks($route) 4915 4944 function core_routing_getroutetrunksbyid($route_id) { 4916 $db;4945 global $db; 4917 4946 $route_id = $db->escapeSimple($route_id); 4918 4947 $sql = "SELECT `trunk_id` FROM `outbound_route_trunks` WHERE `route_id` = $route_id ORDER BY `seq`"; … … 4978 5007 $db->escapeSimple($pattern['match_pattern_prefix']), 4979 5008 $db->escapeSimple($pattern['match_pattern_pass']), 5009 $db->escapeSimple($pattern['match_cid']), 4980 5010 $db->escapeSimple($pattern['prepend_digits']), 4981 5011 ); … … 4984 5014 $sql('DELETE FROM `outbound_route_patterns` WHERE `route_id`='.$route_id); 4985 5015 } 4986 $compiled = $db->prepare('INSERT INTO `outbound_route_patterns` (`match_pattern_prefix`, `match_pattern_pass`, ` prepend_digits`) VALUES (?,?,?)');5016 $compiled = $db->prepare('INSERT INTO `outbound_route_patterns` (`match_pattern_prefix`, `match_pattern_pass`, `match_cid`, `prepend_digits`) VALUES (?,?,?,?)'); 4987 5017 $result = $db->executeMultiple($compiled,$insert_pattern); 4988 5018 if(DB::IsError($result)) {
