Merge pull request #1091 from moteus/intercept_outbound

Fix. Allow intercept only outbound calls.
This commit is contained in:
FusionPBX 2015-08-12 23:34:43 -06:00
commit 72d489ec65
2 changed files with 9 additions and 5 deletions

View File

@ -120,7 +120,8 @@ if ( session:ready() ) then
--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 = sql .. "where callstate = 'RINGING' ";
sql = sql .. "where callstate in ('RINGING', 'EARLY') ";
sql = sql .. "AND direction = 'outbound' ";
if (extension) then
sql = sql .. "and presence_id = '"..extension.."@"..domain_name.."' ";
else

View File

@ -110,7 +110,7 @@
sql = sql .. "OR number_alias = '"..caller_id_number.."')";
status = dbh:query(sql, function(row)
call_group = row.call_group;
freeswitch.consoleLog("NOTICE", "result "..call_group.."\n");
freeswitch.consoleLog("NOTICE", "[intercept_group] call_group: "..call_group.."\n");
end);
call_groups = explode(",", call_group);
@ -135,7 +135,9 @@
end
x = 0;
sql = sql .. ") ";
freeswitch.consoleLog("NOTICE", "result "..sql.."\n");
if (debug["sql"]) then
freeswitch.consoleLog("NOTICE", "[intercept_group] sql "..sql.."\n");
end
extensions = {}
status = dbh:query(sql, function(row)
local member = row.extension
@ -162,7 +164,8 @@
--check the database to get the uuid of a ringing call
call_hostname = "";
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 (";
x = 0;
for key,extension in pairs(extensions) do
@ -180,7 +183,7 @@
--end
sql = sql .. "limit 1 ";
if (debug["sql"]) then
freeswitch.consoleLog("NOTICE", "sql "..sql.."\n");
freeswitch.consoleLog("NOTICE", "[intercept_group] sql "..sql.."\n");
end
dbh:query(sql, function(row)
--for key, val in pairs(row) do