mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Use a more efficient way to get the domain name for xml handler - dialplan.
This commit is contained in:
@@ -65,18 +65,19 @@
|
||||
condition_tag_status = "closed";
|
||||
|
||||
--get the dialplan and related details
|
||||
sql = "select * from v_dialplans as d, v_dialplan_details as s ";
|
||||
sql = "select * from v_dialplans as p, v_dialplan_details as s, v_domains as d ";
|
||||
if (call_context == "public" or string.sub(call_context, 0, 7) == "public@" or string.sub(call_context, -7) == ".public") then
|
||||
sql = sql .. "where d.dialplan_context = '" .. call_context .. "' ";
|
||||
sql = sql .. "where p.dialplan_context = '" .. call_context .. "' ";
|
||||
else
|
||||
sql = sql .. "where (d.dialplan_context = '" .. call_context .. "' or d.dialplan_context = '${domain_name}') ";
|
||||
sql = sql .. "where (p.dialplan_context = '" .. call_context .. "' or p.dialplan_context = '${domain_name}') ";
|
||||
end
|
||||
sql = sql .. "and d.dialplan_enabled = 'true' ";
|
||||
sql = sql .. "and d.dialplan_uuid = s.dialplan_uuid ";
|
||||
sql = sql .. "and p.dialplan_enabled = 'true' ";
|
||||
sql = sql .. "and p.dialplan_uuid = s.dialplan_uuid ";
|
||||
sql = sql .. "and p.domain_uuid = d.domain_uuid ";
|
||||
sql = sql .. "order by ";
|
||||
sql = sql .. "d.dialplan_order asc, ";
|
||||
sql = sql .. "d.dialplan_name asc, ";
|
||||
sql = sql .. "d.dialplan_uuid asc, ";
|
||||
sql = sql .. "p.dialplan_order asc, ";
|
||||
sql = sql .. "p.dialplan_name asc, ";
|
||||
sql = sql .. "p.dialplan_uuid asc, ";
|
||||
sql = sql .. "s.dialplan_detail_group asc, ";
|
||||
sql = sql .. "CASE s.dialplan_detail_tag ";
|
||||
sql = sql .. "WHEN 'condition' THEN 1 ";
|
||||
@@ -95,6 +96,7 @@
|
||||
|
||||
--get the dialplan
|
||||
domain_uuid = row.domain_uuid;
|
||||
domain_name = row.domain_name;
|
||||
dialplan_uuid = row.dialplan_uuid;
|
||||
--app_uuid = row.app_uuid;
|
||||
--dialplan_context = row.dialplan_context;
|
||||
@@ -237,23 +239,15 @@
|
||||
if (call_context == "public" or string.sub(call_context, 0, 7) == "public@" or string.sub(call_context, -7) == ".public") then
|
||||
if (dialplan_detail_tag == "action") then
|
||||
if (first_action) then
|
||||
table.insert(xml, [[ <action application="set" data="call_direction=inbound"/>]]);
|
||||
if (domain_uuid ~= nil and domain_uuid ~= '') then
|
||||
if (domain_name == nil) then
|
||||
sql = "SELECT domain_name FROM v_domains where domain_uuid = '"..domain_uuid.."'";
|
||||
dbh:query(sql, function(row)
|
||||
domain_name = row["domain_name"];
|
||||
end);
|
||||
end
|
||||
table.insert(xml, [[ <action application="set" data="call_direction=inbound"/>]]);
|
||||
if (domain_uuid ~= nil) then
|
||||
table.insert(xml, [[ <action application="set" data="domain_uuid=]] .. domain_uuid .. [["/>]]);
|
||||
end
|
||||
if (domain_name ~= nil) then
|
||||
table.insert(xml, [[ <action application="set" data="domain_name=]] .. domain_name .. [["/>]]);
|
||||
table.insert(xml, [[ <action application="set" data="domain=]] .. domain_name .. [["/>]]);
|
||||
end
|
||||
first_action = false;
|
||||
table.insert(xml, [[ <action application="set" data="domain_uuid=]] .. domain_uuid .. [["/>]]);
|
||||
end
|
||||
if (domain_name ~= nil and domain_name ~= '') then
|
||||
table.insert(xml, [[ <action application="set" data="domain_name=]] .. domain_name .. [["/>]]);
|
||||
table.insert(xml, [[ <action application="set" data="domain=]] .. domain_name .. [["/>]]);
|
||||
end
|
||||
first_action = false;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user