Voicemail-to-Email: Add custom headers containing domain_uuid, domain_name, call_uuid and email_type. Send email using Domain smtp settings, if defined under Default Settings.
This commit is contained in:
@@ -87,6 +87,12 @@
|
||||
moderator_pin = string.lower(row["moderator_pin"]);
|
||||
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":"na",';
|
||||
headers = headers..'"X-FusionPBX-Email-Type":"conference"}';
|
||||
|
||||
--prepare the subject
|
||||
local f = io.open(file_subject, "r");
|
||||
local subject = f:read("*all");
|
||||
@@ -118,9 +124,9 @@
|
||||
|
||||
--send the email
|
||||
if (string.len(attachment) > 4) then
|
||||
cmd = "luarun email.lua "..email.." "..email.." '"..subject.."' '"..body.."' '"..attachment.."'";
|
||||
cmd = "luarun email.lua "..email.." "..email.." '"..headers.."' '"..subject.."' '"..body.."' '"..attachment.."'";
|
||||
else
|
||||
cmd = "luarun email.lua "..email.." "..email.." '"..subject.."' '"..body.."'";
|
||||
cmd = "luarun email.lua "..email.." "..email.." '"..headers.."' '"..subject.."' '"..body.."'";
|
||||
end
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("notice", "[voicemail] cmd: " .. cmd .. "\n");
|
||||
|
||||
@@ -84,6 +84,12 @@
|
||||
file_body = scripts_dir.."/app/voicemail/resources/templates/en/us/email_body.tpl";
|
||||
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":"voicemail"}';
|
||||
|
||||
--prepare the subject
|
||||
local f = io.open(file_subject, "r");
|
||||
local subject = f:read("*all");
|
||||
@@ -124,9 +130,9 @@
|
||||
delete = "false";
|
||||
end
|
||||
file = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext;
|
||||
cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." '"..subject.."' '"..body.."' '"..file.."' "..delete;
|
||||
cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." "..headers.." '"..subject.."' '"..body.."' '"..file.."' "..delete;
|
||||
else
|
||||
cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." '"..subject.."' '"..body.."'";
|
||||
cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." "..headers.." '"..subject.."' '"..body.."'";
|
||||
end
|
||||
if (debug["info"]) then
|
||||
freeswitch.consoleLog("notice", "[voicemail] cmd: " .. cmd .. "\n");
|
||||
|
||||
@@ -42,12 +42,13 @@
|
||||
script_name = argv[0];
|
||||
to = argv[1];
|
||||
from = argv[2];
|
||||
subject = argv[3];
|
||||
body = argv[4];
|
||||
file = argv[5];
|
||||
delete = argv[6];
|
||||
--convert_cmd = argv[7];
|
||||
--convert_ext = argv[8];
|
||||
headers = argv[3];
|
||||
subject = argv[4];
|
||||
body = argv[5];
|
||||
file = argv[6];
|
||||
delete = argv[7];
|
||||
--convert_cmd = argv[8];
|
||||
--convert_ext = argv[9];
|
||||
|
||||
--replace the ' with a single quote
|
||||
body = body:gsub("'", "'");
|
||||
@@ -59,21 +60,21 @@
|
||||
if (file == nil) then
|
||||
freeswitch.email("",
|
||||
"",
|
||||
"To: "..to.."\nFrom: "..from.."\nSubject: "..subject,
|
||||
"To: "..to.."\nFrom: "..from.."\nX-Headers: "..headers.."\nSubject: "..subject,
|
||||
body
|
||||
);
|
||||
else
|
||||
if (convert_cmd == nil) then
|
||||
freeswitch.email("",
|
||||
"",
|
||||
"To: "..to.."\nFrom: "..from.."\nSubject: "..subject,
|
||||
"To: "..to.."\nFrom: "..from.."\nX-Headers: "..headers.."\nSubject: "..subject,
|
||||
body,
|
||||
file
|
||||
);
|
||||
else
|
||||
freeswitch.email("",
|
||||
"",
|
||||
"To: "..to.."\nFrom: "..from.."\nSubject: "..subject,
|
||||
"To: "..to.."\nFrom: "..from.."\nX-Headers: "..headers.."\nSubject: "..subject,
|
||||
body,
|
||||
file,
|
||||
convert_cmd,
|
||||
|
||||
Reference in New Issue
Block a user