Fix the call_direction.
This commit is contained in:
@@ -1,9 +1,22 @@
|
||||
-- FusionPBX
|
||||
-- Version: MPL 1.1
|
||||
|
||||
-- The contents of this file are subject to the Mozilla Public License Version
|
||||
-- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
-- the License. You may obtain a copy of the License at
|
||||
-- http://www.mozilla.org/MPL/
|
||||
|
||||
--include config.lua
|
||||
--scripts_dir = string.sub(debug.getinfo(1).source,2,string.len(debug.getinfo(1).source)-(string.len(argv[0])+1));
|
||||
--dofile(scripts_dir.."/resources/functions/config.lua");
|
||||
--dofile(config());
|
||||
-- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
-- for the specific language governing rights and limitations under the
|
||||
-- License.
|
||||
|
||||
-- The Original Code is FusionPBX
|
||||
|
||||
-- The Initial Developer of the Original Code is
|
||||
-- Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- Portions created by the Initial Developer are Copyright (C) 2014
|
||||
-- the Initial Developer. All Rights Reserved.
|
||||
|
||||
--add functions
|
||||
dofile(scripts_dir.."/resources/functions/file_exists.lua");
|
||||
@@ -17,19 +30,26 @@
|
||||
--unix
|
||||
-- dir /usr/local/freeswitch/scripts -1
|
||||
|
||||
|
||||
--set local variables
|
||||
local context = session:getVariable("context");
|
||||
local destination_number = session:getVariable("destination_number");
|
||||
local call_direction = session:getVariable("call_direction");
|
||||
local domain_name = session:getVariable("domain_name");
|
||||
|
||||
--determine the call direction
|
||||
if (context == "public") then
|
||||
call_direction = "inbound";
|
||||
else
|
||||
if (string.len(destination_number) > 6) then
|
||||
call_direction = "outbound";
|
||||
else
|
||||
call_direction = "local";
|
||||
if (call_direction == nil) then
|
||||
if (context == "outbound@"..domain_name) then
|
||||
call_direction = "outbound";
|
||||
else
|
||||
if (string.len(destination_number) > 6) then
|
||||
call_direction = "outbound";
|
||||
else
|
||||
call_direction = "local";
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user