Add. optional intercept only inbound/outbound calls.
Note. * `inbound` is call to some extension * `outbound` is call from some extension to external number. Currently there no way to find call from extension to extension as `outbound`
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
--user defined variables
|
--user defined variables
|
||||||
local extension = argv[1];
|
local extension = argv[1];
|
||||||
|
local direction = argv[2] or extension and 'inbound' or 'all';
|
||||||
|
|
||||||
-- we can use any number because other box should check sip_h_X_*** headers first
|
-- we can use any number because other box should check sip_h_X_*** headers first
|
||||||
local pickup_number = '*8' -- extension and '**' or '*8'
|
local pickup_number = '*8' -- extension and '**' or '*8'
|
||||||
@@ -254,9 +255,20 @@
|
|||||||
-- next check should prevent pickup call from extension
|
-- next check should prevent pickup call from extension
|
||||||
-- e.g. if extension 100 dial some cell phone and some one else dial *8
|
-- e.g. if extension 100 dial some cell phone and some one else dial *8
|
||||||
-- he can pickup this call.
|
-- he can pickup this call.
|
||||||
if not extension then
|
if not direction:find('all') then
|
||||||
sql = sql .. "AND direction = 'outbound' ";
|
sql = sql .. "AND (1 <> 1 "
|
||||||
|
-- calls from freeswitch to user
|
||||||
|
if direction:find('inbound') then
|
||||||
|
sql = sql .. "OR direction = 'outbound' ";
|
||||||
|
end
|
||||||
|
|
||||||
|
-- calls from user to freeswitch
|
||||||
|
if direction:find('outbound') then
|
||||||
|
sql = sql .. "OR direction = 'inbound' ";
|
||||||
|
end
|
||||||
|
sql = sql .. ")"
|
||||||
end
|
end
|
||||||
|
|
||||||
sql = sql .. "AND (1<>1 ";
|
sql = sql .. "AND (1<>1 ";
|
||||||
for key,extension in pairs(extensions) do
|
for key,extension in pairs(extensions) do
|
||||||
sql = sql .. "OR presence_id = '"..extension.."@"..domain_name.."' ";
|
sql = sql .. "OR presence_id = '"..extension.."@"..domain_name.."' ";
|
||||||
|
|||||||
@@ -15,4 +15,7 @@
|
|||||||
-- The Original Code is FusionPBX
|
-- The Original Code is FusionPBX
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- shift arguments
|
||||||
|
argv[1], argv[2] = nil, argv[1]
|
||||||
|
|
||||||
require "intercept"
|
require "intercept"
|
||||||
|
|||||||
Reference in New Issue
Block a user