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:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user