From 54dca7596c110aa685d62db6876599bb553e77df Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 13 Apr 2020 16:36:30 -0600 Subject: [PATCH] Update switch.php --- resources/switch.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/switch.php b/resources/switch.php index f8855d8172..89fd056db8 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -428,14 +428,24 @@ function outbound_route_to_bridge($domain_uuid, $destination_number, array $chan //get the hostname $hostname = trim(event_socket_request_cmd('api switchname')); + if (strlen($hostname) == 0) { + $hostname = 'unknown'; + } $sql = "select * from v_dialplans "; - $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; + if (is_uuid($domain_uuid)) { + $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; + } + else { + $sql .= "where (domain_uuid is null) "; + } $sql .= "and (hostname = :hostname or hostname is null) "; $sql .= "and app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' "; $sql .= "and dialplan_enabled = 'true' "; $sql .= "order by dialplan_order asc "; - $parameters['domain_uuid'] = $domain_uuid; + if (is_uuid($domain_uuid)) { + $parameters['domain_uuid'] = $domain_uuid; + } $parameters['hostname'] = $hostname; $database = new database; $result = $database->select($sql, $parameters, 'all');