Fix. Store message_intro_base64 in database. (#2197)
This commit is contained in:
parent
f172b08db3
commit
21b63b086b
|
|
@ -95,21 +95,25 @@
|
||||||
|
|
||||||
--save the merged file into the database as base64
|
--save the merged file into the database as base64
|
||||||
if (storage_type == "base64") then
|
if (storage_type == "base64") then
|
||||||
|
local file = require "resources.functions.file"
|
||||||
|
|
||||||
--get the content of the file
|
--get the content of the file
|
||||||
local f = io.open(message_intro_location, "rb");
|
local file_content = assert(file.read_base64(message_intro_location);
|
||||||
local file_content = f:read("*all");
|
|
||||||
f:close();
|
|
||||||
|
|
||||||
--save the merged file as base64
|
--save the merged file as base64
|
||||||
local sql = {}
|
local sql = [[UPDATE SET v_voicemail_messages
|
||||||
sql = [[UPDATE SET v_voicemail_messages
|
SET message_intro_base64 = :file_content
|
||||||
SET message_intro_base64 = ']].. base64.encode(file_content) ..[['
|
WHERE domain_uuid = :domain_uuid
|
||||||
WHERE domain_uuid = ']] .. domain_uuid ..[['
|
AND voicemail_message_uuid = :uuid]];
|
||||||
AND voicemail_message_uuid = ']].. uuid.. [[' ]];
|
local params = {file_content = file_content, domain_uuid = domain_uuid, uuid = uuid};
|
||||||
sql = table.concat(sql, "\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
|
||||||
|
|
||||||
|
local dbh = Database.new('system', 'base64')
|
||||||
|
dbh:query(sql, params)
|
||||||
|
dbh:release()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue