Update hangup_tx.lua

This commit is contained in:
FusionPBX 2022-04-20 21:58:01 -06:00 committed by GitHub
parent e73af240f9
commit 0c0f07d994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 77 additions and 82 deletions

View File

@ -171,6 +171,7 @@
end
--fax sent successfully
fax_status = "";
if (fax_success == '1') then
fax_status = 'sent';
end
@ -222,7 +223,7 @@
end
--update the email queue status
if (fax_status ~= nil) then
if (fax_status == 'sent') then
sql = "update v_fax_queue ";
sql = sql .. "set fax_status = :fax_status ";
sql = sql .. "where fax_queue_uuid = :fax_queue_uuid ";
@ -309,7 +310,6 @@
end
sql = sql .. ":fax_time ";
sql = sql .. ")";
local params = {
uuid = uuid;
domain_uuid = domain_uuid;
@ -330,16 +330,12 @@
fax_date = os.date("%Y-%m-%d %X");
fax_time = os.time();
};
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[fax] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
end
dbh:query(sql, params);
--add the fax files
if (fax_success ~= nil) then
if (fax_success =="1") then
--prepare base64
if (storage_type == "base64") then
--include the file io
local file = require "resources.functions.file"
@ -348,6 +344,7 @@
fax_base64 = assert(file.read_base64(fax_file));
end
--add the fax files
local sql = {}
table.insert(sql, "insert into v_fax_files ");
table.insert(sql, "(");
@ -373,7 +370,7 @@
table.insert(sql, "(");
table.insert(sql, ":uuid, ");
table.insert(sql, ":fax_uuid, ");
table.insert(sql, "'rx', ");
table.insert(sql, "'tx', ");
table.insert(sql, "'tif', ");
table.insert(sql, ":fax_file, ");
if (caller_id_name ~= nil) then
@ -413,9 +410,7 @@
dbh:query(sql, params);
dbh:release();
else
result = dbh:query(sql, params);
end
end
dbh:query(sql, params);
end
--send the selected variables to the console