From 70fffb8e376aae09275ac2b648ef155aff99dc00 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 14 Jun 2019 23:59:37 -0600 Subject: [PATCH] Update hangup_rx.lua --- .../app/fax/resources/scripts/hangup_rx.lua | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua b/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua index c4f6d8c030..a56be490e0 100644 --- a/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua +++ b/resources/install/scripts/app/fax/resources/scripts/hangup_rx.lua @@ -16,14 +16,14 @@ -- -- The Initial Developer of the Original Code is -- Mark J Crane --- Copyright (C) 2015-2016 +-- Copyright (C) 2015-2019 -- the Initial Developer. All Rights Reserved. -- -- Contributor(s): -- Mark J. Crane --set the debug options - debug["sql"] = false; + debug["sql"] = true; --create the api object api = freeswitch.API(); @@ -59,8 +59,8 @@ -- escape shell arguments to prevent command injection local function shell_esc(x) - return ("'"..x:gsub('\\', '\\\\') - :gsub('\'', '\\\'').."'") + return (x:gsub('\\', '\\\\') + :gsub('\'', '\\\'')) end -- set channel variables to lua variables @@ -205,16 +205,15 @@ end --fax to email - -- cmd = "lua" .. " " .. quote(scripts_dir .. "/fax_to_email.lua") .. " "; - cmd = quote(php_dir.."/"..php_bin).." "..quote(document_root.."/secure/fax_to_email.php").." "; - cmd = cmd .. "email="..quote(fax_email).." "; - cmd = cmd .. "extension="..quote(fax_extension).." "; - cmd = cmd .. "name="..quote(fax_file).." "; - cmd = cmd .. "messages=" .. quote("result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages).." "; - cmd = cmd .. "domain="..quote(domain_name).." "; - cmd = cmd .. "caller_id_name=" .. quote(caller_id_name or '') .. " "; - cmd = cmd .. "caller_id_number=" .. quote(caller_id_number or '') .. " "; + cmd = quote(shell_esc(php_dir).."/"..shell_esc(php_bin)).." "..quote(shell_esc(document_root).."/secure/fax_to_email.php").." "; + cmd = cmd .. "email="..quote(shell_esc(fax_email)).." "; + cmd = cmd .. "extension="..quote(shell_esc(fax_extension)).." "; + cmd = cmd .. "name="..quote(shell_esc(fax_file)).." "; + cmd = cmd .. "messages=" .. quote("result:"..shell_esc(fax_result_text).." sender:"..shell_esc(fax_remote_station_id).." pages:"..shell_esc(fax_document_total_pages)).." "; + cmd = cmd .. "domain="..quote(shell_esc(domain_name)).." "; + cmd = cmd .. "caller_id_name=" .. quote(shell_esc(caller_id_name) or '') .. " "; + cmd = cmd .. "caller_id_number=" .. quote(shell_esc(caller_id_number) or '') .. " "; if #fax_forward_number > 0 then cmd = cmd .. "fax_relay=true "; else @@ -225,8 +224,6 @@ else cmd = cmd .. "fax_prefix=false "; end - - --cmd=shell_esc(cmd); freeswitch.consoleLog("notice", "[fax] command: " .. cmd .. "\n"); result = api:execute("system", cmd);