Changeset 6508

Show
Ignore:
Timestamp:
08/30/08 03:04:49 (5 years ago)
Author:
p_lindheimer
Message:

closes #3130 create global variables for each trunk that has dialrules, and only call fixlocalprefix for thos trunks that have rules, to avoid overhead if not needed

Files:

Legend:

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

    r6507 r6508  
    11861186      } 
    11871187 
     1188      // Let's create globals for each trunk to determine which one's have fixlocalprefix settings. 
     1189      // this allows us to skip calling the agi script if there are no rules to process saving 
     1190      // on performance 
     1191      // 
     1192      $conf = core_trunks_readDialRulesFile(); 
     1193      if (is_array($conf)) { 
     1194        foreach ($conf as $trunknum => $entries) { 
     1195          $trunkname = substr($trunknum,6); 
     1196          $ext->addGlobal("PREFIX_TRUNK_$trunkname",count($entries)); 
     1197        } 
     1198      } 
     1199 
    11881200      /* outbound routes */ 
    11891201      // modules should use their own table for storage (and module_get_config() to add dialplan) 
     
    13691381      $ext->add($context, $exten, '', new ext_set('DIAL_TRUNK_OPTIONS', '${TRUNK_OPTIONS}')); 
    13701382      $ext->add($context, $exten, '', new ext_macro('outbound-callerid', '${DIAL_TRUNK}')); 
    1371       $ext->add($context, $exten, 'skipoutcid', new ext_agi('fixlocalprefix'));  // this sets DIAL_NUMBER to the proper dial string for this trunk 
     1383      $ext->add($context, $exten, 'skipoutcid', new ext_execif('$["${PREFIX_TRUNK_${DIAL_TRUNK}}" != ""]','AGI','fixlocalprefix'));  // this sets DIAL_NUMBER to the proper dial string for this trunk 
    13721384      $ext->add($context, $exten, '', new ext_set('OUTNUM', '${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER}'));  // OUTNUM is the final dial number 
    13731385      $ext->add($context, $exten, '', new ext_set('custom', '${CUT(OUT_${DIAL_TRUNK},:,1)}'));  // Custom trunks are prefixed with "AMP:" 
     
    14481460      $ext->add($context, $exten, '', new ext_set('DIAL_TRUNK_OPTIONS', '${TRUNK_OPTIONS}')); 
    14491461      $ext->add($context, $exten, '', new ext_macro('outbound-callerid', '${DIAL_TRUNK}')); 
    1450       $ext->add($context, $exten, 'skipoutcid', new ext_agi('fixlocalprefix'));  // this sets DIAL_NUMBER to the proper dial string for this trunk 
     1462      $ext->add($context, $exten, 'skipoutcid', new ext_execif('$["${PREFIX_TRUNK_${DIAL_TRUNK}}" != ""]','AGI','fixlocalprefix'));  // this sets DIAL_NUMBER to the proper dial string for this trunk 
    14511463      $ext->add($context, $exten, '', new ext_set('OUTNUM', '${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER}'));  // OUTNUM is the final dial number 
    14521464 
     
    15551567      $ext->add($context, $exten, 'nomax', new ext_set('DIAL_NUMBER', '${ARG2}')); 
    15561568      $ext->add($context, $exten, '', new ext_set('DIAL_TRUNK', '${ARG1}')); 
    1557       $ext->add($context, $exten, '', new ext_agi('fixlocalprefix'));  // this sets DIAL_NUMBER to the proper dial string for this trunk 
     1569      $ext->add($context, $exten, '', new ext_execif('$["${PREFIX_TRUNK_${DIAL_TRUNK}}" != ""]','AGI','fixlocalprefix'));  // this sets DIAL_NUMBER to the proper dial string for this trunk 
    15581570      //  Replacement for asterisk's ENUMLOOKUP function 
    15591571      $ext->add($context, $exten, '', new ext_agi('enumlookup.agi'));