Changeset 3758

Show
Ignore:
Timestamp:
02/08/07 20:45:51 (6 years ago)
Author:
p_lindheimer
Message:

add option to annoucements allowing for a single digit to be pressed for the annoucement to be repeated

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.2/announcement/functions.inc.php

    r3710 r3758  
    1919          $ext->add('app-announcement-'.$row[0], 's', '', new ext_wait('1')); 
    2020        } 
    21         if ($row[3]) { 
     21        if ($row[3] || $row[7]) { 
    2222          // allow skip 
    23           $ext->add('app-announcement-'.$row[0], 's', '', new ext_background($row[2].'|n')); 
     23          if ($row[7]) { 
     24            $ext->add('app-announcement-'.$row[0], 's', '', new ext_responsetimeout(10)); 
     25          } 
     26          $ext->add('app-announcement-'.$row[0], 's', 'play', new ext_background($row[2].'|nm')); 
    2427           
    25           $ext->add('app-announcement-'.$row[0], '_X', '', new ext_noop('User skipped announcement')); 
    26           if ($row[5]) { 
    27             $ext->add('app-announcement-'.$row[0], '_X', '', new ext_gotoif('$["x${IVR_CONTEXT}" = "x"]', $row[4].':${IVR_CONTEXT},return,1')); 
    28           } else { 
    29             $ext->add('app-announcement-'.$row[0], '_X', '', new ext_goto($row[4])); 
     28          if ($row[3]) { 
     29            $ext->add('app-announcement-'.$row[0], '_X', '', new ext_noop('User skipped announcement')); 
     30            if ($row[5]) { 
     31              $ext->add('app-announcement-'.$row[0], '_X', '', new ext_gotoif('$["x${IVR_CONTEXT}" = "x"]', $row[4].':${IVR_CONTEXT},return,1')); 
     32            } else { 
     33              $ext->add('app-announcement-'.$row[0], '_X', '', new ext_goto($row[4])); 
     34            } 
     35          } 
     36          if ($row[7]) { 
     37            $ext->add('app-announcement-'.$row[0], $row[7], '', new ext_goto('s,play')); 
    3038          } 
    3139        } else { 
     
    3341        } 
    3442 
     43        // if repeat enabled then set exten to t to allow for the key to be pressed, otherwise play message and go 
     44        $exten = $row[7] ? 't':'s'; 
    3545        if ($row[5]) { 
    36           $ext->add('app-announcement-'.$row[0], 's', '', new ext_gotoif('$["x${IVR_CONTEXT}" = "x"]', $row[4].':${IVR_CONTEXT},return,1')); 
     46          $ext->add('app-announcement-'.$row[0], $exten, '', new ext_gotoif('$["x${IVR_CONTEXT}" = "x"]', $row[4].':${IVR_CONTEXT},return,1')); 
    3747        } else { 
    38           $ext->add('app-announcement-'.$row[0], 's', '', new ext_goto($row[4])); 
     48          $ext->add('app-announcement-'.$row[0], $exten, '', new ext_goto($row[4])); 
    3949        } 
    4050         
     
    4656function announcement_list() { 
    4757  global $db; 
    48   $sql = "SELECT announcement_id, description, recording, allow_skip, post_dest, return_ivr, noanswer FROM announcement ORDER BY description "; 
     58  $sql = "SELECT announcement_id, description, recording, allow_skip, post_dest, return_ivr, noanswer, repeat FROM announcement ORDER BY description "; 
    4959  $results = $db->getAll($sql); 
    5060  if(DB::IsError($results)) { 
     
    5666function announcement_get($announcement_id) { 
    5767  global $db; 
    58   $sql = "SELECT announcement_id, description, recording, allow_skip, post_dest, return_ivr, noanswer FROM announcement WHERE announcement_id = ".addslashes($announcement_id); 
     68  $sql = "SELECT announcement_id, description, recording, allow_skip, post_dest, return_ivr, noanswer, repeat FROM announcement WHERE announcement_id = ".addslashes($announcement_id); 
    5969  $row = $db->getRow($sql); 
    6070  if(DB::IsError($row)) { 
     
    6474} 
    6575 
    66 function announcement_add($description, $recording, $allow_skip, $post_dest, $return_ivr, $noanswer) { 
     76function announcement_add($description, $recording, $allow_skip, $post_dest, $return_ivr, $noanswer, $repeat) { 
    6777  global $db; 
    68   $sql = "INSERT INTO announcement (description, recording, allow_skip, post_dest, return_ivr, noanswer) VALUES (". 
     78  $sql = "INSERT INTO announcement (description, recording, allow_skip, post_dest, return_ivr, noanswer, repeat) VALUES (". 
    6979    "'".addslashes($description)."', ". 
    7080    "'".addslashes($recording)."', ". 
     
    7282    "'".addslashes($post_dest)."', ". 
    7383    "'".($return_ivr ? 1 : 0)."', ". 
    74     "'".($noanswer ? 1 : 0)."')"; 
     84    "'".($noanswer ? 1 : 0)."', ". 
     85    "'".addslashes($repeat)."')"; 
    7586  $result = $db->query($sql); 
    7687  if(DB::IsError($result)) { 
     
    89100} 
    90101 
    91 function announcement_edit($announcement_id, $description, $recording, $allow_skip, $post_dest, $return_ivr, $noanswer) {  
     102function announcement_edit($announcement_id, $description, $recording, $allow_skip, $post_dest, $return_ivr, $noanswer, $repeat) {  
    92103  global $db; 
    93104  $sql = "UPDATE announcement SET ". 
     
    97108    "post_dest = '".addslashes($post_dest)."', ". 
    98109    "return_ivr = '".($return_ivr ? 1 : 0)."', ". 
    99     "noanswer = '".($noanswer ? 1 : 0)."' ". 
     110    "noanswer = '".($noanswer ? 1 : 0)."', ". 
     111    "repeat = '".addslashes($repeat)."' ". 
    100112    "WHERE announcement_id = ".addslashes($announcement_id); 
    101113  $result = $db->query($sql); 
  • modules/branches/2.2/announcement/install.php

    r3702 r3758  
    2323} 
    2424 
     25// Version 0.6 adds repeat 
     26$sql = "SELECT repeat FROM announcement"; 
     27$check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     28if(DB::IsError($check)) { 
     29  // add new field 
     30    $sql = "ALTER TABLE announcement ADD repeat VARCHAR(2) NOT NULL DEFAULT '';"; 
     31    $result = $db->query($sql); 
     32    if(DB::IsError($result)) { die($result->getDebugInfo()); } 
     33} 
     34 
    2535?> 
  • modules/branches/2.2/announcement/install.sql

    r3702 r3758  
    66  post_dest VARCHAR( 255 ) , 
    77  return_ivr TINYINT(1) NOT NULL DEFAULT 0, 
    8   noanswer TINYINT(1) NOT NULL DEFAULT 0 
     8  noanswer TINYINT(1) NOT NULL DEFAULT 0, 
     9  repeat VARCHAR(2) NOT NULL DEFAULT '' 
    910); 
  • modules/branches/2.2/announcement/module.xml

    r3713 r3758  
    22  <rawname>announcement</rawname> 
    33  <name>Announcements</name> 
    4   <version>0.5</version> 
     4  <version>0.6</version> 
    55  <changelog> 
     6    *0.6* added an option to choose a single digit that can be used to have the msg repeated 
    67    *0.5* chaned to jump to ivr's return context 
    78    *0.4* Added Don't Answer option to not answer the channel (and playback early media if supported) 
  • modules/branches/2.2/announcement/page.announcement.php

    r3702 r3758  
    2424$noanswer = isset($_POST['noanswer']) ? $_POST['noanswer'] :  0; 
    2525$post_dest = isset($_POST['post_dest']) ? $_POST['post_dest'] :  ''; 
     26$repeat = isset($_POST['repeat']) ? $_POST['repeat'] :  ''; 
    2627 
    2728if ($_POST['goto0']) { 
     
    3334switch ($action) { 
    3435  case 'add': 
    35     announcement_add($description, $recording, $allow_skip, $post_dest, $return_ivr, $noanswer); 
     36    announcement_add($description, $recording, $allow_skip, $post_dest, $return_ivr, $noanswer, $repeat); 
    3637    needreload(); 
    3738    redirect_standard(); 
    3839  break; 
    3940  case 'edit': 
    40     announcement_edit($announcement_id, $description, $recording, $allow_skip, $post_dest, $return_ivr, $noanswer); 
     41    announcement_edit($announcement_id, $description, $recording, $allow_skip, $post_dest, $return_ivr, $noanswer, $repeat); 
    4142    needreload(); 
    4243    redirect_standard('extdisplay'); 
     
    8081  $return_ivr = $row[5]; 
    8182  $noanswer = $row[6]; 
     83  $repeat = $row[7]; 
    8284 
    8385} 
     
    113115  </tr> 
    114116<?php } ?> 
     117  <tr> 
     118    <td><a href="#" class="info"><?php echo _("Repeat")?><span><?php echo _("Key to press that will allow for the message to be replayed. If you choose this option there will be a short delay inserted after the message. If a longer delay is needed it should be incoporated into the recording.")?></span></a></td> 
     119    <td> 
     120      &nbsp;&nbsp;<select name="repeat"/> 
     121      <?php 
     122        $default = isset($repeat) ? $repeat : ''; 
     123        for ($i=0; $i<=9; $i++ ) { 
     124          $digits[]="$i"; 
     125        } 
     126        $digits[] = '*'; 
     127        $digits[] = '#'; 
     128        echo '<option value=""'.($default == '' ? ' SELECTED' : '').'>'._("Disable")."</option>"; 
     129        foreach ($digits as $digit) { 
     130          echo '<option value="'.$digit.'"'.($digit == $default ? ' SELECTED' : '').'>'.$digit."</option>\n"; 
     131        } 
     132      ?> 
     133      </select> 
     134    </td> 
     135  </tr> 
    115136  <tr> 
    116137    <td><a href="#" class="info"><?php echo _("Allow Skip")?><span><?php echo _("If the caller is allowed to press a key to skip the message.")?></span></a></td>