Changeset 9549
- Timestamp:
- 04/27/10 07:54:40 (3 years ago)
- Files:
-
- modules/branches/2.8/companydirectory/agi-bin/compdir.agi (modified) (1 diff)
- modules/branches/2.8/companydirectory/agi-bin/compdir.lib.php (modified) (5 diffs)
- modules/branches/2.8/companydirectory/functions.inc.php (modified) (4 diffs)
- modules/branches/2.8/companydirectory/install.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.8/companydirectory/agi-bin/compdir.agi
r9546 r9549 5 5 $loopcounter1=$loopcounter2=0; 6 6 $search=array(); 7 $dir=new company_dir( 2);//todo: get variable dynamiclay from dialpaln7 $dir=new company_dir(); 8 8 9 9 $dir->agi->stream_file('dir-welcome');//say hello modules/branches/2.8/companydirectory/agi-bin/compdir.lib.php
r9546 r9549 10 10 //pear::db database object handel 11 11 var $db; 12 //options of the directory that we are currently working with 13 var $dir; 12 14 //the current directory that we are working with 13 15 var $directory; … … 16 18 17 19 //this function is run by php automaticly when the class is initalized 18 function __construct($dir){ 19 $this->directory=$dir; 20 function __construct(){ 20 21 $this->agi=$this->__construct_agi(); 21 $this->ami=$this->__construct_ami();22 //$this->ami=$this->__construct_ami(); 22 23 $this->db=$this->__construct_db(); 24 //$this->agivars=$this->__construct_inital_vars(); 25 $this->directory=$this->agivars['dir']; 26 $this->dir=$this->__construct_dir_opts(); 27 $this->dbug('dir_opts',$this->agivars); 23 28 } 24 29 … … 40 45 } 41 46 } 42 47 48 array_shift($_SERVER['argv']); 49 foreach($_SERVER['argv'] as $arg){ 50 $arg=explode('=',$arg); 51 //remove leading '--' 52 if(substr($arg['0'],0,2) == '--'){$arg['0']=substr($arg['0'],2);} 53 $opts[$arg['0']]=isset($arg['1'])?$arg['1']:null; 54 } 43 55 $this->agivar=$opts; 44 56 return $agi; … … 47 59 //get ami handel, called by __construct() 48 60 function __construct_ami(){ 49 require_once( '/var/lib/asterisk/agi-bin/phpagi-asmanager.php');//todo: remove hardcoded path61 require_once($this->agi_get_var('ASTAGIDIR').'/phpagi-asmanager.php');//todo: remove hardcoded path 50 62 $ami=new AGI_AsteriskManager(); 51 63 return $ami; … … 63 75 } 64 76 77 //get options associated with the current dir 78 function __construct_dir_opts(){ 79 $sql='SELECT * FROM directory_details WHERE ID = ?'; 80 $row=$this->db->getRow($sql,array($this->directory),DB_FETCHMODE_ASSOC); 81 $this->dbug($this->db->last_query); 82 return $row; 83 } 84 /* 85 //get inital variables passed to the agi, called by __construct() 86 function __construct_inital_vars(){ 87 array_shift($_SERVER['argv']); 88 foreach($_SERVER['argv'] as $arg){ 89 $arg=explode('=',$arg); 90 //remove leading '--' 91 if(substr($arg['0'],0,2) == '--'){$arg['0']=substr($arg['0'],2);} 92 $opts[$arg['0']]=isset($arg['1'])?$arg['1']:null; 93 } 94 return $opts; 95 } 96 */ 65 97 //get a channel varibale 66 98 function agi_get_var($var){ modules/branches/2.8/companydirectory/functions.inc.php
r9548 r9549 37 37 $currentcomponent->addguielem($section, new gui_selectbox('invalid_recording', $currentcomponent->getoptlist('recordings'), $dir['invalid_recording'], 'Invalid Recording', 'Prompt to be played before sending the caller to an alternate destination due to receiving the maximum amount of invalid/unmatched responses (as determaind by Invalid Retries)', false)); 38 38 $currentcomponent->addguielem($section, new gui_drawselects('invalid_destination', 0, $dir['invalid_destination'], _('Invalid Destination'), _('Destination to send the call to after Invalid Recording is played.'), false)); 39 $currentcomponent->addguielem($section, new gui_checkbox('retivr', $dir['retivr'], 'Return to IVR', 'When selected, if the call passed through an anr that had "Return to IVR" selected, the call will be returned there instead of the Invalid destination.',true)); 39 40 $currentcomponent->addguielem($section, new gui_hidden('id', $dir['id'])); 40 41 $currentcomponent->addguielem($section, new gui_hidden('action', 'edit')); … … 60 61 global $db,$amp_conf; 61 62 //get variables for directory_details 62 $requestvars=array('id','dirname','description','announcement','valid_recording','callid_prefix', 63 'alert_info','repeat_loops','repeat_recording','invalid_recording','invalid_destination'); 63 $requestvars=array('id','dirname','description','announcement','valid_recording', 64 'callid_prefix','alert_info','repeat_loops','repeat_recording', 65 'invalid_recording','invalid_destination','retivr'); 64 66 foreach($requestvars as $var){ 65 67 $vars[$var]=isset($_REQUEST[$var])?$_REQUEST[$var]:''; … … 165 167 $select.='<optgroup label="'._('System Recordings:').'">'; 166 168 167 foreach($directory_draw_recordings_list as $r){ dbug('$directory_draw_recordings_list',$r);169 foreach($directory_draw_recordings_list as $r){ 168 170 $select.='<option value="'.$r['id'].'" '.(($audio==$r['id'])?'SELECTED':'').'>'.$r['displayname'].'</option>'; 169 171 } … … 202 204 function companydirectory_save_dir_details($vals){ 203 205 global $db; 204 $sql='REPLACE INTO directory_details VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )';206 $sql='REPLACE INTO directory_details VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; 205 207 $foo=$db->query($sql,$vals); 206 208 if (DB::IsError($foo)){ 207 209 dbug($foo->getDebugInfo()); 208 210 } 211 dbug($db->last_query); 209 212 } 210 213 modules/branches/2.8/companydirectory/install.php
r9541 r9549 31 31 repeat_recording INT, 32 32 invalid_recording INT, 33 invalid_destination varchar(50) 33 invalid_destination varchar(50), 34 retivr varchar(10) 34 35 )"; 35 36
