Changeset 9691 for modules

Show
Ignore:
Timestamp:
05/23/10 22:16:15 (3 years ago)
Author:
p_lindheimer
Message:

closes #4291 making 0 an option to bail out - General Settings tab needs to be modified to reflect the transition

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.8/directory/agi-bin/directory.agi

    r9615 r9691  
    1717      $needs_welcome = false; 
    1818      $search=$dir->agi->fastpass_get_data($buffer, 'dir-welcome',100,3); 
    19       if (strlen($buffer) < 3) { 
     19      if ((strlen($buffer) < 3) && (strstr($search['result'],'0') === false)) { 
    2020        $search=$dir->agi->fastpass_get_data($buffer, $dir->dir['announcement'],3000,3); 
    2121      } 
     
    8181 
    8282if($loopcounter1){ 
    83   //do something if we are exiting due to to many tries 
    84   // 
    85   $dir->agi->set_variable('DIR_INVALID_RECORDING',$dir->dir['invalid_recording']); 
    86   if($dir->agi_get_var('IVR_CONTEXT')){ 
    87     $dir->agi->set_extension('retivr'); 
    88   }else{ 
    89     $dest = explode(',',$dir->dir['invalid_destination']); 
    90     $dir->agi->set_variable('DIR_INVALID_CONTEXT',$dest['0']); 
    91     $dir->agi->set_variable('DIR_INVALID_EXTEN',$dest['1']); 
    92     $dir->agi->set_variable('DIR_INVALID_PRI',$dest['2']); 
    93     $dir->agi->set_extension('invalid'); 
    94   } 
    95   $dir->agi->set_priority('1'); 
    96   exit; 
     83  $dir->bail(); 
    9784} 
    9885 
  • modules/branches/2.8/directory/agi-bin/directory.lib.php

    r9625 r9691  
    9898      $res=$this->db->getAll($sql,DB_FETCHMODE_ASSOC); 
    9999      if(DB::IsError($res)) { 
    100         debug("FATAL: got error from getAll query"); 
     100        debug("FATAL: got error from getAll query",1); 
    101101        debug($res->getDebugInfo()); 
    102102      } 
     
    221221  } 
    222222   
    223   // TODO: how to deal with problem cases like "'" (O'Neil) or "." (Jr.) - maybe use '1' for those 
    224223  function search($key,$count=0){ 
    225     if(empty($key)){return false;}//requre search term 
     224    if($key == ''){return false;}//requre search term 
     225 
     226    if(strstr($key,'0') !== false) { 
     227      debug("user pressed 0 - bailing out"); 
     228      $this->bail(); 
     229    } 
     230 
    226231    //the regex in the query will match the searchstring at the beging of the string or after a space 
    227232    $num= array('1','2','3','4','5','6','7','8','9','0','#'); 
    228     $alph=array('?','[abcABC]','[defDEF]','[ghiGHI]','[jklJKL]','[mnoMNO]','[pqrsPQRS]','[tuvTUV]','[wxyzWXYZ]','( )',''); 
     233    $alph=array("[\s@,-!/+=.']",'[abcABC]','[defDEF]','[ghiGHI]','[jklJKL]','[mnoMNO]','[pqrsPQRS]','[tuvTUV]','[wxyzWXYZ]','',''); 
    229234    $this->searchstring=str_replace($num,$alph,$key); 
    230235    debug("search string for regex: {$this->searchstring}",6); 
     
    257262  } 
    258263 
    259    
     264  function bail() { 
     265    //do something if we are exiting due to to many tries 
     266    // 
     267    debug("User pressed zero, passing back recording of {$this->dir['invalid_recording']}"); 
     268    $this->agi->set_variable('DIR_INVALID_RECORDING',$this->dir['invalid_recording']); 
     269    if($this->agi_get_var('IVR_CONTEXT')){ 
     270      $this->agi->set_extension('retivr'); 
     271    }else{ 
     272      $dest = explode(',',$this->dir['invalid_destination']); 
     273      $this->agi->set_variable('DIR_INVALID_CONTEXT',$dest['0']); 
     274      $this->agi->set_variable('DIR_INVALID_EXTEN',$dest['1']); 
     275      $this->agi->set_variable('DIR_INVALID_PRI',$dest['2']); 
     276      $this->agi->set_extension('invalid'); 
     277    } 
     278    $this->agi->set_priority('1'); 
     279    exit; 
     280  } 
     281 
    260282 /*  
    261283  * FreePBX Debuging function