From 1485437ba8b12a27c8ce07b259a358fb9979c10b Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Thu, 10 Jan 2013 21:59:59 +0000 Subject: [PATCH] Make voicemail.lua use the new email.lua. --- includes/install/scripts/voicemail.lua | 38 ++++++++++++++------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/includes/install/scripts/voicemail.lua b/includes/install/scripts/voicemail.lua index 5dbecc6ed7..3a5b263c4d 100644 --- a/includes/install/scripts/voicemail.lua +++ b/includes/install/scripts/voicemail.lua @@ -768,27 +768,29 @@ end --send the email - message = [[ - Message From "]]..caller_id_name..[[" ]]..caller_id_number..[[
-
- Created: ]]..os.date("%A, %d %b %Y %I:%M %p", start_epoch)..[[
- Duration: ]]..message_length_formatted..[[
- Account: ]]..voicemail_id..[[@]]..domain_name..[[
-
]]; + subject = [[Voicemail from ]]..caller_id_name..[[ <]]..caller_id_number..[[> ]]..message_length_formatted; + local message = {} + table.insert(message, [[]]); + table.insert(message, [[Message From "]]..caller_id_name..[[" ]]..caller_id_number..[[
]]); + table.insert(message, [[
]]); + table.insert(message, [[Created: ]]..os.date("%A, %d %b %Y %I:%M %p", start_epoch)..[[
]]); + table.insert(message, [[Duration: ]]..message_length_formatted..[[
]]); + table.insert(message, [[Account: ]]..voicemail_id..[[@]]..domain_name..[[
]]); + table.insert(message, [[
]]); + body = table.concat(message, ""); + body = body:gsub("'", "'") + body = body:gsub([["]], """) if (voicemail_attach_file == "true") then - freeswitch.email("", - "", - "To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nSubject: Voicemail from "..caller_id_name.." <"..caller_id_number.."> "..message_length_formatted, - message, - voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav" - ); + file = voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav"; + cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." '"..subject.."' '"..body.."' '"..file.."'"; else - freeswitch.email("", - "", - "To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nSubject: Voicemail from "..caller_id_name.." <"..caller_id_number.."> "..message_length_formatted, - message - ); + cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." '"..subject.."' '"..body.."'"; end + api = freeswitch.API(); + if (debug["info"]) then + freeswitch.consoleLog("notice", "[voicemail] cmd: " .. cmd .. "\n"); + end + result = api:executeString(cmd); --emailed if (session:ready()) then