BugFix - make hangup and failure use send_mail() (#2974)

change the failure_handler and hangup apps use
resources.functions.send_mail so they can use the correct smtp_from*
settings
This commit is contained in:
Mafoo
2018-02-02 19:33:30 -07:00
committed by FusionPBX
parent 926995404f
commit 9724c1384e
2 changed files with 31 additions and 16 deletions
@@ -34,6 +34,9 @@
require "resources.functions.trim"; require "resources.functions.trim";
require "resources.functions.base64"; require "resources.functions.base64";
--load libraries
require 'resources.functions.send_mail'
--check the missed calls --check the missed calls
function missed() function missed()
if (missed_call_app ~= nil and missed_call_data ~= nil) then if (missed_call_app ~= nil and missed_call_data ~= nil) then
@@ -55,10 +58,12 @@
end end
--prepare the headers --prepare the headers
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",'; local headers = {
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",'; ["X-FusionPBX-Domain-UUID"] = domain_uuid;
headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",'; ["X-FusionPBX-Domain-Name"] = domain_name;
headers = headers..'"X-FusionPBX-Email-Type":"missed"}'; ["X-FusionPBX-Call-UUID"] = uuid;
["X-FusionPBX-Email-Type"] = 'missed';
}
--prepare the subject --prepare the subject
local f = io.open(file_subject, "r"); local f = io.open(file_subject, "r");
@@ -88,13 +93,15 @@
body = body:gsub([["]], """); body = body:gsub([["]], """);
body = trim(body); body = trim(body);
--send the email --send the emails
cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'"; send_mail(headers,
missed_call_data,
{subject, body}
);
if (debug["info"]) then if (debug["info"]) then
freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n"); freeswitch.consoleLog("notice", "[missed call] " .. caller_id_number .. "->" .. sip_to_user .. "emailed to " .. missed_call_data .. "\n");
end end
api = freeswitch.API();
result = api:executeString(cmd);
end end
end end
end end
+15 -7
View File
@@ -31,6 +31,9 @@
require "resources.functions.base64"; require "resources.functions.base64";
require "resources.functions.file_exists"; require "resources.functions.file_exists";
--load libraries
require 'resources.functions.send_mail'
--create the api object --create the api object
api = freeswitch.API(); api = freeswitch.API();
@@ -55,10 +58,12 @@
end end
--prepare the headers --prepare the headers
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",'; local headers = {
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",'; ["X-FusionPBX-Domain-UUID"] = domain_uuid;
headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",'; ["X-FusionPBX-Domain-Name"] = domain_name;
headers = headers..'"X-FusionPBX-Email-Type":"missed"}'; ["X-FusionPBX-Call-UUID"] = uuid;
["X-FusionPBX-Email-Type"] = 'missed';
}
--prepare the subject --prepare the subject
local f = io.open(file_subject, "r"); local f = io.open(file_subject, "r");
@@ -89,11 +94,14 @@
body = trim(body); body = trim(body);
--send the emails --send the emails
cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'"; send_mail(headers,
missed_call_data,
{subject, body}
);
if (debug["info"]) then if (debug["info"]) then
freeswitch.consoleLog("notice", "[missed call] cmd: " .. cmd .. "\n"); freeswitch.consoleLog("notice", "[missed call] " .. caller_id_number .. "->" .. sip_to_user .. "emailed to " .. missed_call_data .. "\n");
end end
result = api:executeString(cmd);
end end
end end
end end