Update index.lua

This commit is contained in:
FusionPBX
2019-04-29 14:38:46 -06:00
committed by GitHub
parent ed560bca10
commit b4762a2265
@@ -15,7 +15,7 @@
-- The Initial Developer of the Original Code is -- The Initial Developer of the Original Code is
-- Mark J Crane <markjcrane@fusionpbx.com> -- Mark J Crane <markjcrane@fusionpbx.com>
-- Portions created by the Initial Developer are Copyright (C) 2014 -- Portions created by the Initial Developer are Copyright (C) 2014-2019
-- the Initial Developer. All Rights Reserved. -- the Initial Developer. All Rights Reserved.
@@ -56,11 +56,14 @@
local dbh = Database.new('system'); local dbh = Database.new('system');
--select data from the database --select data from the database
local sql = "SELECT destination_number, destination_context " local sql = "SELECT destination_number, destination_context ";
sql = sql .. "FROM v_destinations " sql = sql .. "FROM v_destinations ";
sql = sql .. "WHERE destination_number = :destination_number " sql = sql .. "WHERE ( ";
sql = sql .. "AND destination_type = 'inbound' " sql = sql .. " destination_number = :destination_number ";
sql = sql .. "AND destination_enabled = 'true' " sql = sql .. " OR destination_prefix || destination_number = :destination_number ";
sql = sql .. ") ";
sql = sql .. "AND destination_type = 'inbound' ";
sql = sql .. "AND destination_enabled = 'true' ";
local params = {destination_number = destination_number}; local params = {destination_number = destination_number};
if (debug["sql"]) then if (debug["sql"]) then
freeswitch.consoleLog("notice", "SQL:" .. sql .. "; params: " .. json.encode(params) .. "\n"); freeswitch.consoleLog("notice", "SQL:" .. sql .. "; params: " .. json.encode(params) .. "\n");