Update the ring group lua script.

This commit is contained in:
Mark Crane 2013-08-16 20:36:52 +00:00
parent 7737af16b3
commit b24038661c
1 changed files with 278 additions and 262 deletions

View File

@ -75,7 +75,22 @@
-- error();
--end
--get the ring group destinations
--get the ring group
ring_group_forward_enabled = "";
ring_group_forward_destination = "";
sql = "SELECT * FROM v_ring_groups ";
sql = sql .. "where ring_group_uuid = '"..ring_group_uuid.."' ";
status = dbh:query(sql, function(rows)
ring_group_forward_enabled = rows["ring_group_forward_enabled"];
ring_group_forward_destination = rows["ring_group_forward_destination"];
end);
--process the ring group
if (ring_group_forward_enabled == "true" and string.len(ring_group_forward_destination) > 0) then
--forward the ring group
session:execute("transfer", ring_group_forward_destination.." XML "..context);
else
--get the ring group destinations
sql =
[[ SELECT r.ring_group_strategy, r.ring_group_timeout_sec, r.ring_group_timeout_app, d.destination_number, d.destination_delay, d.destination_timeout, d.destination_prompt, r.ring_group_timeout_data, r.ring_group_cid_name_prefix, r.ring_group_ringback
FROM v_ring_groups as r, v_ring_group_destinations as d
@ -104,7 +119,7 @@
--freeswitch.consoleLog("NOTICE", "[ring_group] prompt "..prompt.."\n");
--freeswitch.consoleLog("NOTICE", "[ring_group] external "..external.."\n");
--get the dialplan data and save it to a table
--get the dialplan data and save it to a table
if (external) then
sql = [[select * from v_dialplans as d, v_dialplan_details as s
where d.domain_uuid = ']] .. domain_uuid .. [['
@ -131,7 +146,7 @@
end));
end
--process the destinations
--process the destinations
x = 0;
for key, row in pairs(destinations) do
--set the values from the database as variables
@ -299,7 +314,7 @@
x = x + 1;
end
--session execute
--session execute
if (session:ready()) then
--set the variables
session:execute("set", "hangup_after_bridge=true");
@ -348,6 +363,7 @@
end
end
end
end
--actions
--ACTIONS = {}