Update index.lua
This commit is contained in:
parent
625ebd1ecb
commit
d9a29afb51
|
|
@ -120,16 +120,16 @@
|
||||||
call_direction = session:getVariable("call_direction");
|
call_direction = session:getVariable("call_direction");
|
||||||
end
|
end
|
||||||
|
|
||||||
--set the call_timeout to a higher value to prevent the early timeout of the ring group
|
|
||||||
if (session:ready()) then
|
|
||||||
session:setVariable("call_timeout","300");
|
|
||||||
end
|
|
||||||
|
|
||||||
--default to local if nil
|
--default to local if nil
|
||||||
if (call_direction == nil) then
|
if (call_direction == nil) then
|
||||||
call_direction = "local";
|
call_direction = "local";
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---set the call_timeout to a higher value to prevent the early timeout of the ring group
|
||||||
|
if (session:ready()) then
|
||||||
|
session:setVariable("call_timeout","300");
|
||||||
|
end
|
||||||
|
|
||||||
--set ring ready
|
--set ring ready
|
||||||
if (session:ready()) then
|
if (session:ready()) then
|
||||||
session:execute("ring_ready", "");
|
session:execute("ring_ready", "");
|
||||||
|
|
@ -278,6 +278,32 @@
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--get the destination and follow the forward
|
||||||
|
function get_forward_all(count, destination_number, domain_name)
|
||||||
|
cmd = "user_exists id ".. destination_number .." "..domain_name;
|
||||||
|
freeswitch.consoleLog("notice", "[ring groups][call forward all] " .. cmd .. "\n");
|
||||||
|
user_exists = api:executeString(cmd);
|
||||||
|
if (user_exists == "true") then
|
||||||
|
---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 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");
|
||||||
|
|
||||||
|
cmd = "user_exists id ".. destination_number .." "..domain_name;
|
||||||
|
user_exists = api:executeString(cmd);
|
||||||
|
|
||||||
|
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;
|
||||||
|
end
|
||||||
|
|
||||||
--process the ring group
|
--process the ring group
|
||||||
if (ring_group_forward_enabled == "true" and string.len(ring_group_forward_destination) > 0) then
|
if (ring_group_forward_enabled == "true" and string.len(ring_group_forward_destination) > 0) then
|
||||||
--forward the ring group
|
--forward the ring group
|
||||||
|
|
@ -343,41 +369,10 @@
|
||||||
else
|
else
|
||||||
leg_domain_name = array[2];
|
leg_domain_name = array[2];
|
||||||
end
|
end
|
||||||
cmd = "user_exists id ".. row.destination_number .." "..leg_domain_name;
|
|
||||||
user_exists = api:executeString(cmd);
|
--follow the forwards
|
||||||
if (user_exists == "true") then
|
count, destination_number = get_forward_all(0, row.destination_number, leg_domain_name);
|
||||||
--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;
|
cmd = "user_exists id ".. row.destination_number .." "..leg_domain_name;
|
||||||
if (user_exists == "true") then
|
if (user_exists == "true") then
|
||||||
--add user_exists true or false to the row array
|
--add user_exists true or false to the row array
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue