Allow Phrases to be used in IVRs (#4263)

With the current implementation, Phrases cannot be used in IVRs as streamfile.lua prevents keypresses from being passed back to the IVR. This fix makes a small change to the way phrases are stored and allows streamfile to be run without blocking IVR keypresses.
This commit is contained in:
jpattWPC
2019-06-05 22:12:13 -05:00
committed by FusionPBX
parent 4ae27f13b6
commit 3a6dcdd340
2 changed files with 8 additions and 6 deletions

View File

@@ -321,7 +321,7 @@
echo "opt_group.label = \"".$text['label-recordings']."\";\n";
foreach ($recordings as &$row) {
if ($_SESSION['recordings']['storage_type']['text'] == 'base64') {
echo "opt_group.appendChild(new Option(\"".escape($row["recording_name"])."\", \"lua(streamfile.lua ".escape($row["recording_filename"]).")\"));\n";
echo "opt_group.appendChild(new Option(\"".escape($row["recording_name"])."\", \"\${lua streamfile.lua ".escape($row["recording_filename"])."}\"));\n";
}
else {
echo "opt_group.appendChild(new Option(\"".escape($row["recording_name"])."\", \"".$_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.escape($row["recording_filename"])."\"));\n";
@@ -461,10 +461,10 @@
if (is_array($phrase_details)) {
foreach($phrase_details as $field) {
//clean up output for display
if ($field['phrase_detail_function'] == 'execute' && substr($field['phrase_detail_data'], 0, 19) == 'lua(streamfile.lua ') {
if ($field['phrase_detail_function'] == 'play-file' && substr($field['phrase_detail_data'], 0, 21) == '${lua streamfile.lua ') {
$phrase_detail_function = $text['label-play'];
$phrase_detail_data = str_replace('lua(streamfile.lua ', '', $field['phrase_detail_data']);
$phrase_detail_data = str_replace(')', '', $phrase_detail_data);
$phrase_detail_data = str_replace('${lua streamfile.lua ', '', $field['phrase_detail_data']);
$phrase_detail_data = str_replace('}', '', $phrase_detail_data);
}
elseif ($field['phrase_detail_function'] == 'execute' && substr($field['phrase_detail_data'], 0, 6) == 'sleep(') {
$phrase_detail_function = $text['label-pause'];

View File

@@ -98,8 +98,8 @@
or file_name
end
--stream file if exists
if (session:ready()) then
--stream file if exists, If being called by luarun output filename to stream
if (session:ready() and stream == nil) then
session:answer();
local slept = session:getVariable("slept");
if (slept == nil or slept == "false") then
@@ -112,6 +112,8 @@
session:setInputCallback("on_dtmf", "");
session:streamFile(file_name);
session:unsetInputCallback();
else
stream:write(file_name);
end
--if base64, remove temp file (increases responsiveness when files remain local)