Voicemail: Default/Domain Settings to control CID Number and Date & Time playback/order.

This commit is contained in:
fusionate
2023-01-27 22:17:51 +00:00
parent c4b8c7add1
commit 107b8a48f2
8 changed files with 120 additions and 18 deletions

View File

@@ -99,7 +99,7 @@
if (effective_caller_id_name ~= nil) then
caller_id_name = effective_caller_id_name;
end
--set default values
if (string.sub(caller_id_number, 1, 1) == "/") then
caller_id_number = string.sub(caller_id_number, 2, -1);
@@ -113,12 +113,6 @@
if (not vm_message_ext) then
vm_message_ext = 'wav';
end
if (not vm_say_caller_id_number) then
vm_say_caller_id_number = "true";
end
if (not vm_say_date_time) then
vm_say_date_time = "true";
end
--set the sounds path for the language, dialect and voice
default_language = session:getVariable("default_language");
@@ -188,6 +182,26 @@
end
end
if (not vm_say_caller_id_number) then
if (settings['voicemail']['message_caller_id_number'] ~= nil) then
if (settings['voicemail']['message_caller_id_number']['text'] ~= nil) then
vm_say_caller_id_number = settings['voicemail']['message_caller_id_number']['text'];
end
end
else
vm_say_caller_id_number = "before";
end
if (not vm_say_date_time) then
if (settings['voicemail']['message_date_time'] ~= nil) then
if (settings['voicemail']['message_date_time']['text'] ~= nil) then
vm_say_date_time = settings['voicemail']['message_date_time']['text'];
end
end
else
vm_say_date_time = "before";
end
remote_access = '';
if (settings['voicemail']['remote_access'] ~= nil) then
if (settings['voicemail']['remote_access']['boolean'] ~= nil) then
@@ -400,7 +414,7 @@
--send to the main menu
timeouts = 0;
if (voicemail_tutorial == "true") then
if (voicemail_tutorial == "true") then
tutorial("intro");
else
main_menu();
@@ -479,7 +493,7 @@
--freeswitch.consoleLog("notice", "[voicemail][destinations] SQL:" .. sql .. "; params:" .. json.encode(params) .. "\n");
destinations = {};
x = 1;
dbh:query(sql, params, function(row)
destinations[x] = row;
x = x + 1;
@@ -487,12 +501,12 @@
table.insert(destinations, {domain_uuid=domain_uuid,voicemail_destination_uuid=voicemail_uuid,voicemail_uuid=voicemail_uuid,voicemail_uuid_copy=voicemail_uuid});
--show the storage type
freeswitch.consoleLog("notice", "[voicemail] ".. storage_type .. "\n");
count = 0
for k,v in pairs(destinations) do
count = count + 1
end
--loop through the voicemail destinations
y = 1;
for key,row in pairs(destinations) do

View File

@@ -56,7 +56,8 @@
session:ready() and
caller_id_number ~= nil and (
vm_say_caller_id_number == nil or
vm_say_caller_id_number == "true"
vm_say_caller_id_number == "true" or
vm_say_caller_id_number == "before"
)) then
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-from.wav");
session:say(caller_id_number, default_language, "name_spelled", "iterated");
@@ -67,7 +68,8 @@
session:ready() and
string.len(dtmf_digits) == 0 and (
vm_say_date_time == nil or
vm_say_date_time == "true"
vm_say_date_time == "true" or
vm_say_date_time == "before"
)) then
if (current_time_zone ~= nil) then
session:execute("set", "timezone="..current_time_zone.."");
@@ -117,7 +119,7 @@
if (mime_type == 'audio/mpeg') then
vm_message_ext = 'mp3';
end
--rename the file
os.execute('mv '..message_location..' '..message_location..'.'..vm_message_ext);
end);
@@ -197,8 +199,10 @@
session:ready() and
caller_id_number ~= nil and
vm_say_caller_id_number ~= nil and
vm_say_caller_id_number == "last"
) then
(
vm_say_caller_id_number == "last" or
vm_say_caller_id_number == "after"
)) then
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-from.wav");
session:say(caller_id_number, default_language, "name_spelled", "iterated");
end
@@ -208,8 +212,10 @@
session:ready() and
string.len(dtmf_digits) == 0 and
vm_say_date_time ~= nil and
vm_say_date_time == "last"
) then
(
vm_say_date_time == "last" or
vm_say_date_time == "after"
)) then
if (current_time_zone ~= nil) then
session:execute("set", "timezone="..current_time_zone.."");
end