Remove trailing spaces and add a sleep.

This commit is contained in:
Mark J Crane 2020-09-26 01:16:08 +00:00
parent 462da0a3e2
commit 78f50121dd
3 changed files with 19 additions and 17 deletions

View File

@ -37,7 +37,7 @@
session:answer();
session:execute("sleep", "1000");
end
--new voicemail count
if (session:ready()) then
local sql = [[SELECT count(*) as new_messages FROM v_voicemail_messages
@ -51,7 +51,7 @@
dbh:query(sql, params, function(row)
new_messages = row["new_messages"];
end);
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 300, "#", "phrase:voicemail_message_count:" .. new_messages .. ":new", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 300, "#", "phrase:voicemail_message_count:" .. new_messages .. ":new", "", "\\d+");
end
--saved voicemail count
if (session:ready()) then
@ -67,26 +67,26 @@
dbh:query(sql, params, function(row)
saved_messages = row["saved_messages"];
end);
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 300, "#", "phrase:voicemail_message_count:" .. saved_messages .. ":saved", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 300, "#", "phrase:voicemail_message_count:" .. saved_messages .. ":saved", "", "\\d+");
end
end
--to listen to new message
if (session:ready() and new_messages ~= '0') then
if (string.len(dtmf_digits) == 0) then
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 100, "#", "phrase:voicemail_main_menu:new:1", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 100, "#", "phrase:voicemail_main_menu:new:1", "", "\\d+");
end
end
--to listen to saved message
if (session:ready() and saved_messages ~= '0') then
if (string.len(dtmf_digits) == 0) then
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 100, "#", "phrase:voicemail_main_menu:saved:2", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 100, "#", "phrase:voicemail_main_menu:saved:2", "", "\\d+");
end
end
--for advanced options
if (session:ready()) then
if (string.len(dtmf_digits) == 0) then
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 3000, "#", "phrase:voicemail_main_menu:advanced:5", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 3000, "#", "phrase:voicemail_main_menu:advanced:5", "", "\\d+");
end
end
--to exit press #

View File

@ -33,12 +33,14 @@
--to listen to the recording press 1, to save the recording press 2, to re-record press 3
if (session:ready()) then
if (string.len(dtmf_digits) == 0) then
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 3000, "#", "phrase:voicemail_record_file_options:1:2:3", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 3000, "#", "phrase:voicemail_record_file_options:1:2:3", "", "\\d+");
end
end
--process the dtmf
if (session:ready()) then
if (dtmf_digits == "1") then
--use sleep for a small pause
session:sleep('1000');
--listen to the recording
session:streamFile(tmp_file);
--session:streamFile(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext);
@ -226,8 +228,8 @@
advanced();
end
if (menu == "tutorial") then
tutorial("change_password")
end
tutorial("change_password");
end
end
end
end

View File

@ -35,7 +35,7 @@
--play the tutorial press 1, to skip 2
if (session:ready()) then
if (string.len(dtmf_digits) == 0) then
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 3000, "#", "phrase:tutorial_intro", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 3000, "#", "phrase:tutorial_intro", "", "\\d+");
end
end
--process the dtmf
@ -68,13 +68,13 @@
--play the record name press 1
if (session:ready()) then
if (string.len(dtmf_digits) == 0) then
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 200, "#", "phrase:tutorial_record_name:1", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 200, "#", "phrase:tutorial_record_name:1", "", "\\d+");
end
end
--skip the name and go to password press 2
if (session:ready()) then
if (string.len(dtmf_digits) == 0) then
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 3000, "#", "phrase:tutorial_skip:2", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 3000, "#", "phrase:tutorial_skip:2", "", "\\d+");
end
end
--process the dtmf
@ -96,7 +96,7 @@
end
end
end
end
end
--change password menu
if (menu == "change_password") then
--clear the value
@ -106,13 +106,13 @@
--to change your password press 1
if (session:ready()) then
if (string.len(dtmf_digits) == 0) then
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 200, "#", "phrase:tutorial_change_password:1", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 200, "#", "phrase:tutorial_change_password:1", "", "\\d+");
end
end
--skip the password and go to greeting press 2
if (session:ready()) then
if (string.len(dtmf_digits) == 0) then
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 3000, "#", "phrase:tutorial_skip:2", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 3000, "#", "phrase:tutorial_skip:2", "", "\\d+");
end
end
--process the dtmf
@ -144,13 +144,13 @@
--to record a greeting press 1
if (session:ready()) then
if (string.len(dtmf_digits) == 0) then
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 200, "#", "phrase:tutorial_record_greeting:1", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 200, "#", "phrase:tutorial_record_greeting:1", "", "\\d+");
end
end
--skip the record greeting press 2. finishes the tutorial and routes to main menu
if (session:ready()) then
if (string.len(dtmf_digits) == 0) then
dtmf_digits = session:playAndGetDigits(0, 1, max_tries, 3000, "#", "phrase:tutorial_skip:2", "", "\\d+");
dtmf_digits = session:playAndGetDigits(0, 1, 1, 3000, "#", "phrase:tutorial_skip:2", "", "\\d+");
end
end
--process the dtmf