From b9b3fd6494524498acbfcde0abccff3cf0bd74fc Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 23 Dec 2016 01:52:19 -0700 Subject: [PATCH] Update route_to_bridge.lua --- .../scripts/resources/functions/route_to_bridge.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/install/scripts/resources/functions/route_to_bridge.lua b/resources/install/scripts/resources/functions/route_to_bridge.lua index 71834de07b..5a77f57c4b 100644 --- a/resources/install/scripts/resources/functions/route_to_bridge.lua +++ b/resources/install/scripts/resources/functions/route_to_bridge.lua @@ -36,6 +36,7 @@ local select_routes_sql = [[ select * from v_dialplans where (domain_uuid = :domain_uuid or domain_uuid is null) + and (hostname = :hostname or hostname is null) and app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' and dialplan_enabled = 'true' order by dialplan_order asc @@ -238,9 +239,11 @@ end local function outbound_route_to_bridge(dbh, domain_uuid, fields) local actions, dial_string = {} + require "resources.functions.trim"; + hostname = trim(api:execute("switchname", "")); local params = {} - dbh:query(select_routes_sql, {domain_uuid=domain_uuid}, function(route) + dbh:query(select_routes_sql, {domain_uuid=domain_uuid,hostname=hostname}, function(route) local extension = {} params.dialplan_uuid = route.dialplan_uuid dbh:query(select_extensions_sql, params, function(ext) @@ -281,4 +284,4 @@ return setmetatable({ __self_test = self_test; }, {__call = function(_, ...) return outbound_route_to_bridge(...) -end}) \ No newline at end of file +end})