From 406d326c8d02c1a5c3e6991e59f8266e8c8d2065 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 23 Dec 2016 01:28:47 -0700 Subject: [PATCH] Update dialplan.lua Add hostname to dialplan xml handler. --- .../app/xml_handler/resources/scripts/dialplan/dialplan.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua b/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua index 601f42f234..2589d28a77 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua @@ -59,6 +59,9 @@ --exits the script if we didn't connect properly assert(dbh:connected()); + --get the hostname + hostname = trim(api:execute("switchname", "")); + --set the xml array and then concatenate the array to a string local xml = {} table.insert(xml, [[]]); @@ -73,10 +76,11 @@ else sql = sql .. "where (p.dialplan_context = :call_context or p.dialplan_context = '${domain_name}') "; end + sql = sql .. "and (hostname = :hostname or hostname is null) "; sql = sql .. "and p.dialplan_enabled = 'true' "; sql = sql .. "order by "; sql = sql .. "p.dialplan_order asc "; - local params = {call_context = call_context}; + local params = {call_context = call_context, hostname = hostname}; if (debug["sql"]) then freeswitch.consoleLog("notice", "[dialplan] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); end