Merge pull request #1091 from moteus/intercept_outbound
Fix. Allow intercept only outbound calls.
This commit is contained in:
@@ -120,7 +120,8 @@ if ( session:ready() ) then
|
|||||||
|
|
||||||
--check the database to get the uuid of a ringing call
|
--check the database to get the uuid of a ringing call
|
||||||
sql = "select call_uuid as uuid, hostname, callee_num, ip_addr from channels ";
|
sql = "select call_uuid as uuid, hostname, callee_num, ip_addr from channels ";
|
||||||
sql = sql .. "where callstate = 'RINGING' ";
|
sql = sql .. "where callstate in ('RINGING', 'EARLY') ";
|
||||||
|
sql = sql .. "AND direction = 'outbound' ";
|
||||||
if (extension) then
|
if (extension) then
|
||||||
sql = sql .. "and presence_id = '"..extension.."@"..domain_name.."' ";
|
sql = sql .. "and presence_id = '"..extension.."@"..domain_name.."' ";
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
sql = sql .. "OR number_alias = '"..caller_id_number.."')";
|
sql = sql .. "OR number_alias = '"..caller_id_number.."')";
|
||||||
status = dbh:query(sql, function(row)
|
status = dbh:query(sql, function(row)
|
||||||
call_group = row.call_group;
|
call_group = row.call_group;
|
||||||
freeswitch.consoleLog("NOTICE", "result "..call_group.."\n");
|
freeswitch.consoleLog("NOTICE", "[intercept_group] call_group: "..call_group.."\n");
|
||||||
end);
|
end);
|
||||||
call_groups = explode(",", call_group);
|
call_groups = explode(",", call_group);
|
||||||
|
|
||||||
@@ -135,7 +135,9 @@
|
|||||||
end
|
end
|
||||||
x = 0;
|
x = 0;
|
||||||
sql = sql .. ") ";
|
sql = sql .. ") ";
|
||||||
freeswitch.consoleLog("NOTICE", "result "..sql.."\n");
|
if (debug["sql"]) then
|
||||||
|
freeswitch.consoleLog("NOTICE", "[intercept_group] sql "..sql.."\n");
|
||||||
|
end
|
||||||
extensions = {}
|
extensions = {}
|
||||||
status = dbh:query(sql, function(row)
|
status = dbh:query(sql, function(row)
|
||||||
local member = row.extension
|
local member = row.extension
|
||||||
@@ -162,7 +164,8 @@
|
|||||||
--check the database to get the uuid of a ringing call
|
--check the database to get the uuid of a ringing call
|
||||||
call_hostname = "";
|
call_hostname = "";
|
||||||
sql = "SELECT call_uuid AS uuid, hostname, ip_addr FROM channels ";
|
sql = "SELECT call_uuid AS uuid, hostname, ip_addr FROM channels ";
|
||||||
sql = sql .. "WHERE callstate = 'RINGING' ";
|
sql = sql .. "WHERE callstate in ('RINGING', 'EARLY') ";
|
||||||
|
sql = sql .. "AND direction = 'outbound' ";
|
||||||
sql = sql .. "AND (";
|
sql = sql .. "AND (";
|
||||||
x = 0;
|
x = 0;
|
||||||
for key,extension in pairs(extensions) do
|
for key,extension in pairs(extensions) do
|
||||||
@@ -180,7 +183,7 @@
|
|||||||
--end
|
--end
|
||||||
sql = sql .. "limit 1 ";
|
sql = sql .. "limit 1 ";
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("NOTICE", "sql "..sql.."\n");
|
freeswitch.consoleLog("NOTICE", "[intercept_group] sql "..sql.."\n");
|
||||||
end
|
end
|
||||||
dbh:query(sql, function(row)
|
dbh:query(sql, function(row)
|
||||||
--for key, val in pairs(row) do
|
--for key, val in pairs(row) do
|
||||||
|
|||||||
Reference in New Issue
Block a user