Merge pull request #1230 from moteus/windows_hungup_rx

Fix. hungup_rx.lua works on Windows
This commit is contained in:
FusionPBX 2015-11-10 11:51:34 -07:00
commit fdae758e1f
1 changed files with 21 additions and 17 deletions

View File

@ -41,6 +41,16 @@
--array count --array count
require "resources.functions.count"; require "resources.functions.count";
local IS_WINDOWS = (package.config:sub(1,1) == '\\')
local function enquote(s)
local q = IS_WINDOWS and '"' or "'"
if s:find('%s') or s:find(q, nil, true) then
s = q .. s:gsub(q, q..q) .. q
end
return s
end
-- set channel variables to lua variables -- set channel variables to lua variables
domain_uuid = env:getHeader("domain_uuid"); domain_uuid = env:getHeader("domain_uuid");
domain_name = env:getHeader("domain_name"); domain_name = env:getHeader("domain_name");
@ -181,23 +191,17 @@
end end
--fax to email --fax to email
cmd = "'"..php_dir.."/"..php_bin.."' '"..document_root.."/secure/fax_to_email.php' ";
cmd = cmd .. "email='"..fax_email.."' "; -- cmd = "lua" .. " " .. enquote(scripts_dir .. "/fax_to_email.lua") .. " ";
cmd = cmd .. "extension="..fax_extension.." "; cmd = enquote(php_dir.."/"..php_bin).." "..enquote(document_root.."/secure/fax_to_email.php").." ";
cmd = cmd .. "name='"..fax_file.."' "; cmd = cmd .. "email="..enquote(fax_email).." ";
cmd = cmd .. "messages='result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages.."' "; cmd = cmd .. "extension="..enquote(fax_extension).." ";
cmd = cmd .. "domain="..domain_name.." "; cmd = cmd .. "name="..enquote(fax_file).." ";
cmd = cmd .. "caller_id_name='"; cmd = cmd .. "messages=" .. enquote("result:"..fax_result_text.." sender:"..fax_remote_station_id.." pages:"..fax_document_total_pages).." ";
if (caller_id_name ~= nil) then cmd = cmd .. "domain="..enquote(domain_name).." ";
cmd = cmd .. caller_id_name; cmd = cmd .. "caller_id_name=" .. enquote(caller_id_name or '') .. " ";
end cmd = cmd .. "caller_id_number=" .. enquote(caller_id_number or '') .. " ";
cmd = cmd .. "' "; if #fax_forward_number > 0 then
cmd = cmd .. "caller_id_number=";
if (caller_id_number ~= nil) then
cmd = cmd .. caller_id_number;
end
cmd = cmd .. " ";
if (string.len(fax_forward_number) > 0) then
cmd = cmd .. "fax_relay=true "; cmd = cmd .. "fax_relay=true ";
end end
freeswitch.consoleLog("notice", "[fax] command: " .. cmd .. "\n"); freeswitch.consoleLog("notice", "[fax] command: " .. cmd .. "\n");