When using base64 after playing the greeting remove the file from the file system. When sending the email get it from the database save it to the file system. Then send the email and afterwards remove it.

This commit is contained in:
Mark Crane
2015-04-18 18:19:22 +00:00
parent 3fb697fccf
commit 1500937808
2 changed files with 27 additions and 4 deletions

View File

@@ -66,6 +66,9 @@
--play the greeting
session:streamFile(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".wav");
--delete the greeting
os.remove(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".wav");
end);
elseif (storage_type == "http_cache") then
session:streamFile(storage_path.."/"..voicemail_id.."/greeting_"..greeting_id..".wav");

View File

@@ -53,7 +53,7 @@
if (string.len(voicemail_mail_to) > 2) then
--include languages file
dofile(scripts_dir.."/app/voicemail/app_languages.lua");
--get voicemail message details
sql = [[SELECT * FROM v_voicemail_messages
WHERE domain_uuid = ']] .. domain_uuid ..[['
@@ -70,6 +70,21 @@
message_length = row["message_length"];
--message_status = row["message_status"];
--message_priority = row["message_priority"];
--get the recordings from the database
if (storage_type == "base64") then
--add functions
dofile(scripts_dir.."/resources/functions/base64.lua");
--set the voicemail message path
message_location = voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext;
--save the recording to the file system
if (string.len(row["message_base64"]) > 32) then
local f = io.open(message_location, "w");
f:write(base64.decode(row["message_base64"]));
f:close();
end
end
end);
--format the message length and date
@@ -148,7 +163,6 @@
freeswitch.consoleLog("notice", "[voicemail] cmd: " .. cmd .. "\n");
end
result = api:executeString(cmd);
end
--whether to keep the voicemail message and details local after email
@@ -166,11 +180,17 @@
--delete voicemail recording file
if (file_exists(file)) then
os.remove(file);
end
end
--set message waiting indicator
message_waiting(id, domain_uuid);
--clear the variable
db_voicemail_uuid = '';
end
end
end
if (storage_type == "base64") then
--delete voicemail recording file
if (file_exists(file)) then
os.remove(file);
end
end
end