Changeset 9549

Show
Ignore:
Timestamp:
04/27/10 07:54:40 (3 years ago)
Author:
mbrevda
Message:

re #4147, closes #4235; add return to ivr gui option

Files:

Legend:

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

    r9546 r9549  
    55$loopcounter1=$loopcounter2=0; 
    66$search=array(); 
    7 $dir=new company_dir(2);//todo: get variable dynamiclay from dialpaln 
     7$dir=new company_dir(); 
    88 
    99$dir->agi->stream_file('dir-welcome');//say hello 
  • modules/branches/2.8/companydirectory/agi-bin/compdir.lib.php

    r9546 r9549  
    1010  //pear::db database object handel 
    1111  var $db; 
     12  //options of the directory that we are currently working with 
     13  var $dir; 
    1214  //the current directory that we are working with 
    1315  var $directory; 
     
    1618   
    1719  //this function is run by php automaticly when the class is initalized 
    18   function __construct($dir){ 
    19     $this->directory=$dir; 
     20  function __construct(){ 
    2021    $this->agi=$this->__construct_agi();   
    21     $this->ami=$this->__construct_ami(); 
     22    //$this->ami=$this->__construct_ami(); 
    2223    $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); 
    2328  } 
    2429   
     
    4045      } 
    4146    } 
    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    } 
    4355    $this->agivar=$opts; 
    4456    return $agi; 
     
    4759  //get ami handel, called by __construct() 
    4860  function __construct_ami(){ 
    49     require_once('/var/lib/asterisk/agi-bin/phpagi-asmanager.php');//todo: remove hardcoded path 
     61    require_once($this->agi_get_var('ASTAGIDIR').'/phpagi-asmanager.php');//todo: remove hardcoded path 
    5062    $ami=new AGI_AsteriskManager(); 
    5163    return $ami; 
     
    6375  } 
    6476   
     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*/ 
    6597  //get a channel varibale   
    6698  function agi_get_var($var){ 
  • modules/branches/2.8/companydirectory/functions.inc.php

    r9548 r9549  
    3737    $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)); 
    3838    $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)); 
    3940    $currentcomponent->addguielem($section, new gui_hidden('id', $dir['id'])); 
    4041    $currentcomponent->addguielem($section, new gui_hidden('action', 'edit')); 
     
    6061    global $db,$amp_conf; 
    6162    //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'); 
    6466    foreach($requestvars as $var){ 
    6567      $vars[$var]=isset($_REQUEST[$var])?$_REQUEST[$var]:''; 
     
    165167  $select.='<optgroup label="'._('System Recordings:').'">'; 
    166168   
    167   foreach($directory_draw_recordings_list as $r){dbug('$directory_draw_recordings_list',$r); 
     169  foreach($directory_draw_recordings_list as $r){ 
    168170    $select.='<option value="'.$r['id'].'" '.(($audio==$r['id'])?'SELECTED':'').'>'.$r['displayname'].'</option>'; 
    169171  } 
     
    202204function companydirectory_save_dir_details($vals){ 
    203205  global $db; 
    204   $sql='REPLACE INTO directory_details VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; 
     206  $sql='REPLACE INTO directory_details VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; 
    205207  $foo=$db->query($sql,$vals); 
    206208  if (DB::IsError($foo)){ 
    207209    dbug($foo->getDebugInfo()); 
    208210  } 
     211  dbug($db->last_query); 
    209212} 
    210213 
  • modules/branches/2.8/companydirectory/install.php

    r9541 r9549  
    3131    repeat_recording INT, 
    3232    invalid_recording INT, 
    33     invalid_destination varchar(50) 
     33    invalid_destination varchar(50), 
     34    retivr varchar(10) 
    3435)"; 
    3536