Additional work on voicemail with base64.
This commit is contained in:
parent
949b2ec3fe
commit
93dffec059
|
|
@ -122,6 +122,28 @@
|
|||
domain_uuid = string.lower(domain_uuid);
|
||||
end
|
||||
|
||||
--settings
|
||||
dofile(scripts_dir.."/resources/functions/settings.lua");
|
||||
settings = settings(domain_uuid);
|
||||
storage_type = "";
|
||||
if (settings['voicemail']['storage_type'] ~= nil) then
|
||||
if (settings['voicemail']['storage_type']['text'] ~= nil) then
|
||||
storage_type = settings['voicemail']['storage_type']['text'];
|
||||
end
|
||||
end
|
||||
storage_path = "";
|
||||
if (settings['voicemail']['storage_path'] ~= nil) then
|
||||
if (settings['voicemail']['storage_path']['text'] ~= nil) then
|
||||
storage_path = settings['voicemail']['storage_path']['text'];
|
||||
end
|
||||
end
|
||||
temp_dir = "";
|
||||
if (settings['server']['temp'] ~= nil) then
|
||||
if (settings['server']['temp']['dir'] ~= nil) then
|
||||
temp_dir = settings['server']['temp']['dir'];
|
||||
end
|
||||
end
|
||||
|
||||
--if voicemail_id is non numeric then get the number-alias
|
||||
if (voicemail_id ~= nil) then
|
||||
if tonumber(voicemail_id) == nil then
|
||||
|
|
@ -322,12 +344,14 @@
|
|||
dofile(scripts_dir.."/resources/functions/base64.lua");
|
||||
|
||||
--base64 encode the file
|
||||
if (file_exists(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext)) then
|
||||
local f = io.open(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, "rb");
|
||||
local file_content = f:read("*all");
|
||||
f:close();
|
||||
message_base64 = base64.encode(file_content);
|
||||
--freeswitch.consoleLog("notice", "[voicemail] ".. message_base64 .. "\n");
|
||||
end
|
||||
end
|
||||
|
||||
--get the voicemail destinations
|
||||
sql = [[select * from v_voicemail_destinations
|
||||
|
|
|
|||
|
|
@ -59,13 +59,12 @@
|
|||
|
||||
--get the recordings from the database
|
||||
if (storage_type == "base64") then
|
||||
if (string.len(ivr_menu_greet_long) > 1) then
|
||||
sql = [[SELECT * FROM v_voicemail_messages
|
||||
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
||||
AND voicemail_message_uuid = ']].. uuid.. [[' ]];
|
||||
--if (debug["sql"]) then
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[ivr_menu] SQL: " .. sql .. "\n");
|
||||
--end
|
||||
end
|
||||
status = dbh:query(sql, function(row)
|
||||
--add functions
|
||||
dofile(scripts_dir.."/resources/functions/base64.lua");
|
||||
|
|
@ -80,7 +79,6 @@
|
|||
file:close();
|
||||
end
|
||||
end);
|
||||
end
|
||||
elseif (storage_type == "http_cache") then
|
||||
message_location = storage_path.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext;
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue