mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Add. Use params in destination_caller_id.lua (#2123)
This commit is contained in:
committed by
FusionPBX
parent
c2dc99bdb9
commit
15b9b33a5f
@@ -28,8 +28,14 @@
|
||||
require "resources.functions.config";
|
||||
|
||||
--connect to the database
|
||||
require "resources.functions.database_handle";
|
||||
dbh = database_handle('system');
|
||||
local Database = require "resources.functions.database";
|
||||
dbh = Database.new('system');
|
||||
|
||||
--include json library
|
||||
local json
|
||||
if (debug["sql"]) then
|
||||
json = require "resources.functions.lunajson"
|
||||
end
|
||||
|
||||
--define the trim function
|
||||
require "resources.functions.trim"
|
||||
@@ -45,9 +51,12 @@
|
||||
--caller_id_number = session:getVariable("caller_id_number");
|
||||
|
||||
--get the destination_number
|
||||
sql = [[ SELECT * FROM v_destinations
|
||||
where destination_number like '1]].. outbound_area_code ..[[%']]
|
||||
freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
|
||||
sql = "SELECT destination_number FROM v_destinations where destination_number like :destination_number";
|
||||
local params = {destination_number = '1'.. outbound_area_code .. '%'};
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
end
|
||||
|
||||
x = 0;
|
||||
dbh:query(sql, function(row)
|
||||
destination_number = row.destination_number;
|
||||
|
||||
Reference in New Issue
Block a user