Voicemail to email send the email in the send_email.lua rather than with email.lua. So that the delete doesn't occur until after email is sent.

This commit is contained in:
markjcrane 2015-07-20 11:40:31 -06:00
parent 6b48f88955
commit d283075d64
1 changed files with 11 additions and 13 deletions

View File

@ -143,26 +143,24 @@
body = body:gsub(" ", " "); body = body:gsub(" ", " ");
body = body:gsub("\n", ""); body = body:gsub("\n", "");
body = body:gsub("\n", ""); body = body:gsub("\n", "");
body = body:gsub("'", "'");
body = body:gsub([["]], """);
body = trim(body); body = trim(body);
--send the email --send the email
file = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext; file = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext;
if (voicemail_file == "attach") then if (voicemail_file == "attach") then
if (voicemail_local_after_email == "false") then freeswitch.email("",
delete = "true"; "",
else "To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nX-Headers: "..headers.."\nSubject: "..subject,
delete = "false"; body,
end file
cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." "..headers.." '"..subject.."' '"..body.."' '"..file.."' "..delete; );
else else
cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." "..headers.." '"..subject.."' '"..body.."'"; freeswitch.email("",
"",
"To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nX-Headers: "..headers.."\nSubject: "..subject,
body
);
end end
if (debug["info"]) then
freeswitch.consoleLog("notice", "[voicemail] cmd: " .. cmd .. "\n");
end
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