Ring Groups with Follow-Me (#3970)

Two things:

1. Follow-me should only kick in when using "Enterprise". As it was written, follow-me was looked at for every strategy. 

2. Follow-me destinations were writing to 'destinations[x]'. They should write to 'destinations[key]' so they rewrite the current destination that is being analyzed.
This commit is contained in:
konradSC
2019-01-22 13:03:28 -05:00
committed by FusionPBX
parent 336232519b
commit a90fc77176

View File

@@ -535,52 +535,54 @@
end
end
---get destination that are using follow me
cmd = "user_data ".. destination_number .."@" ..domain_name.." var follow_me_enabled";
if (api:executeString(cmd) == "true") then
--get the follow me destinations
cmd = "user_data ".. destination_number .."@" ..domain_name.." var follow_me_destinations";
result_follow_me_destinations = api:executeString(cmd);
freeswitch.consoleLog("notice", "[ring groups][follow_me] key " .. key .. " " .. cmd .. " ".. result_follow_me_destinations .."\n");
if (ring_group_strategy == "enterprise") then
---get destination that are using follow me
cmd = "user_data ".. destination_number .."@" ..domain_name.." var follow_me_enabled";
if (api:executeString(cmd) == "true") then
--get the follow me destinations
cmd = "user_data ".. destination_number .."@" ..domain_name.." var follow_me_destinations";
result_follow_me_destinations = api:executeString(cmd);
freeswitch.consoleLog("notice", "[ring groups][follow_me] key " .. key .. " " .. cmd .. " ".. result_follow_me_destinations .."\n");
follow_me_destinations = explode(",[", result_follow_me_destinations);
x = 0;
for k, v in pairs(follow_me_destinations) do
--increment the ordinal value
x = x + 1;
follow_me_destinations = explode(",[", result_follow_me_destinations);
x = 0;
for k, v in pairs(follow_me_destinations) do
--increment the ordinal value
x = x + 1;
--seperate the variables from the destination
destination = explode("]", v);
--seperate the variables from the destination
destination = explode("]", v);
--set the variables and clean the variables string
variables = destination[1];
variables = variables:gsub("%[", "");
--set the variables and clean the variables string
variables = destination[1];
variables = variables:gsub("%[", "");
--send details to the console
freeswitch.consoleLog("notice", "[ring groups][follow_me] variables ".. variables .."\n");
freeswitch.consoleLog("notice", "[ring groups][follow_me] destination ".. destination[2] .."\n");
--send details to the console
freeswitch.consoleLog("notice", "[ring groups][follow_me] variables ".. variables .."\n");
freeswitch.consoleLog("notice", "[ring groups][follow_me] destination ".. destination[2] .."\n");
--add to the destinations array
if destinations[x] == nil then destinations[x] = {} end
destinations[x]['destination_number'] = destination[2];
destinations[x]['domain_name'] = domain_name;
destinations[x]['destination_delay'] = '0';
destinations[x]['destination_timeout'] = '30';
--add to the destinations array
--if destinations[x] == nil then destinations[x] = {} end
destinations[key]['destination_number'] = destination[2];
destinations[key]['domain_name'] = domain_name;
destinations[key]['destination_delay'] = '0';
destinations[key]['destination_timeout'] = '30';
--add the variables to the destinations array
variable_array = explode(",", variables);
for k2, v2 in pairs(variable_array) do
array = explode("=", v2);
if (array[2] ~= nil) then
destinations[x][array[1]] = array[2];
--add the variables to the destinations array
variable_array = explode(",", variables);
for k2, v2 in pairs(variable_array) do
array = explode("=", v2);
if (array[2] ~= nil) then
destinations[key][array[1]] = array[2];
end
end
end
--if confirm is true true then set it to prompt
if (destinations[x]['confirm'] ~= nil and destinations[x]['confirm'] == 'true') then
destinations[x]['destination_prompt'] = '1';
end
--if confirm is true true then set it to prompt
if (destinations[key]['confirm'] ~= nil and destinations[key]['confirm'] == 'true') then
destinations[key]['destination_prompt'] = '1';
end
end
end
end
end