From d283075d64698577e98a729c40e22db36d183d8c Mon Sep 17 00:00:00 2001 From: markjcrane Date: Mon, 20 Jul 2015 11:40:31 -0600 Subject: [PATCH] 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. --- .../resources/functions/send_email.lua | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/resources/install/scripts/app/voicemail/resources/functions/send_email.lua b/resources/install/scripts/app/voicemail/resources/functions/send_email.lua index 84c7751870..b2f0fe5867 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/send_email.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/send_email.lua @@ -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