Changeset 3707

Show
Ignore:
Timestamp:
02/06/07 00:50:30 (6 years ago)
Author:
p_lindheimer
Message:

Merged revisions 3706 via svnmerge from
https://amportal.svn.sourceforge.net/svnroot/amportal/modules/branches/2.2

........

r3706 | p_lindheimer | 2007-02-05 21:49:40 -0800 (Mon, 05 Feb 2007) | 1 line


add option for an ivr to return to a parent ivr if one was called within its call path, otherwise specified destination is used

........

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.3

    • Property svnmerge-integrated changed from /modules/branches/2.2:1-3588,3615-3635,3637-3638,3640,3674,3680,3686,3692,3702 to /modules/branches/2.2:1-3588,3615-3635,3637-3638,3640,3674,3680,3686,3692,3702,3706
  • modules/branches/2.3/ivr/functions.inc.php

    r3681 r3707  
    4747            // s == old stuff. We don't care. 
    4848            if ($arr[0] != 's')  
    49               ivr_add_command($id,$cmd['extension'],$cmd['args']); 
     49              ivr_add_command($id,$cmd['extension'],$cmd['args'],0); 
    5050          } 
    5151        } 
     
    149149                    $ext->add($id, 's', '', new ext_setvar('LOOPCOUNT', 0)); 
    150150                    $ext->add($id, 's', '', new ext_setvar('__DIR-CONTEXT', $details['dircontext'])); 
     151                    $ext->add($id, 's', '', new ext_setvar('IVR_CONTEXT_${CONTEXT}', '${IVR_CONTEXT}')); 
    151152                    $ext->add($id, 's', '', new ext_setvar('_IVR_CONTEXT', '${CONTEXT}')); 
    152153                    $ext->add($id, 's', '', new ext_answer('')); 
     
    169170              $ext->add($id, $dest['selection'],'', new ext_dbdel('${BLKVM_OVERRIDE}')); 
    170171              $ext->add($id, $dest['selection'],'', new ext_setvar('__NODEST', '')); 
    171               $ext->add($id, $dest['selection'],'', new ext_goto($dest['dest'])); 
     172              if ($dest['ivr_ret']) { 
     173                $ext->add($id, $dest['selection'],'', new ext_gotoif('$["x${IVR_CONTEXT_${CONTEXT}}" = "x"]', $dest['dest'].':${IVR_CONTEXT_${CONTEXT}},s,1')); 
     174              } else { 
     175                $ext->add($id, $dest['selection'],'', new ext_goto($dest['dest'])); 
     176              } 
    172177            } 
    173178          } 
     
    209214} 
    210215 
    211 function ivr_add_command($id, $cmd, $dest) { 
     216function ivr_add_command($id, $cmd, $dest, $ivr_ret) { 
    212217  global $db; 
    213218  // Does it already exist? 
    214219  $res = $db->getRow("SELECT * from ivr_dests where ivr_id='$id' and selection='$cmd'"); 
     220  $ivr_ret = $ivr_ret ? 1 : 0; 
    215221  if (count($res) == 0) { 
    216222    // Just add it. 
    217     sql("INSERT INTO ivr_dests VALUES('$id', '$cmd', '$dest')"); 
     223    sql("INSERT INTO ivr_dests VALUES('$id', '$cmd', '$dest', '$ivr_ret')"); 
    218224  } else { 
    219225    // Update it. 
    220     sql("UPDATE ivr_dests SET dest='$dest' where ivr_id='$id' and selection='$cmd'"); 
     226    sql("UPDATE ivr_dests SET dest='$dest', ivr_ret='$ivr_ret' where ivr_id='$id' and selection='$cmd'"); 
    221227  } 
    222228  needreload(); 
     
    250256      $dest = $post[$post[$var].$match[1]]; 
    251257      $cmd = $post['option'.$match[1]]; 
     258      $ivr_ret = $post['ivr_ret'.$match[1]]; 
    252259      // Debugging if it all goes pear shaped. 
    253260      // print "I think pushing $cmd does $dest<br>\n"; 
    254261      if (strlen($cmd)) 
    255         ivr_add_command($id, $cmd, $dest); 
     262        ivr_add_command($id, $cmd, $dest, $ivr_ret); 
    256263    } 
    257264  } 
     
    285292  global $db; 
    286293 
    287   $sql = "SELECT selection, dest FROM ivr_dests where ivr_id='$id' ORDER BY selection"; 
     294  $sql = "SELECT selection, dest, ivr_ret FROM ivr_dests where ivr_id='$id' ORDER BY selection"; 
    288295        $res = $db->getAll($sql, DB_FETCHMODE_ASSOC); 
    289296        if(DB::IsError($res)) { 
  • modules/branches/2.3/ivr/install.php

    r1911 r3707  
    5555} 
    5656 
     57// Version 2.5.7 adds auto-return to IVR 
     58$sql = "SELECT ivr_ret FROM ivr_dests"; 
     59$check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     60if(DB::IsError($check)) { 
     61  // add new field 
     62    $sql = "ALTER TABLE ivr_dests ADD ivr_ret TINYINT(1) NOT NULL DEFAULT 0;"; 
     63    $result = $db->query($sql); 
     64    if(DB::IsError($result)) { die($result->getDebugInfo()); } 
     65} 
     66 
    5767?> 
  • modules/branches/2.3/ivr/install.sql

    r1627 r3707  
    11CREATE TABLE IF NOT EXISTS ivr ( ivr_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, displayname VARCHAR(50), deptname VARCHAR(50), enable_directory VARCHAR(8), enable_directdial VARCHAR(8), timeout INT, announcement VARCHAR(255), dircontext VARCHAR ( 50 ) DEFAULT "default" ); 
    2 CREATE TABLE IF NOT EXISTS ivr_dests ( ivr_id INT NOT NULL, selection VARCHAR(10), dest VARCHAR(50)); 
     2CREATE TABLE IF NOT EXISTS ivr_dests ( ivr_id INT NOT NULL, selection VARCHAR(10), dest VARCHAR(50), ivr_ret TINYINT(1) NOT NULL DEFAULT 0); 
  • modules/branches/2.3/ivr/module.xml

    r3684 r3707  
    22  <rawname>ivr</rawname> 
    33  <name>IVR</name> 
    4   <version>2.5.6</version> 
     4  <version>2.5.7</version> 
    55  <type>setup</type> 
    66  <category>Inbound Call Control</category> 
     
    99  </description> 
    1010  <changelog> 
     11    *2.5.7* extended schema and added ability to have ivr options to return to calling parent ivrs if appropriate, otherwise specified destination 
    1112    *2.5.6* Added: Set(IVR_CONTEXT=${CONTEXT}) to facilitate simple returns to calling context (e.g. from an announcement or custom app) 
    1213    *2.5.5* Fix bug #1651 and apply patch #1664, allow voicemail as destination if ivr is entered from a queue breakout option 
  • modules/branches/2.3/ivr/page.ivr.php

    r3589 r3707  
    202202  if (!empty($dests)) { 
    203203    foreach ($dests as $dest) { 
    204       drawdestinations($count, $dest['selection'], $dest['dest']); 
     204      drawdestinations($count, $dest['selection'], $dest['dest'], $dest['ivr_ret']); 
    205205      $count++; 
    206206    } 
    207207  } 
    208208  while ($count < $nbroptions) { 
    209     drawdestinations($count, null, null); 
     209    drawdestinations($count, null, null, 0); 
    210210    $count++; 
    211211  } 
     
    275275} 
    276276 
    277 function drawdestinations($count, $sel,  $dest) { ?> 
     277function drawdestinations($count, $sel,  $dest, $ivr_ret) { ?> 
    278278  <tr> <td style="text-align:right;"> 
     279 
     280    <small><a href="#" class="info"><?php echo _("Return to IVR")?><span><?php echo _("Check this box to have this option return to a parent IVR if it was called from a parent IVR. If not, it will go to the chosen destination.<br><br>The return path will be to any IVR that was in the call path prior to this IVR which could lead to strange results if there was an IVR called in the call path but not immediately before this")?></span></a></small><input type="checkbox" name="ivr_ret<?php echo $count ?>" "<?php echo $ivr_ret?'CHECKED':''; ?>"<br /> 
    279281    <input size="2" type="text" name="option<?php echo $count ?>" value="<?php echo $sel ?>"><br /> 
    280282<?php if (strlen($sel)) {  ?>