Update intercept.lua
This commit is contained in:
parent
9fdb3bf649
commit
dd37b89353
|
|
@ -49,9 +49,9 @@
|
|||
|
||||
--include json library
|
||||
local json
|
||||
if (debug["sql"]) then
|
||||
-- if (debug["sql"]) then
|
||||
json = require "resources.functions.lunajson"
|
||||
end
|
||||
-- end
|
||||
|
||||
--get the hostname
|
||||
local hostname = trim(api:execute("switchname", ""));
|
||||
|
|
@ -260,7 +260,7 @@
|
|||
--check the database to get the uuid of a ringing call
|
||||
call_hostname = "";
|
||||
sql = "SELECT uuid, call_uuid, hostname FROM channels ";
|
||||
sql = sql .. "WHERE callstate in ('RINGING', 'EARLY') ";
|
||||
sql = sql .. "WHERE callstate IN ('RINGING', 'EARLY') ";
|
||||
-- next check should prevent pickup call from extension
|
||||
-- e.g. if extension 100 dial some cell phone and some one else dial *8
|
||||
-- he can pickup this call.
|
||||
|
|
@ -286,11 +286,11 @@
|
|||
params[param_name] = extension.."@"..domain_name;
|
||||
end
|
||||
sql = sql .. ") ";
|
||||
sql = sql .. "and call_uuid is not null ";
|
||||
sql = sql .. "limit 1 ";
|
||||
if (debug["sql"]) then
|
||||
sql = sql .. "AND call_uuid IS NOT NULL ";
|
||||
sql = sql .. "LIMIT 1 ";
|
||||
--if (debug["sql"]) then
|
||||
log.noticef("SQL: %s; params: %s", sql, json.encode(params));
|
||||
end
|
||||
--end
|
||||
local is_child
|
||||
dbh:query(sql, params, function(row)
|
||||
--for key, val in pairs(row) do
|
||||
|
|
@ -301,7 +301,8 @@
|
|||
uuid = row.call_uuid;
|
||||
call_hostname = row.hostname;
|
||||
end);
|
||||
|
||||
--log.notice("uuid: "..uuid);
|
||||
--log.notice("call_hostname: "..call_hostname);
|
||||
if is_child then
|
||||
-- we need intercept `parent` call e.g. call in FIFO/CallCenter Queue
|
||||
if (call_hostname == hostname) then
|
||||
|
|
|
|||
Loading…
Reference in New Issue