From 4bd7e18e79871ac7b27d38a03d2f7f8b9121066c Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 18 Jun 2018 17:43:25 -0600 Subject: [PATCH] Update route_to_bridge.lua --- .../install/scripts/resources/functions/route_to_bridge.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/install/scripts/resources/functions/route_to_bridge.lua b/resources/install/scripts/resources/functions/route_to_bridge.lua index 228096d98e..47152ef131 100644 --- a/resources/install/scripts/resources/functions/route_to_bridge.lua +++ b/resources/install/scripts/resources/functions/route_to_bridge.lua @@ -573,6 +573,12 @@ local function outbound_route_to_bridge(dbh, domain_uuid, fields, actions) local context = fields.context if context == '' then context = nil end + --connect to the database + if (dbh == nil) then + local Database = require "resources.functions.database"; + dbh = Database.new('system'); + end + local current_dialplan_uuid, extension dbh:query(select_outbound_dialplan_sql, {domain_uuid=domain_uuid, hostname=hostname}, function(route) if (route.dialplan_context ~= '${domain_name}') and (context and context ~= route.dialplan_context) then