mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-05 19:23:49 +00:00
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.base64";
|
||||
|
||||
--load libraries
|
||||
require 'resources.functions.send_mail'
|
||||
|
||||
--check the missed calls
|
||||
function missed()
|
||||
if (missed_call_app ~= nil and missed_call_data ~= nil) then
|
||||
@@ -55,10 +58,12 @@
|
||||
end
|
||||
|
||||
--prepare the headers
|
||||
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
|
||||
headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Email-Type":"missed"}';
|
||||
local headers = {
|
||||
["X-FusionPBX-Domain-UUID"] = domain_uuid;
|
||||
["X-FusionPBX-Domain-Name"] = domain_name;
|
||||
["X-FusionPBX-Call-UUID"] = uuid;
|
||||
["X-FusionPBX-Email-Type"] = 'missed';
|
||||
}
|
||||
|
||||
--prepare the subject
|
||||
local f = io.open(file_subject, "r");
|
||||
@@ -88,13 +93,15 @@
|
||||
body = body:gsub([["]], """);
|
||||
body = trim(body);
|
||||
|
||||
--send the email
|
||||
cmd = "luarun email.lua "..missed_call_data.." "..missed_call_data.." "..headers.." '"..subject.."' '"..body.."'";
|
||||
--send the emails
|
||||
send_mail(headers,
|
||||
missed_call_data,
|
||||
{subject, body}
|
||||
);
|
||||
|
||||
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
|
||||
api = freeswitch.API();
|
||||
result = api:executeString(cmd);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
require "resources.functions.base64";
|
||||
require "resources.functions.file_exists";
|
||||
|
||||
--load libraries
|
||||
require 'resources.functions.send_mail'
|
||||
|
||||
--create the api object
|
||||
api = freeswitch.API();
|
||||
|
||||
@@ -55,10 +58,12 @@
|
||||
end
|
||||
|
||||
--prepare the headers
|
||||
headers = '{"X-FusionPBX-Domain-UUID":"'..domain_uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Domain-Name":"'..domain_name..'",';
|
||||
headers = headers..'"X-FusionPBX-Call-UUID":"'..uuid..'",';
|
||||
headers = headers..'"X-FusionPBX-Email-Type":"missed"}';
|
||||
local headers = {
|
||||
["X-FusionPBX-Domain-UUID"] = domain_uuid;
|
||||
["X-FusionPBX-Domain-Name"] = domain_name;
|
||||
["X-FusionPBX-Call-UUID"] = uuid;
|
||||
["X-FusionPBX-Email-Type"] = 'missed';
|
||||
}
|
||||
|
||||
--prepare the subject
|
||||
local f = io.open(file_subject, "r");
|
||||
@@ -89,11 +94,14 @@
|
||||
body = trim(body);
|
||||
|
||||
--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
|
||||
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
|
||||
result = api:executeString(cmd);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user