Allow use odbc to store files (record/voicemail) in database. (#1535)

* Change. Allow use odbc to store files (record/voicemail) in database.

* Fix. Generate correct default config.
This commit is contained in:
Alexey Melnichuk
2016-09-04 22:05:47 +03:00
committed by FusionPBX
parent 119a007acd
commit 09f2d8fa43
16 changed files with 603 additions and 655 deletions

View File

@@ -293,14 +293,11 @@
end
if (storage_type == "base64") then
--include the base64 function
require "resources.functions.base64";
--include the file io
local file = require "resources.functions.file"
--base64 encode the file
local f = io.open(fax_file, "rb");
local file_content = f:read("*all");
f:close();
fax_base64 = base64.encode(file_content);
--read file content as base64 string
fax_base64 = assert(file.read_base64(fax_file));
end
local sql = {}
@@ -352,13 +349,10 @@
freeswitch.consoleLog("notice", "[FAX] SQL: " .. sql .. "\n");
--end
if (storage_type == "base64") then
array = explode("://", database["system"]);
local luasql = require "luasql.postgres";
local env = assert (luasql.postgres());
local dbh = env:connect(array[2]);
res, serr = dbh:execute(sql);
dbh:close();
env:close();
local Database = require "resources.functions.database"
local dbh = Database.new('system', 'base64');
dbh:query(sql);
dbh:release();
else
result = dbh:query(sql);
end