Changeset 9104

Show
Ignore:
Timestamp:
03/09/10 18:14:32 (2 years ago)
Author:
p_lindheimer
Message:

modify core_trunks_gettrunkroutes re #4110 (now and over the next couple days these check-ins may start to break trunk, BEWARE)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.8/core/functions.inc.php

    r9103 r9104  
    47874787//get outbound routes for a given trunk 
    47884788function core_trunks_gettrunkroutes($trunknum) { 
    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(); 
    47934793  foreach ($results as $entry) { 
    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']; 
    48034795  } 
    48044796  return $routes; 
     
    50605052} 
    50615053 
     5054/* callback to Time Groups Module so it can display usage information 
     5055   of specific groups 
     5056 */ 
     5057function 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 
    50625073//----------------------------------------------------------------------------------------------------------------------------------------- 
    50635074