From 4c2ead3a0b41a62ff01ea699b5d2cece83894f8b Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 28 Sep 2017 16:51:53 -0600 Subject: [PATCH] Update index.lua --- .../install/scripts/app/ring_groups/index.lua | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/resources/install/scripts/app/ring_groups/index.lua b/resources/install/scripts/app/ring_groups/index.lua index 7a0633e3e3..12e4b7f0fb 100644 --- a/resources/install/scripts/app/ring_groups/index.lua +++ b/resources/install/scripts/app/ring_groups/index.lua @@ -340,6 +340,40 @@ end cmd = "user_exists id ".. row.destination_number .." "..leg_domain_name; user_exists = api:executeString(cmd); + if (user_exists == "true") then + --check to see if the destination is forwarded - first forward + cmd = "user_data ".. row.destination_number .."@" ..leg_domain_name.." var forward_all_enabled"; + if (api:executeString(cmd) == "true") then + --get the new destination + cmd = "user_data ".. row.destination_number .."@" ..leg_domain_name.." var forward_all_destination"; + row.destination_number = api:executeString(cmd); + cmd = "user_exists id ".. row.destination_number .." "..leg_domain_name; + user_exists = api:executeString(cmd); + if (user_exists == "true") then + --check to see if the new destination is forwarded - second forward + cmd = "user_data ".. row.destination_number .."@" ..leg_domain_name.." var forward_all_enabled"; + if (api:executeString(cmd) == "true") then + --get the new destination - second forward + cmd = "user_data ".. row.destination_number .."@" ..leg_domain_name.." var forward_all_destination"; + row.destination_number = api:executeString(cmd); + cmd = "user_exists id ".. row.destination_number .." "..leg_domain_name; + user_exists = api:executeString(cmd); + if (user_exists == "true") then + ---check to see if the new destination is forwarded - third forward + cmd = "user_data ".. row.destination_number .."@" ..leg_domain_name.." var forward_all_enabled"; + if (api:executeString(cmd) == "true") then + --get the new destination - third foward + cmd = "user_data ".. row.destination_number .."@" ..leg_domain_name.." var forward_all_destination"; + row.destination_number = api:executeString(cmd); + cmd = "user_exists id ".. row.destination_number .." "..leg_domain_name; + user_exists = api:executeString(cmd); + end + end + end + end + end + end + cmd = "user_exists id ".. row.destination_number .." "..leg_domain_name; if (user_exists == "true") then --add user_exists true or false to the row array row['user_exists'] = "true";