Add required diversion header
This commit is contained in:
parent
422a9d7eb6
commit
2553caa2b1
|
|
@ -223,6 +223,14 @@
|
|||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "true";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Enable or disable the feature to add a range of extensions.";
|
||||
$y++;
|
||||
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "d25c1e2b-4098-408e-959b-c789ba4691e1";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "ring_group";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "diversion_enabled";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "false";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Enable or disable the adding diversion header for external destinations.";
|
||||
|
||||
//schema details
|
||||
$y=0;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
-- Gill Abada <gill.abada@gmail.com>
|
||||
|
||||
--include the log
|
||||
log = require "resources.functions.log".ring_group
|
||||
log = require "resources.functions.log".ring_group
|
||||
|
||||
--connect to the database
|
||||
local Database = require "resources.functions.database";
|
||||
|
|
@ -244,6 +244,10 @@
|
|||
missed_call_data = row["ring_group_missed_call_data"];
|
||||
end);
|
||||
|
||||
--create the settings object
|
||||
local Settings = require "resources.functions.lazy_settings";
|
||||
local settings = Settings.new(dbh, domain_name, domain_uuid);
|
||||
|
||||
--prepare the recording path
|
||||
record_path = recordings_dir .. "/" .. domain_name .. "/archive/" .. os.date("%Y/%b/%d");
|
||||
record_path = record_path:gsub("\\", "/");
|
||||
|
|
@ -848,7 +852,7 @@
|
|||
dial_string_user = dial_string_user .. group_confirm..","..timeout_name.."="..destination_timeout..",";
|
||||
dial_string_user = dial_string_user .. delay_name.."="..destination_delay..",";
|
||||
dial_string_user = dial_string_user .. "dialed_extension=" .. row.destination_number .. ",";
|
||||
if (hold_music ~= nil) and (string.len(hold_music) > 0) then
|
||||
if (hold_music ~= nil) and (string.len(hold_music) > 0) then
|
||||
dial_string_user = dial_string_user .. "hold_music=" .. hold_music .. ",";
|
||||
end
|
||||
dial_string_user = dial_string_user .. "presence_id=" .. row.destination_number .. "@"..domain_name..",";
|
||||
|
|
@ -901,8 +905,22 @@
|
|||
caller_id = caller_id .. ",origination_caller_id_number="..ring_group_caller_id_number..",";
|
||||
end
|
||||
|
||||
--set the diversion header
|
||||
local diversion_enabled = settings:get('ring_group', 'diversion_enabled', 'boolean') or 'false';
|
||||
if (diversion_enabled == 'true') then
|
||||
if (caller_is_local == 'true' and outbound_caller_id_number ~= nil) then
|
||||
diversion_caller_id = outbound_caller_id_number;
|
||||
end
|
||||
if (ring_group_caller_id_number ~= nil and ring_group_caller_id_number ~= '') then
|
||||
diversion_caller_id = ring_group_caller_id_number;
|
||||
end
|
||||
diversion_header = "sip_h_Diversion=<sip:"..diversion_caller_id.."@"..domain_name..">;reason=unconditional,";
|
||||
else
|
||||
diversion_header = '';
|
||||
end
|
||||
|
||||
--set the destination dial string
|
||||
dial_string = "[toll_allow=".. toll_allow ..",".. caller_id ..",sip_invite_domain="..domain_name..",domain_name="..domain_name..",domain_uuid="..domain_uuid..",call_direction="..call_direction..","..group_confirm..""..timeout_name.."="..destination_timeout..","..delay_name.."="..destination_delay.."]"..route_bridge
|
||||
dial_string = "["..diversion_header.."toll_allow=".. toll_allow ..",".. caller_id ..",sip_invite_domain="..domain_name..",domain_name="..domain_name..",domain_uuid="..domain_uuid..",call_direction="..call_direction..","..group_confirm..""..timeout_name.."="..destination_timeout..","..delay_name.."="..destination_delay.."]"..route_bridge
|
||||
end
|
||||
|
||||
--add a delimiter between destinations
|
||||
|
|
|
|||
Loading…
Reference in New Issue