- Timestamp:
- 05/23/10 22:16:15 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.8/directory/agi-bin/directory.agi
r9615 r9691 17 17 $needs_welcome = false; 18 18 $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)) { 20 20 $search=$dir->agi->fastpass_get_data($buffer, $dir->dir['announcement'],3000,3); 21 21 } … … 81 81 82 82 if($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(); 97 84 } 98 85 modules/branches/2.8/directory/agi-bin/directory.lib.php
r9625 r9691 98 98 $res=$this->db->getAll($sql,DB_FETCHMODE_ASSOC); 99 99 if(DB::IsError($res)) { 100 debug("FATAL: got error from getAll query" );100 debug("FATAL: got error from getAll query",1); 101 101 debug($res->getDebugInfo()); 102 102 } … … 221 221 } 222 222 223 // TODO: how to deal with problem cases like "'" (O'Neil) or "." (Jr.) - maybe use '1' for those224 223 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 226 231 //the regex in the query will match the searchstring at the beging of the string or after a space 227 232 $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]','',''); 229 234 $this->searchstring=str_replace($num,$alph,$key); 230 235 debug("search string for regex: {$this->searchstring}",6); … … 257 262 } 258 263 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 260 282 /* 261 283 * FreePBX Debuging function
