From bf4922387bee5c11b1ad89df633bcaf42ac7de93 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Tue, 22 Nov 2016 21:11:36 +0300 Subject: [PATCH] Add. Use params in vm/record_name.lua (#2128) --- .../resources/functions/record_name.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/resources/install/scripts/app/voicemail/resources/functions/record_name.lua b/resources/install/scripts/app/voicemail/resources/functions/record_name.lua index 2cfdaa572f..f6036947c4 100644 --- a/resources/install/scripts/app/voicemail/resources/functions/record_name.lua +++ b/resources/install/scripts/app/voicemail/resources/functions/record_name.lua @@ -62,20 +62,21 @@ voicemail_name_base64 = assert(file.read_base64(voicemail_name_location)); --update the voicemail name - sql = "UPDATE v_voicemails "; - sql = sql .. "set voicemail_name_base64 = '".. voicemail_name_base64 .. "' "; - sql = sql .. "where domain_uuid = '".. domain_uuid .. "' "; - sql = sql .. "and voicemail_id = '".. voicemail_id .."'"; + local sql = "UPDATE v_voicemails "; + sql = sql .. "set voicemail_name_base64 = :voicemail_name_base64 "; + sql = sql .. "where domain_uuid = :domain_uuid "; + sql = sql .. "and voicemail_id = :voicemail_id"; + local params = {voicemail_name_base64 = voicemail_name_base64, + domain_uuid = domain_uuid, voicemail_id = voicemail_id}; if (debug["sql"]) then - freeswitch.consoleLog("notice", "[recording] SQL: " .. sql .. "\n"); + freeswitch.consoleLog("notice", "[recording] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); end if (storage_type == "base64") then - local Database = require "resources.functions.database" local dbh = Database.new('system', 'base64'); - dbh:query(sql); + dbh:query(sql, params); dbh:release(); else - dbh:query(sql); + dbh:query(sql, params); end elseif (storage_type == "http_cache") then freeswitch.consoleLog("notice", "[voicemail] ".. storage_type .. " ".. storage_path .."\n");