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("\n", "");
body = body:gsub("\n", "");
body = body:gsub("'", "'");
body = body:gsub([["]], """);
body = trim(body);
--send the email
file = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext;
if (voicemail_file == "attach") then
if (voicemail_local_after_email == "false") then
delete = "true";
else
delete = "false";
end
cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." "..headers.." '"..subject.."' '"..body.."' '"..file.."' "..delete;
freeswitch.email("",
"",
"To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nX-Headers: "..headers.."\nSubject: "..subject,
body,
file
);
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
if (debug["info"]) then
freeswitch.consoleLog("notice", "[voicemail] cmd: " .. cmd .. "\n");
end
result = api:executeString(cmd);
end
--whether to keep the voicemail message and details local after email