Show
Ignore:
Timestamp:
12/10/11 18:19:34 (1 year ago)
Author:
p_lindheimer
Message:

additional simplifications to autoanswer code for the 99.9% setups re #5443

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.10/paging/functions.inc.php

    r13061 r13064  
    332332      //auto answer stuff 
    333333      //set autoanswer variables 
    334       foreach ($custom_vars as $key => $value) { 
    335         $ext->add($apppaging, '_AUTOASWER.', '', new ext_setvar('_'.ltrim($key,'_'), $value)); 
    336       } 
    337       $ext->add($apppaging, '_AUTOASWER.', '', new ext_macro('autoanswer','${EXTEN:9}')); 
    338       $ext->add($apppaging, '_AUTOASWER.', '', new ext_return()); 
     334      if (!empty($custom_vars)) { 
     335        foreach ($custom_vars as $key => $value) { 
     336          $ext->add($apppaging, '_AUTOASWER.', '', new ext_setvar('_'.ltrim($key,'_'), $value)); 
     337        } 
     338        $ext->add($apppaging, '_AUTOASWER.', '', new ext_macro('autoanswer','${EXTEN:9}')); 
     339        $ext->add($apppaging, '_AUTOASWER.', '', new ext_return()); 
     340      } 
    339341 
    340342      // Setup Variables before AGI script 
     
    366368         
    367369      // Normal page version (now used for Force also) 
    368       $ext->add($apppaging, "_PAGE.", 'SKIPCHECK', new ext_gosub('AUTOASWER${EXTEN:4},1')); 
     370      // If we had any custom_vars then call the AUTOASWER subroutine first, otherwise go 
     371      // straight to macro-autoanswer 
     372      if (!empty($custom_vars)) { 
     373        $ext->add($apppaging, "_PAGE.", 'SKIPCHECK', new ext_gosub('AUTOASWER${EXTEN:4},1')); 
     374      } else { 
     375        $ext->add($apppaging, "_PAGE.", 'SKIPCHECK', new ext_macro('autoanswer', '${EXTEN:4}')); 
     376      } 
    369377      $ext->add($apppaging, "_PAGE.", '', new ext_dial('${DIAL}','${DTIME},${DOPTIONS}')); 
    370378      $ext->add($apppaging, "_PAGE.", 'skipself', new ext_hangup());