improve emergency emailing (#7309)
* improve emergency emailing 1. set emergency CID name & number to the outbound CID name & number if emergency CID name & number are not set 2. remove duplicate item in email body 3. change the hardcoded email subject '911 Emergency Call' to be dynamically provided from the event. I do not like seeing the subject '911 Emergency Call' when it is an TEST call. * improve emergency emailing 1. change the hardcoded email subject '911 Emergency Call' to be dynamically provided from the event. I do not like seeing the subject '911 Emergency Call' when it is an TEST call. 2. fix email template misspelling 3. improved email template with bold fonts
This commit is contained in:
parent
31a88e3a15
commit
95761621a6
|
|
@ -118,13 +118,18 @@ if (session and session:ready()) then
|
|||
sip_from_user = session:getVariable("sip_from_user");
|
||||
emergency_caller_id_name = session:getVariable("emergency_caller_id_name");
|
||||
emergency_caller_id_number = session:getVariable("emergency_caller_id_number");
|
||||
outbound_caller_id_name = session:getVariable("outbound_caller_id_name");
|
||||
outbound_caller_id_number = session:getVariable("outbound_caller_id_number");
|
||||
destination_number = session:getVariable("destination_number");
|
||||
end
|
||||
|
||||
--set the defaults
|
||||
if (not emergency_caller_id_name) then emergency_caller_id_name = ''; end
|
||||
if (not emergency_caller_id_number) then emergency_caller_id_number = '' end
|
||||
if (not emergency_caller_id_name or emergency_caller_id_name == '') then
|
||||
emergency_caller_id_name = outbound_caller_id_name
|
||||
end
|
||||
if (not emergency_caller_id_number or emergency_caller_id_number == '') then
|
||||
emergency_caller_id_number = outbound_caller_id_number
|
||||
end
|
||||
|
||||
--no emergency emails found under domain, using default
|
||||
local sql = "SELECT default_setting_value ";
|
||||
|
|
@ -181,6 +186,9 @@ end
|
|||
local t = dbh:first_row(sql);
|
||||
call_date = t.call_date;
|
||||
|
||||
-- replace the hardcoded template subject with the event
|
||||
subject = event;
|
||||
|
||||
--send the email
|
||||
if (#to > 0) then
|
||||
--prepare the body
|
||||
|
|
@ -190,7 +198,6 @@ if (#to > 0) then
|
|||
body = body:gsub("${emergency_caller_id_name}", emergency_caller_id_name);
|
||||
body = body:gsub("${emergency_caller_id_number}", emergency_caller_id_number);
|
||||
body = body:gsub("${sip_from_user}", sip_from_user);
|
||||
body = body:gsub("${caller_id_number}", caller_id_number);
|
||||
body = body:gsub("${message_date}", call_date);
|
||||
body = body:gsub("${event}", event);
|
||||
body = trim(body);
|
||||
|
|
|
|||
|
|
@ -510,15 +510,15 @@
|
|||
$array['email_templates'][$x]['template_language'] = 'en-gb';
|
||||
$array['email_templates'][$x]['template_category'] = 'plugin';
|
||||
$array['email_templates'][$x]['template_subcategory'] = 'emergency';
|
||||
$array['email_templates'][$x]['template_subject'] = '911 Emergency Call';
|
||||
$array['email_templates'][$x]['template_subject'] = '\${event}';
|
||||
$array['email_templates'][$x]['template_body'] = "<html>\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<body>\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "From \${caller_id_name} <a href=\"tel:\${caller_id_number}\">\${caller_id_number}</a><br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<strong>From:</strong> \${caller_id_name} <a href=\"tel:\${caller_id_number}\">\${caller_id_number}</a><br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "Emergency Name \${emergency_caller_id_name}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "Emergency Name \${emergency_caller_id_number}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "Received \${message_date}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "Event \${event}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<strong>Emergency Name:</strong> \${emergency_caller_id_name}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<strong>Emergency Number:</strong> \${emergency_caller_id_number}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<strong>Received:</strong> \${message_date}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<strong>Event:</strong> \${event}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "</body>\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "</html>\n";
|
||||
$array['email_templates'][$x]['template_type'] = 'html';
|
||||
|
|
@ -530,15 +530,15 @@
|
|||
$array['email_templates'][$x]['template_language'] = 'en-us';
|
||||
$array['email_templates'][$x]['template_category'] = 'plugin';
|
||||
$array['email_templates'][$x]['template_subcategory'] = 'emergency';
|
||||
$array['email_templates'][$x]['template_subject'] = '911 Emergency Call';
|
||||
$array['email_templates'][$x]['template_subject'] = '\${event}';
|
||||
$array['email_templates'][$x]['template_body'] = "<html>\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<body>\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "From \${caller_id_name} <a href=\"tel:\${caller_id_number}\">\${caller_id_number}</a><br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<strong>From:</strong> \${caller_id_name} <a href=\"tel:\${caller_id_number}\">\${caller_id_number}</a><br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "Emergency Name \${emergency_caller_id_name}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "Emergency Name \${emergency_caller_id_number}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "Received \${message_date}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "Event \${event}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<strong>Emergency Name:</strong> \${emergency_caller_id_name}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<strong>Emergency Number:</strong> \${emergency_caller_id_number}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<strong>Received:</strong> \${message_date}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "<strong>Event:</strong> \${event}<br />\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "</body>\n";
|
||||
$array['email_templates'][$x]['template_body'] .= "</html>\n";
|
||||
$array['email_templates'][$x]['template_type'] = 'html';
|
||||
|
|
|
|||
Loading…
Reference in New Issue