Additional work on voicemail with base64.

This commit is contained in:
Mark Crane
2015-04-17 20:10:36 +00:00
parent 949b2ec3fe
commit 93dffec059
2 changed files with 48 additions and 26 deletions
@@ -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,11 +344,13 @@
dofile(scripts_dir.."/resources/functions/base64.lua");
--base64 encode the file
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");
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