| 4789 | | $sql_code = "SELECT DISTINCT SUBSTRING(context,7) route ,args trunk FROM extensions WHERE context LIKE 'outrt-%' AND |
|---|
| 4790 | | (args LIKE 'dialout-trunk,%' OR args LIKE 'dialout-enum,%' OR args LIKE 'dialout-dundi,%') ORDER BY context,priority"; |
|---|
| 4791 | | $results = sql( $sql_code, "getAll" ,DB_FETCHMODE_ASSOC); |
|---|
| 4792 | | $routeseq = array(); |
|---|
| | 4789 | $sql = 'SELECT a.seq, b.name FROM outbound_route_trunks a JOIN outbound_routes b ON a.route_id = b.route_id WHERE trunk_id = '.$trunknum; |
|---|
| | 4790 | $results = sql( $sql, "getAll" ,DB_FETCHMODE_ASSOC); |
|---|
| | 4791 | |
|---|
| | 4792 | $routes = array(); |
|---|
| 4794 | | $pos1 = strpos($entry['trunk'],',')+1; |
|---|
| 4795 | | $routeseq[$entry['route']][] = substr($entry['trunk'],$pos1,strpos($entry['trunk'],',',$pos1)-$pos1); |
|---|
| 4796 | | } |
|---|
| 4797 | | $routes = array(); |
|---|
| 4798 | | foreach ($routeseq as $key => $value) { |
|---|
| 4799 | | $pos = array_search($trunknum, array_values(array_unique($value))); |
|---|
| 4800 | | if ($pos !== false) { |
|---|
| 4801 | | $routes[$key] = $pos+1; // start at 1, not 0 |
|---|
| 4802 | | } |
|---|
| | 4794 | $routes[$entry['name']] = $entry['seq']; |
|---|
| | 5054 | /* callback to Time Groups Module so it can display usage information |
|---|
| | 5055 | of specific groups |
|---|
| | 5056 | */ |
|---|
| | 5057 | function core_timegroups_usage($group_id) { |
|---|
| | 5058 | |
|---|
| | 5059 | $results = sql("SELECT route_id, name FROM outbound_routes WHERE time_group_id = $group_id","getAll",DB_FETCHMODE_ASSOC); |
|---|
| | 5060 | if (empty($results)) { |
|---|
| | 5061 | return array(); |
|---|
| | 5062 | } else { |
|---|
| | 5063 | foreach ($results as $result) { |
|---|
| | 5064 | $usage_arr[] = array( |
|---|
| | 5065 | "url_query" => "display=routing&extdisplay=".$result['route_id'], |
|---|
| | 5066 | "description" => sprintf(_("Outbound Route: %s"),$result['name']), |
|---|
| | 5067 | ); |
|---|
| | 5068 | } |
|---|
| | 5069 | return $usage_arr; |
|---|
| | 5070 | } |
|---|
| | 5071 | } |
|---|
| | 5072 | |
|---|