mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Update index.lua
This commit is contained in:
@@ -292,9 +292,6 @@
|
|||||||
destination_number = api:executeString(cmd);
|
destination_number = api:executeString(cmd);
|
||||||
freeswitch.consoleLog("notice", "[ring groups][call forward all] " .. count .. " " .. cmd .. " ".. destination_number .."\n");
|
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;
|
count = count + 1;
|
||||||
if (count < 5) then
|
if (count < 5) then
|
||||||
count, destination_number = get_forward_all(count, destination_number, domain_name);
|
count, destination_number = get_forward_all(count, destination_number, domain_name);
|
||||||
@@ -373,30 +370,34 @@
|
|||||||
--follow the forwards
|
--follow the forwards
|
||||||
count, destination_number = get_forward_all(0, row.destination_number, leg_domain_name);
|
count, destination_number = get_forward_all(0, row.destination_number, leg_domain_name);
|
||||||
|
|
||||||
cmd = "user_exists id ".. row.destination_number .." "..leg_domain_name;
|
--check if the user exists
|
||||||
|
cmd = "user_exists id ".. destination_number .." "..domain_name;
|
||||||
|
user_exists = api:executeString(cmd);
|
||||||
|
|
||||||
|
--cmd = "user_exists id ".. 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
|
||||||
row['user_exists'] = "true";
|
row['user_exists'] = "true";
|
||||||
--handle do_not_disturb
|
--handle do_not_disturb
|
||||||
cmd = "user_data ".. row.destination_number .."@" ..leg_domain_name.." var do_not_disturb";
|
cmd = "user_data ".. destination_number .."@" ..leg_domain_name.." var do_not_disturb";
|
||||||
if (api:executeString(cmd) ~= "true") then
|
if (api:executeString(cmd) ~= "true") then
|
||||||
--add the row to the destinations array
|
--add the row to the destinations array
|
||||||
destinations[x] = row;
|
destinations[x] = row;
|
||||||
end
|
end
|
||||||
--determine if the user is registered if not registered then lookup
|
--determine if the user is registered if not registered then lookup
|
||||||
cmd = "sofia_contact */".. row.destination_number .."@" ..leg_domain_name;
|
cmd = "sofia_contact */".. destination_number .."@" ..leg_domain_name;
|
||||||
if (api:executeString(cmd) == "error/user_not_registered") then
|
if (api:executeString(cmd) == "error/user_not_registered") then
|
||||||
cmd = "user_data ".. row.destination_number .."@" ..leg_domain_name.." var forward_user_not_registered_enabled";
|
cmd = "user_data ".. destination_number .."@" ..leg_domain_name.." var forward_user_not_registered_enabled";
|
||||||
if (api:executeString(cmd) == "true") then
|
if (api:executeString(cmd) == "true") then
|
||||||
--get the new destination number
|
--get the new destination number
|
||||||
cmd = "user_data ".. row.destination_number .."@" ..leg_domain_name.." var forward_user_not_registered_destination";
|
cmd = "user_data ".. destination_number .."@" ..leg_domain_name.." var forward_user_not_registered_destination";
|
||||||
destination_number = api:executeString(cmd);
|
not_registered_destination_number = api:executeString(cmd);
|
||||||
if (row.destination_number ~= nil) then
|
if (not_registered_destination_number ~= nil) then
|
||||||
row.destination_number = destination_number;
|
-- destination_number = not_registered_destination_number;
|
||||||
end
|
end
|
||||||
|
|
||||||
--check the new destination number for user_exists
|
--check the new destination number for user_exists
|
||||||
cmd = "user_exists id ".. row.destination_number .." "..leg_domain_name;
|
cmd = "user_exists id ".. destination_number .." "..leg_domain_name;
|
||||||
user_exists = api:executeString(cmd);
|
user_exists = api:executeString(cmd);
|
||||||
if (user_exists == "true") then
|
if (user_exists == "true") then
|
||||||
row['user_exists'] = "true";
|
row['user_exists'] = "true";
|
||||||
@@ -466,6 +467,13 @@
|
|||||||
destination_prompt = row.destination_prompt;
|
destination_prompt = row.destination_prompt;
|
||||||
domain_name = row.domain_name;
|
domain_name = row.domain_name;
|
||||||
|
|
||||||
|
--follow the forwards
|
||||||
|
count, destination_number = get_forward_all(0, destination_number, leg_domain_name);
|
||||||
|
|
||||||
|
--check if the user exists
|
||||||
|
cmd = "user_exists id ".. destination_number .." "..domain_name;
|
||||||
|
user_exists = api:executeString(cmd);
|
||||||
|
|
||||||
--set ringback
|
--set ringback
|
||||||
ring_group_ringback = format_ringback(ring_group_ringback);
|
ring_group_ringback = format_ringback(ring_group_ringback);
|
||||||
session:setVariable("ringback", ring_group_ringback);
|
session:setVariable("ringback", ring_group_ringback);
|
||||||
@@ -584,18 +592,23 @@
|
|||||||
y = 0;
|
y = 0;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if (r.dialplan_detail_tag == "condition") then
|
if (r.dialplan_detail_tag == "condition") then
|
||||||
if (r.dialplan_detail_type == "destination_number") then
|
if (r.dialplan_detail_type == "destination_number") then
|
||||||
|
dial_string = "regex m:~"..destination_number.."~"..r.dialplan_detail_data
|
||||||
if (api:execute("regex", "m:~"..destination_number.."~"..r.dialplan_detail_data) == "true") then
|
if (api:execute("regex", "m:~"..destination_number.."~"..r.dialplan_detail_data) == "true") then
|
||||||
--get the regex result
|
--get the regex result
|
||||||
destination_result = trim(api:execute("regex", "m:~"..destination_number.."~"..r.dialplan_detail_data.."~$1"));
|
destination_result = trim(api:execute("regex", "m:~"..destination_number.."~"..r.dialplan_detail_data.."~$1"));
|
||||||
--set match equal to true
|
--set match equal to true
|
||||||
regex_match = true
|
regex_match = true;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--regex_match = true;
|
||||||
|
--dial_string = r.dialplan_detail_data;
|
||||||
if (r.dialplan_detail_tag == "action") then
|
if (r.dialplan_detail_tag == "action") then
|
||||||
if (regex_match) then
|
if (regex_match) then
|
||||||
|
--dial_string = 'match';
|
||||||
--replace $1
|
--replace $1
|
||||||
dialplan_detail_data = r.dialplan_detail_data:gsub("$1", destination_result);
|
dialplan_detail_data = r.dialplan_detail_data:gsub("$1", destination_result);
|
||||||
--if the session is set then process the actions
|
--if the session is set then process the actions
|
||||||
|
|||||||
Reference in New Issue
Block a user