mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Fix a problem with inbound calls and improve the dialplan lua script.
This commit is contained in:
@@ -37,35 +37,48 @@
|
|||||||
local domain_name = session:getVariable("domain_name");
|
local domain_name = session:getVariable("domain_name");
|
||||||
|
|
||||||
--determine the call direction
|
--determine the call direction
|
||||||
if (context == "public") then
|
if (call_direction == nil) then
|
||||||
call_direction = "inbound";
|
--get the call directory
|
||||||
else
|
if (context == "public") then
|
||||||
if (call_direction == nil) then
|
call_direction = "inbound";
|
||||||
if (context == "outbound@"..domain_name) then
|
|
||||||
call_direction = "outbound";
|
|
||||||
else
|
else
|
||||||
if (string.len(destination_number) > 6) then
|
if (context == "outbound@"..domain_name) then
|
||||||
call_direction = "outbound";
|
call_direction = "outbound";
|
||||||
else
|
else
|
||||||
call_direction = "local";
|
if (string.len(destination_number) > 6) then
|
||||||
|
call_direction = "outbound";
|
||||||
|
else
|
||||||
|
call_direction = "local";
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
--set the call direction as a session variable
|
||||||
|
session:setVariable("call_direction", call_direction);
|
||||||
|
--freeswitch.consoleLog("notice", "[app:dialplan] set call_direction " .. call_direction .. "\n");
|
||||||
end
|
end
|
||||||
|
|
||||||
--set the call direction as a session variable
|
--determine the directory to include
|
||||||
session:setVariable("call_direction", call_direction);
|
if (context == "public") then
|
||||||
--freeswitch.consoleLog("notice", "[app:dialplan] set call_direction " .. call_direction .. "\n");
|
dialplan_dir = "inbound";
|
||||||
|
else
|
||||||
|
if (context == "outbound@"..domain_name) then
|
||||||
|
dialplan_dir = "outbound";
|
||||||
|
else
|
||||||
|
if (string.len(destination_number) > 6) then
|
||||||
|
dialplan_dir = "outbound";
|
||||||
|
else
|
||||||
|
dialplan_dir = "local";
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--include the dialplans
|
--include the dialplans
|
||||||
result = assert (io.popen ("dir " ..scripts_dir.."/app/dialplan/resources/"..call_direction.." /b -1"));
|
result = assert (io.popen ("dir " ..scripts_dir.."/app/dialplan/resources/"..dialplan_dir.." /b -1"));
|
||||||
for file in result:lines() do
|
for file in result:lines() do
|
||||||
if (string.sub(file, -4) == ".lua") then
|
if (string.sub(file, -4) == ".lua") then
|
||||||
--order = string.match(file, "%d+");
|
if file_exists(scripts_dir.."/app/dialplan/resources/"..dialplan_dir.."/"..file) then
|
||||||
--if (order == nil) then order = file; end
|
dofile(scripts_dir.."/app/dialplan/resources/"..dialplan_dir.."/"..file);
|
||||||
if file_exists(scripts_dir.."/app/dialplan/resources/"..call_direction.."/"..file) then
|
|
||||||
dofile(scripts_dir.."/app/dialplan/resources/"..call_direction.."/"..file);
|
|
||||||
end
|
end
|
||||||
freeswitch.consoleLog("notice", "[app:dialplan] lua: " .. file .. "\n");
|
freeswitch.consoleLog("notice", "[app:dialplan] lua: "..dialplan_dir.."/" .. file .. "\n");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user