Add. Use params in vm/record_menu.lua (#2130)
This commit is contained in:
parent
4131d90862
commit
a7341d97c4
|
|
@ -90,12 +90,14 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
--delete the previous recording
|
--delete the previous recording
|
||||||
sql = "delete from v_voicemail_greetings ";
|
local sql = "delete from v_voicemail_greetings ";
|
||||||
sql = sql .. "where domain_uuid = '".. domain_uuid .. "' ";
|
sql = sql .. "where domain_uuid = :domain_uuid ";
|
||||||
sql = sql .. "and voicemail_id = '".. voicemail_id .."' ";
|
sql = sql .. "and voicemail_id = :voicemail_id ";
|
||||||
sql = sql .. "and greeting_id = '".. greeting_id .."' ";
|
sql = sql .. "and greeting_id = :greeting_id ";
|
||||||
|
local params = {domain_uuid = domain_uuid,
|
||||||
|
voicemail_id = voicemail_id, greeting_id = greeting_id};
|
||||||
--freeswitch.consoleLog("notice", "[SQL] DELETING: " .. greeting_id .. "\n");
|
--freeswitch.consoleLog("notice", "[SQL] DELETING: " .. greeting_id .. "\n");
|
||||||
dbh:query(sql);
|
dbh:query(sql, params);
|
||||||
|
|
||||||
--get a new uuid
|
--get a new uuid
|
||||||
voicemail_greeting_uuid = api:execute("create_uuid");
|
voicemail_greeting_uuid = api:execute("create_uuid");
|
||||||
|
|
@ -116,38 +118,48 @@
|
||||||
table.insert(array, ") ");
|
table.insert(array, ") ");
|
||||||
table.insert(array, "VALUES ");
|
table.insert(array, "VALUES ");
|
||||||
table.insert(array, "( ");
|
table.insert(array, "( ");
|
||||||
table.insert(array, "'"..voicemail_greeting_uuid.."', ");
|
table.insert(array, ":greeting_uuid, ");
|
||||||
table.insert(array, "'"..domain_uuid.."', ");
|
table.insert(array, ":domain_uuid, ");
|
||||||
table.insert(array, "'"..voicemail_id.."', ");
|
table.insert(array, ":voicemail_id, ");
|
||||||
table.insert(array, "'"..greeting_id.."', ");
|
table.insert(array, ":greeting_id, ");
|
||||||
if (storage_type == "base64") then
|
if (storage_type == "base64") then
|
||||||
table.insert(array, "'"..greeting_base64.."', ");
|
table.insert(array, ":greeting_base64, ");
|
||||||
end
|
end
|
||||||
table.insert(array, "'Greeting "..greeting_id.."', ");
|
table.insert(array, ":greeting_name, ");
|
||||||
table.insert(array, "'greeting_"..greeting_id..".wav' ");
|
table.insert(array, ":greeting_filename ");
|
||||||
table.insert(array, ") ");
|
table.insert(array, ") ");
|
||||||
sql = table.concat(array, "\n");
|
sql = table.concat(array, "\n");
|
||||||
|
params = {
|
||||||
|
greeting_uuid = voicemail_greeting_uuid;
|
||||||
|
domain_uuid = domain_uuid;
|
||||||
|
voicemail_id = voicemail_id;
|
||||||
|
greeting_id = greeting_id;
|
||||||
|
greeting_base64 = greeting_base64;
|
||||||
|
greeting_name = "Greeting "..greeting_id;
|
||||||
|
greeting_filename = "greeting_"..greeting_id..".wav"
|
||||||
|
};
|
||||||
--freeswitch.consoleLog("notice", "[SQL] INSERTING: " .. greeting_id .. "\n");
|
--freeswitch.consoleLog("notice", "[SQL] INSERTING: " .. greeting_id .. "\n");
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
|
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||||
end
|
end
|
||||||
if (storage_type == "base64") then
|
if (storage_type == "base64") then
|
||||||
local Database = require "resources.functions.database"
|
|
||||||
local dbh = Database.new('system', 'base64');
|
local dbh = Database.new('system', 'base64');
|
||||||
dbh:query(sql);
|
dbh:query(sql, params);
|
||||||
dbh:release();
|
dbh:release();
|
||||||
else
|
else
|
||||||
dbh:query(sql);
|
dbh:query(sql, params);
|
||||||
end
|
end
|
||||||
|
|
||||||
--use the new greeting
|
--use the new greeting
|
||||||
local array = {}
|
sql = {}
|
||||||
table.insert(array, "update v_voicemails ");
|
table.insert(sql, "update v_voicemails ");
|
||||||
table.insert(array, "set greeting_id = '".. greeting_id .."' ");
|
table.insert(sql, "set greeting_id = :greeting_id ");
|
||||||
table.insert(array, "where domain_uuid = '".. domain_uuid .."' ");
|
table.insert(sql, "where domain_uuid = :domain_uuid ");
|
||||||
table.insert(array, "and voicemail_id = '".. voicemail_id .."' ");
|
table.insert(sql, "and voicemail_id = :voicemail_id ");
|
||||||
sql = table.concat(array, "\n");
|
sql = table.concat(sql, "\n");
|
||||||
dbh:query(sql);
|
params = {domain_uuid = domain_uuid, greeting_id = greeting_id,
|
||||||
|
voicemail_id = voicemail_id};
|
||||||
|
dbh:query(sql, params);
|
||||||
|
|
||||||
advanced();
|
advanced();
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue