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 --play the greeting
session:streamFile(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".wav"); session:streamFile(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".wav");
--delete the greeting
os.remove(voicemail_dir.."/"..voicemail_id.."/greeting_"..greeting_id..".wav");
end); end);
elseif (storage_type == "http_cache") then elseif (storage_type == "http_cache") then
session:streamFile(storage_path.."/"..voicemail_id.."/greeting_"..greeting_id..".wav"); session:streamFile(storage_path.."/"..voicemail_id.."/greeting_"..greeting_id..".wav");

View File

@ -53,7 +53,7 @@
if (string.len(voicemail_mail_to) > 2) then if (string.len(voicemail_mail_to) > 2) then
--include languages file --include languages file
dofile(scripts_dir.."/app/voicemail/app_languages.lua"); dofile(scripts_dir.."/app/voicemail/app_languages.lua");
--get voicemail message details --get voicemail message details
sql = [[SELECT * FROM v_voicemail_messages sql = [[SELECT * FROM v_voicemail_messages
WHERE domain_uuid = ']] .. domain_uuid ..[[' WHERE domain_uuid = ']] .. domain_uuid ..[['
@ -70,6 +70,21 @@
message_length = row["message_length"]; message_length = row["message_length"];
--message_status = row["message_status"]; --message_status = row["message_status"];
--message_priority = row["message_priority"]; --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); end);
--format the message length and date --format the message length and date
@ -148,7 +163,6 @@
freeswitch.consoleLog("notice", "[voicemail] cmd: " .. cmd .. "\n"); freeswitch.consoleLog("notice", "[voicemail] cmd: " .. cmd .. "\n");
end end
result = api:executeString(cmd); result = api:executeString(cmd);
end end
--whether to keep the voicemail message and details local after email --whether to keep the voicemail message and details local after email
@ -166,11 +180,17 @@
--delete voicemail recording file --delete voicemail recording file
if (file_exists(file)) then if (file_exists(file)) then
os.remove(file); os.remove(file);
end end
--set message waiting indicator --set message waiting indicator
message_waiting(id, domain_uuid); message_waiting(id, domain_uuid);
--clear the variable --clear the variable
db_voicemail_uuid = ''; db_voicemail_uuid = '';
end end
end end
end if (storage_type == "base64") then
--delete voicemail recording file
if (file_exists(file)) then
os.remove(file);
end
end
end