Changeset 3758
- Timestamp:
- 02/08/07 20:45:51 (6 years ago)
- Files:
-
- modules/branches/2.2/announcement/functions.inc.php (modified) (8 diffs)
- modules/branches/2.2/announcement/install.php (modified) (1 diff)
- modules/branches/2.2/announcement/install.sql (modified) (1 diff)
- modules/branches/2.2/announcement/module.xml (modified) (1 diff)
- modules/branches/2.2/announcement/page.announcement.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.2/announcement/functions.inc.php
r3710 r3758 19 19 $ext->add('app-announcement-'.$row[0], 's', '', new ext_wait('1')); 20 20 } 21 if ($row[3] ) {21 if ($row[3] || $row[7]) { 22 22 // 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')); 24 27 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')); 30 38 } 31 39 } else { … … 33 41 } 34 42 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'; 35 45 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')); 37 47 } 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])); 39 49 } 40 50 … … 46 56 function announcement_list() { 47 57 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 "; 49 59 $results = $db->getAll($sql); 50 60 if(DB::IsError($results)) { … … 56 66 function announcement_get($announcement_id) { 57 67 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); 59 69 $row = $db->getRow($sql); 60 70 if(DB::IsError($row)) { … … 64 74 } 65 75 66 function announcement_add($description, $recording, $allow_skip, $post_dest, $return_ivr, $noanswer ) {76 function announcement_add($description, $recording, $allow_skip, $post_dest, $return_ivr, $noanswer, $repeat) { 67 77 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 (". 69 79 "'".addslashes($description)."', ". 70 80 "'".addslashes($recording)."', ". … … 72 82 "'".addslashes($post_dest)."', ". 73 83 "'".($return_ivr ? 1 : 0)."', ". 74 "'".($noanswer ? 1 : 0)."')"; 84 "'".($noanswer ? 1 : 0)."', ". 85 "'".addslashes($repeat)."')"; 75 86 $result = $db->query($sql); 76 87 if(DB::IsError($result)) { … … 89 100 } 90 101 91 function announcement_edit($announcement_id, $description, $recording, $allow_skip, $post_dest, $return_ivr, $noanswer ) {102 function announcement_edit($announcement_id, $description, $recording, $allow_skip, $post_dest, $return_ivr, $noanswer, $repeat) { 92 103 global $db; 93 104 $sql = "UPDATE announcement SET ". … … 97 108 "post_dest = '".addslashes($post_dest)."', ". 98 109 "return_ivr = '".($return_ivr ? 1 : 0)."', ". 99 "noanswer = '".($noanswer ? 1 : 0)."' ". 110 "noanswer = '".($noanswer ? 1 : 0)."', ". 111 "repeat = '".addslashes($repeat)."' ". 100 112 "WHERE announcement_id = ".addslashes($announcement_id); 101 113 $result = $db->query($sql); modules/branches/2.2/announcement/install.php
r3702 r3758 23 23 } 24 24 25 // Version 0.6 adds repeat 26 $sql = "SELECT repeat FROM announcement"; 27 $check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 28 if(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 25 35 ?> modules/branches/2.2/announcement/install.sql
r3702 r3758 6 6 post_dest VARCHAR( 255 ) , 7 7 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 '' 9 10 ); modules/branches/2.2/announcement/module.xml
r3713 r3758 2 2 <rawname>announcement</rawname> 3 3 <name>Announcements</name> 4 <version>0. 5</version>4 <version>0.6</version> 5 5 <changelog> 6 *0.6* added an option to choose a single digit that can be used to have the msg repeated 6 7 *0.5* chaned to jump to ivr's return context 7 8 *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 24 24 $noanswer = isset($_POST['noanswer']) ? $_POST['noanswer'] : 0; 25 25 $post_dest = isset($_POST['post_dest']) ? $_POST['post_dest'] : ''; 26 $repeat = isset($_POST['repeat']) ? $_POST['repeat'] : ''; 26 27 27 28 if ($_POST['goto0']) { … … 33 34 switch ($action) { 34 35 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); 36 37 needreload(); 37 38 redirect_standard(); 38 39 break; 39 40 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); 41 42 needreload(); 42 43 redirect_standard('extdisplay'); … … 80 81 $return_ivr = $row[5]; 81 82 $noanswer = $row[6]; 83 $repeat = $row[7]; 82 84 83 85 } … … 113 115 </tr> 114 116 <?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 <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> 115 136 <tr> 116 137 <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>
