From 9adb11398d66b1f0f5d70030c9d127a1743a5b0c Mon Sep 17 00:00:00 2001 From: konradSC Date: Tue, 9 Jan 2018 17:08:28 -0500 Subject: [PATCH] Fix for Ring Groups with cfwd always & toll_allow (#2952) This scenario was broken: A ring group member forwards their phone to a destination. The destination is an external number and the outbound route had a toll_allow condition. This error would be generated: [ERR] switch_cpp.cpp:1376 [route_to_bridge] Unsupportded condition: ${toll_allow} This PR will get the toll_allow values from the RG member that is forwarding their phone. Then it will pass it to 'route_to_bridge.lua'. --- .../install/scripts/app/ring_groups/index.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/resources/install/scripts/app/ring_groups/index.lua b/resources/install/scripts/app/ring_groups/index.lua index 23efcca4c7..99214c581b 100644 --- a/resources/install/scripts/app/ring_groups/index.lua +++ b/resources/install/scripts/app/ring_groups/index.lua @@ -327,18 +327,22 @@ ---check to see if the new destination is forwarded - third forward cmd = "user_data ".. destination_number .."@" ..domain_name.." var forward_all_enabled"; if (api:executeString(cmd) == "true") then + --get the toll_allow var + cmd = "user_data ".. destination_number .."@" ..leg_domain_name.." var toll_allow"; + toll_allow = api:executeString(cmd); + freeswitch.consoleLog("notice", "[ring groups][call forward all] " .. destination_number .. " toll_allow is ".. toll_allow .."\n"); + --get the new destination - third foward cmd = "user_data ".. destination_number .."@" ..domain_name.." var forward_all_destination"; destination_number = api:executeString(cmd); freeswitch.consoleLog("notice", "[ring groups][call forward all] " .. count .. " " .. cmd .. " ".. destination_number .."\n"); - count = count + 1; if (count < 5) then count, destination_number = get_forward_all(count, destination_number, domain_name); end end end - return count, destination_number; + return count, destination_number, toll_allow; end --process the ring group @@ -409,8 +413,11 @@ end --follow the forwards - count, destination_number = get_forward_all(0, row.destination_number, leg_domain_name); + count, destination_number, toll_allow = get_forward_all(0, row.destination_number, leg_domain_name); + + --update values row['destination_number'] = destination_number + row['toll_allow'] = toll_allow; --check if the user exists cmd = "user_exists id ".. destination_number .." "..domain_name; @@ -485,6 +492,7 @@ destination_timeout = row.destination_timeout; destination_prompt = row.destination_prompt; domain_name = row.domain_name; + toll_allow = row.toll_allow; --follow the forwards count, destination_number = get_forward_all(0, destination_number, leg_domain_name); @@ -626,6 +634,7 @@ domain_uuid = domain_uuid, destination_timeout = destination_timeout, destination_delay = destination_delay, + toll_allow = toll_allow, }, session_mt) --find destination route