Changeset 5092

Show
Ignore:
Timestamp:
10/02/07 19:28:32 (6 years ago)
Author:
p_lindheimer
Message:

pull some repetitive calls out of dialout-trunk and move them into the outbound-route calls

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.4/core/etc/extensions.conf

    r5090 r5092  
    650650[macro-dialout-trunk] 
    651651exten => s,1,Set(DIAL_TRUNK=${ARG1}) 
    652 exten => s,n,Set(DIAL_NUMBER=${ARG2}) 
    653 exten => s,n,Set(ROUTE_PASSWD=${ARG3}) 
    654  
    655 exten => s,n,GotoIf($["${ROUTE_PASSWD}" = ""]?noauth) ; arg3 is pattern password 
    656 exten => s,n(auth),Authenticate(${ROUTE_PASSWD}) 
    657 exten => s,n(noauth),GotoIf($["x${OUTDISABLE_${ARG1}}" = "xon"]?disabletrunk,1) 
    658  
    659 ; If NODEST is set, clear it. No point in remembering since dialout-trunk will just end in the 
    660 ; bit bucket. But if answered by an outside line with transfer capability, we want NODEST to be 
    661 ; clear so a subsequent transfer to an internal extension works and goes to voicmail or other 
    662 ; destinations. 
    663 
    664 exten => s,n,Set(_NODEST=) 
     652 
     653exten => s,n,GotoIf($["${ARG3}" = ""]?noauth) ; arg3 is pattern password 
     654exten => s,n(auth),Authenticate(${ARG3}) 
     655exten => s,n(noauth),GotoIf($["x${OUTDISABLE_${DIAL_TRUNK}}" = "xon"]?disabletrunk,1) 
     656 
     657exten => s,n,Set(DIAL_NUMBER=${ARG2}) ; fixlocalprefix depends on this 
    665658 
    666659exten => s,n,Set(DIAL_TRUNK_OPTIONS=${DIAL_OPTIONS}) // will be reset to TRUNK_OPTIONS if not intra-company 
    667660exten => s,n,Set(GROUP()=OUT_${DIAL_TRUNK}) 
    668 exten => s,n,Macro(user-callerid,SKIPTTL
    669 exten => s,n,Macro(record-enable,${CALLERID(number)},OUT
    670 exten => s,n,GotoIf($["${INTRACOMPANYROUTE}" = "YES"]?skipoutcid) ;Set to YES if treated like internal 
     661exten => s,n,GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = "foo"]?nomax
     662exten => s,n,GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull
     663exten => s,n(nomax),GotoIf($["${INTRACOMPANYROUTE}" = "YES"]?skipoutcid) ;Set to YES if treated like internal 
    671664exten => s,n,Set(DIAL_TRUNK_OPTIONS=${TRUNK_OPTIONS}) 
    672665exten => s,n,Macro(outbound-callerid,${DIAL_TRUNK}) 
    673 exten => s,n(skipoutcid),GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = "foo"]?nomax) 
    674 exten => s,n(checkmax),GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull) 
    675 exten => s,n(nomax),AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk 
     666exten => s,n(skipoutcid),AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk 
    676667exten => s,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER}) ; OUTNUM is the final dial number 
    677668exten => s,n,Set(custom=${CUT(OUT_${DIAL_TRUNK},:,1)}) ; Custom trunks are prefixed with "AMP:" 
  • modules/branches/2.4/core/functions.inc.php

    r5090 r5092  
    484484        $sql = "SELECT * FROM extensions where context = '".$outrt['application']."' ORDER BY extension, CAST(priority AS UNSIGNED) ASC"; 
    485485        $thisrt = sql($sql,"getAll",DB_FETCHMODE_ASSOC); 
     486        $lastexten = false; 
    486487        foreach($thisrt as $exten) { 
    487488          //if emergencyroute, then set channel var 
     
    493494          if(strpos($exten['args'],"MOHCLASS") !== false) 
    494495            $ext->add($outrt['application'], $exten['extension'], '', new ext_setvar("MOHCLASS", '${IF($["x${MOHCLASS}"="x"]?'.substr($exten['args'],9).':${MOHCLASS})}' )); 
    495           if(strpos($exten['args'],"dialout-trunk") !== false) 
     496          if(strpos($exten['args'],"dialout-trunk") !== false) { 
     497            if ($exten['extension'] !== $lastexten) { 
     498 
     499              // If NODEST is set, clear it. No point in remembering since dialout-trunk will just end in the 
     500              // bit bucket. But if answered by an outside line with transfer capability, we want NODEST to be 
     501              // clear so a subsequent transfer to an internal extension works and goes to voicmail or other 
     502              // destinations. 
     503              // 
     504              // Then do one call to user-callerid and record-enable instead of each time as in the past 
     505              // 
     506              $ext->add($outrt['application'], $exten['extension'], '', new ext_setvar("_NODEST","")); 
     507              $ext->add($outrt['application'], $exten['extension'], '', new ext_macro('user-callerid,SKIPTTL')); 
     508              $ext->add($outrt['application'], $exten['extension'], '', new ext_macro('record-enable,${AMPUSER},OUT')); 
     509              $lastexten = $exten['extension']; 
     510            } 
    496511            $ext->add($outrt['application'], $exten['extension'], '', new ext_macro($exten['args'])); 
     512          } 
    497513          if(strpos($exten['args'],"dialout-enum") !== false) 
    498514            $ext->add($outrt['application'], $exten['extension'], '', new ext_macro($exten['args']));