Update index.lua (#2821)

Break the ring group query into two parts. One for getting the ring group info. Another for getting the ring group user. 

If a user was not assigned to a ring group, then the query will fail to return a result. This will cause forward, prefix, distinctive ring, etc to not work properly.
This commit is contained in:
konradSC
2017-09-05 12:57:30 -04:00
committed by FusionPBX
parent d691f8978e
commit 19ae8a7e95

View File

@@ -168,13 +168,10 @@
--get the ring group
ring_group_forward_enabled = "";
ring_group_forward_destination = "";
sql = "SELECT r.*, u.user_uuid FROM v_ring_groups as r, v_ring_group_users as u ";
sql = "SELECT r.* FROM v_ring_groups as r ";
sql = sql .. "where r.ring_group_uuid = :ring_group_uuid ";
sql = sql .. "and r.ring_group_uuid = u.ring_group_uuid ";
local params = {ring_group_uuid = ring_group_uuid};
status = dbh:query(sql, params, function(row)
--domain_uuid = row["domain_uuid"];
user_uuid = row["user_uuid"];
ring_group_name = row["ring_group_name"];
ring_group_extension = row["ring_group_extension"];
ring_group_forward_enabled = row["ring_group_forward_enabled"];
@@ -185,6 +182,15 @@
missed_call_app = row["ring_group_missed_call_app"];
missed_call_data = row["ring_group_missed_call_data"];
end);
--get the ring group user
sql = "SELECT r.*, u.user_uuid FROM v_ring_groups as r, v_ring_group_users as u ";
sql = sql .. "where r.ring_group_uuid = :ring_group_uuid ";
sql = sql .. "and r.ring_group_uuid = u.ring_group_uuid ";
local params = {ring_group_uuid = ring_group_uuid};
status = dbh:query(sql, params, function(row)
user_uuid = row["user_uuid"];
end);
--set the caller id
if (session:ready()) then