Add. Use params in ivr_menu.lua (#2116)
This commit is contained in:
committed by
FusionPBX
parent
a6ac29bd49
commit
1d366b8bf2
@@ -40,6 +40,12 @@
|
|||||||
--get logger
|
--get logger
|
||||||
local log = require "resources.functions.log".ivr_menu
|
local log = require "resources.functions.log".ivr_menu
|
||||||
|
|
||||||
|
--include json library
|
||||||
|
local json
|
||||||
|
if (debug["sql"]) then
|
||||||
|
json = require "resources.functions.lunajson"
|
||||||
|
end
|
||||||
|
|
||||||
--include functions
|
--include functions
|
||||||
require "resources.functions.format_ringback"
|
require "resources.functions.format_ringback"
|
||||||
require "resources.functions.split"
|
require "resources.functions.split"
|
||||||
@@ -98,12 +104,13 @@
|
|||||||
|
|
||||||
--get the ivr menu from the database
|
--get the ivr menu from the database
|
||||||
sql = [[SELECT * FROM v_ivr_menus
|
sql = [[SELECT * FROM v_ivr_menus
|
||||||
WHERE ivr_menu_uuid = ']] .. ivr_menu_uuid ..[['
|
WHERE ivr_menu_uuid = :ivr_menu_uuid
|
||||||
AND ivr_menu_enabled = 'true' ]];
|
AND ivr_menu_enabled = 'true' ]];
|
||||||
|
local params = {ivr_menu_uuid = ivr_menu_uuid};
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
log.notice("SQL: " .. sql);
|
log.notice("SQL: " .. sql .. "; params: " .. json.encode(params));
|
||||||
end
|
end
|
||||||
dbh:query(sql, function(row)
|
dbh:query(sql, params, function(row)
|
||||||
domain_uuid = row["domain_uuid"];
|
domain_uuid = row["domain_uuid"];
|
||||||
ivr_menu_name = row["ivr_menu_name"];
|
ivr_menu_name = row["ivr_menu_name"];
|
||||||
--ivr_menu_extension = row["ivr_menu_extension"];
|
--ivr_menu_extension = row["ivr_menu_extension"];
|
||||||
@@ -185,15 +192,17 @@
|
|||||||
return full_path
|
return full_path
|
||||||
end
|
end
|
||||||
|
|
||||||
local sql = [[SELECT * FROM v_recordings WHERE domain_uuid = ']]..domain_uuid..
|
local sql = "SELECT * FROM v_recordings WHERE domain_uuid = :domain_uuid "
|
||||||
[['AND recording_filename = ']]..file_name..[[' ]];
|
.. "AND recording_filename = :file_name";
|
||||||
|
|
||||||
|
local params = {domain_uuid = domain_uuid, file_name = file_name};
|
||||||
|
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
log.notice("SQL: "..sql);
|
log.notice("SQL: " .. sql .. "; params: " .. json.encode(params));
|
||||||
end
|
end
|
||||||
|
|
||||||
local is_base64
|
local is_base64
|
||||||
dbh:query(sql, function(row)
|
dbh:query(sql, params, function(row)
|
||||||
if #row.recording_base64 > 32 then
|
if #row.recording_base64 > 32 then
|
||||||
--include the file io
|
--include the file io
|
||||||
local file = require "resources.functions.file"
|
local file = require "resources.functions.file"
|
||||||
@@ -323,9 +332,12 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
--get the ivr menu options
|
--get the ivr menu options
|
||||||
sql = [[SELECT * FROM v_ivr_menu_options WHERE ivr_menu_uuid = ']] .. ivr_menu_uuid ..[[' ORDER BY ivr_menu_option_order asc ]];
|
local sql = "SELECT * FROM v_ivr_menu_options "
|
||||||
|
.. "WHERE ivr_menu_uuid = :ivr_menu_uuid "
|
||||||
|
.. "ORDER BY ivr_menu_option_order asc ";
|
||||||
|
local params = {ivr_menu_uuid = ivr_menu_uuid};
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
log.notice("SQL: " .. sql);
|
log.notice("SQL: " .. sql .. "; params: " .. json.encode(params));
|
||||||
end
|
end
|
||||||
|
|
||||||
--connect to the database
|
--connect to the database
|
||||||
@@ -333,7 +345,7 @@
|
|||||||
|
|
||||||
--select actions to execute
|
--select actions to execute
|
||||||
local actions = {}
|
local actions = {}
|
||||||
dbh:query(sql, function(row)
|
dbh:query(sql, params, function(row)
|
||||||
-- declare vars
|
-- declare vars
|
||||||
local action, script, data
|
local action, script, data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user