Changeset 13439

Show
Ignore:
Timestamp:
02/13/12 22:41:59 (1 year ago)
Author:
p_lindheimer
Message:

closes #5576 adds ability to not append original annoucmenets. know issue in js when timeout retries set to 0 not hiding elements as does invalid repsonse. This was broken before, needs someone to look at it

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.10/ivr/assets/js/ivr.js

    r12991 r13439  
    8383//always disable hidden elements so that they dont trigger validation 
    8484function invalid_elements() { 
    85   var invalid_elements = $('#invalid_retry_recording, #invalid_recording, [name=gotoinvalid]'); 
     85  var invalid_elements = $('#invalid_retry_recording, #invalid_recording, #invalid_append_announce, [name=gotoinvalid]'); 
    8686  var invalid_element_tr = invalid_elements.parent().parent(); 
    8787  switch ($('#invalid_loops').val()) { 
     
    9494      invalid_element_tr.show(); 
    9595      $('#invalid_retry_recording').parent().parent().hide(); 
     96      $('#invalid_append_announce').parent().parent().hide(); 
    9697      break; 
    9798    default: 
     
    104105//always disable hidden elements so that they dont trigger validation 
    105106function timeout_elements() { 
    106   var timeout_elements = $('#timeout_retry_recording, #timeout_recording, [name=gototimeout]'); 
     107  var timeout_elements = $('#timeout_retry_recording, #timeout_recording, #timeout_append_announce, [name=gototimeout]'); 
    107108  var timeout_element_tr = timeout_elements.parent().parent(); 
    108109  switch ($('#timeout_loops').val()) { 
     
    114115      timeout_elements.removeAttr('disabled') 
    115116      timeout_element_tr.show(); 
    116       $('#timeout_retry_recording').attr('disabled', 'disabled').parent().parent().hide(); 
     117      $('#timeout_retry_recording').parent().parent().hide(); 
     118      $('#timeout_append_announce').parent().parent().hide(); 
    117119    default: 
    118120      timeout_elements.removeAttr('disabled') 
  • modules/branches/2.10/ivr/functions.inc.php

    r13397 r13439  
    8383        $ext->add($c, 's', '', new ext_answer('')); 
    8484        $ext->add($c, 's', '', new ext_wait('1')); 
     85 
     86        $ivr_announcement = recordings_get_file($ivr['announcement']); 
     87        $ext->add($c, 's', '', new ext_set('IVR_MSG', $ivr_announcement)); 
     88 
    8589        $ext->add($c, 's', 'start', new ext_digittimeout(3)); 
    8690        //$ext->add($ivr_id, 's', '', new ext_responsetimeout($ivr['timeout_time'])); 
    8791 
    88         $ext->add($c, 's', '', new ext_background(recordings_get_file($ivr['announcement']))); 
     92        $ext->add($c, 's', '', new ext_execif('$["${IVR_MSG}" != ""]','Background','${IVR_MSG}')); 
    8993        $ext->add($c, 's', '', new ext_waitexten($ivr['timeout_time'])); 
    9094         
     
    127131            switch ($ivr['invalid_retry_recording']) { 
    128132              case 'default': 
    129                 $ext->add($c, 'i', '', new ext_playback('no-valid-responce-pls-try-again'))
     133                $invalid_annoucement = 'no-valid-responce-pls-try-again'
    130134                break; 
    131135              case '': 
     136                $invalid_annoucement = ''; 
    132137                break; 
    133138              default: 
    134                 $ext->add($c, 'i', '', new ext_playback(recordings_get_file($ivr['invalid_retry_recording']))); 
     139                $invalid_annoucement = recordings_get_file($ivr['invalid_retry_recording']); 
    135140                break; 
    136141            } 
    137142 
     143            if ($ivr['invalid_append_announce'] || $invalid_annoucement == '') { 
     144              $invalid_annoucement .= '&' . $ivr_announcement; 
     145            } 
     146            $ext->add($c, 'i', '', new ext_set('IVR_MSG', trim($invalid_annoucement, '&'))); 
    138147            $ext->add($c, 'i', '', new ext_goto('s,start')); 
    139148          } 
     
    154163          } 
    155164          $ext->add($c, 'i', $label, new ext_goto($ivr['invalid_destination'])); 
     165        } else { 
     166          // If no invalid destination provided we need to do something 
     167          $ext->add($c, 'i', '', new ext_playback('sorry-youre-having-problems')); 
     168          $ext->add($c, 'i', '', new ext_goto('1','hang')); 
    156169        } 
    157170 
     
    164177            switch ($ivr['timeout_retry_recording']) { 
    165178              case 'default': 
    166                 $ext->add($c, 't', '', new ext_playback('no-valid-responce-pls-try-again'))
     179                $timeout_annoucement = 'no-valid-responce-pls-try-again'
    167180                break; 
    168181              case '': 
     182                $timeout_annoucement = ''; 
    169183                break; 
    170184              default: 
    171                 $ext->add($c, 't', '',  
    172                   new ext_playback(recordings_get_file($ivr['timeout_retry_recording']))); 
     185                $timeout_annoucement = recordings_get_file($ivr['timeout_retry_recording']); 
    173186                break; 
    174187            } 
    175188 
     189            if ($ivr['timeout_append_announce'] || $timeout_annoucement == '') { 
     190              $timeout_annoucement .= '&' . $ivr_announcement; 
     191            } 
     192            $ext->add($c, 't', '', new ext_set('IVR_MSG', trim($timeout_annoucement, '&'))); 
    176193            $ext->add($c, 't', '', new ext_goto('s,start')); 
    177194          } 
     
    192209          } 
    193210          $ext->add($c, 't', $label, new ext_goto($ivr['timeout_destination'])); 
     211        } else { 
     212          // If no invalid destination provided we need to do something 
     213          $ext->add($c, 't', '', new ext_playback('sorry-youre-having-problems')); 
     214          $ext->add($c, 't', '', new ext_goto('1','hang')); 
    194215        } 
    195216         
     
    199220          $ext->add($c, 'return', '', new ext_setvar('_IVR_CONTEXT', '${CONTEXT}')); 
    200221          $ext->add($c, 'return', '', new ext_setvar('_IVR_CONTEXT_${CONTEXT}', '${IVR_CONTEXT_${CONTEXT}}')); 
     222          $ext->add($c, 'return', '', new ext_set('IVR_MSG', $ivr_announcement)); 
    201223          $ext->add($c, 'return', '', new ext_goto('s,start')); 
    202224        } 
     
    383405    new gui_selectbox('invalid_retry_recording', $currentcomponent->getoptlist('recordings'),  
    384406    $ivr['invalid_retry_recording'], _('Invalid Retry Recording'), _('Prompt to be played when an invalid/unmatched response is received, before prompting the caller to try again'), false)); 
     407 
     408  $currentcomponent->addguielem($section,  
     409    new gui_checkbox('invalid_append_announce', $ivr['invalid_append_announce'], _('Append Original Annoucement'), _('After playing the Invalid Retry Recording the system will replay the main IVR Annoucement'))); 
     410 
    385411  $currentcomponent->addguielem($section,  
    386412    new gui_selectbox('invalid_recording', $currentcomponent->getoptlist('recordings'),  
     
    397423    new gui_selectbox('timeout_retry_recording', $currentcomponent->getoptlist('recordings'),  
    398424    $ivr['timeout_retry_recording'], _('Timeout Retry Recording'), _('Prompt to be played when an invalid/unmatched response is received, before prompting the caller to try again'), false)); 
     425 
     426  $currentcomponent->addguielem($section,  
     427    new gui_checkbox('timeout_append_announce', $ivr['timeout_append_announce'], _('Append Original Annoucement'), _('After playing the Timeout Retry Recording the system will replay the main IVR Annoucement'))); 
     428 
    399429  $currentcomponent->addguielem($section,  
    400430    new gui_selectbox('timeout_recording', $currentcomponent->getoptlist('recordings'),  
     
    448478            'invalid_destination', 'invalid_recording', 
    449479            'retvm', 'timeout_time', 'timeout_recording', 
    450             'timeout_retry_recording', 'timeout_destination', 'timeout_loops'); 
     480            'timeout_retry_recording', 'timeout_destination', 'timeout_loops', 
     481            'timeout_append_announce', 'invalid_append_announce'); 
    451482    foreach($get_var as $var){ 
    452483      $vars[$var] = isset($_REQUEST[$var])  ? $_REQUEST[$var]   : ''; 
    453484    } 
     485    $vars['timeout_append_announce'] = empty($vars['timeout_append_announce']) ? '0' : '1'; 
     486    $vars['invalid_append_announce'] = empty($vars['invalid_append_announce']) ? '0' : '1'; 
    454487 
    455488    $action   = isset($_REQUEST['action'])  ? $_REQUEST['action'] : ''; 
     
    488521        invalid_destination, invalid_recording, 
    489522        retvm, timeout_time, timeout_recording, 
    490         timeout_retry_recording, timeout_destination, timeout_loops) 
    491         VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; 
     523        timeout_retry_recording, timeout_destination, timeout_loops, 
     524        timeout_append_announce, invalid_append_announce) 
     525        VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; 
    492526    $foo = $db->query($sql, $vals); 
    493527    if($db->IsError($foo)) { 
     
    500534        invalid_destination,  invalid_recording, 
    501535        retvm, timeout_time, timeout_recording, 
    502         timeout_retry_recording, timeout_destination, timeout_loops) 
    503         VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; 
     536        timeout_retry_recording, timeout_destination, timeout_loops, 
     537        timeout_append_announce, invalid_append_announce) 
     538        VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; 
    504539         
    505540    $foo = $db->query($sql, $vals); 
  • modules/branches/2.10/ivr/install.php

    r13091 r13439  
    2323    `timeout_retry_recording` varchar(25) default NULL, 
    2424    `timeout_destination` varchar(50) default NULL, 
    25     `timeout_loops` varchar(10) default NULL)" 
     25    `timeout_loops` varchar(10) default NULL, 
     26    `timeout_append_announce` tinyint(1) NOT NULL default '1', 
     27    `invalid_append_announce` tinyint(1) NOT NULL default '1')" 
    2628  ); 
    2729} else { 
     
    4345    `timeout_destination` varchar(50) default NULL, 
    4446    `timeout_loops` varchar(10) default NULL, 
     47    `timeout_append_announce` tinyint(1) NOT NULL default '1', 
     48    `invalid_append_announce` tinyint(1) NOT NULL default '1', 
    4549    PRIMARY KEY  (`id`))" 
    4650  ); 
     
    423427}  
    424428 
     429// Add timeout/invalid_append_announce if not there 
     430// 
     431outn(_("Checking for timeout_append_announce..")); 
     432$sql = "SELECT timeout_append_announce FROM ivr_details"; 
     433$check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     434if($db->IsError($check)) { 
     435  //  Add timeout_append_announce field 
     436  // 
     437  $sql = "ALTER TABLE ivr_details ADD timeout_append_announce tinyint(1) NOT NULL DEFAULT '1'"; 
     438  $result = $db->query($sql); 
     439  if($db->IsError($result)) { 
     440    out(_("fatal error")); 
     441    die_freepbx($result->getDebugInfo()); 
     442  } else { 
     443    out(_("added")); 
     444  } 
     445} else { 
     446  out(_("not needed")); 
     447} 
     448 
     449outn(_("Checking for invalid_append_announce..")); 
     450$sql = "SELECT invalid_append_announce FROM ivr_details"; 
     451$check = $db->getRow($sql, DB_FETCHMODE_ASSOC); 
     452if($db->IsError($check)) { 
     453  //  Add invalid_append_announce field 
     454  // 
     455  $sql = "ALTER TABLE ivr_details ADD invalid_append_announce tinyint(1) NOT NULL DEFAULT '1'"; 
     456  $result = $db->query($sql); 
     457  if($db->IsError($result)) { 
     458    out(_("fatal error")); 
     459    die_freepbx($result->getDebugInfo()); 
     460  } else { 
     461    out(_("added")); 
     462  } 
     463} else { 
     464  out(_("not needed")); 
     465} 
     466 
    425467?> 
  • modules/branches/2.10/ivr/module.xml

    r13192 r13439  
    33  <repo>standard</repo> 
    44  <name>IVR</name> 
    5   <version>2.10.0.3</version> 
     5  <version>2.10.0.4</version> 
    66  <publisher>FreePBX</publisher> 
    77  <license>GPLv2+</license> 
     
    1111  </description> 
    1212  <changelog> 
     13    *2.10.0.4* #5576 
    1314    *2.10.0.3* #5515 
    1415    *2.10.0.2* misc bug fixes