Update intercept.lua
This commit is contained in:
@@ -49,9 +49,9 @@
|
|||||||
|
|
||||||
--include json library
|
--include json library
|
||||||
local json
|
local json
|
||||||
if (debug["sql"]) then
|
-- if (debug["sql"]) then
|
||||||
json = require "resources.functions.lunajson"
|
json = require "resources.functions.lunajson"
|
||||||
end
|
-- end
|
||||||
|
|
||||||
--get the hostname
|
--get the hostname
|
||||||
local hostname = trim(api:execute("switchname", ""));
|
local hostname = trim(api:execute("switchname", ""));
|
||||||
@@ -260,7 +260,7 @@
|
|||||||
--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 uuid, call_uuid, hostname FROM channels ";
|
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
|
-- 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.
|
||||||
@@ -286,11 +286,11 @@
|
|||||||
params[param_name] = extension.."@"..domain_name;
|
params[param_name] = extension.."@"..domain_name;
|
||||||
end
|
end
|
||||||
sql = sql .. ") ";
|
sql = sql .. ") ";
|
||||||
sql = sql .. "and call_uuid is not null ";
|
sql = sql .. "AND call_uuid IS NOT NULL ";
|
||||||
sql = sql .. "limit 1 ";
|
sql = sql .. "LIMIT 1 ";
|
||||||
if (debug["sql"]) then
|
--if (debug["sql"]) then
|
||||||
log.noticef("SQL: %s; params: %s", sql, json.encode(params));
|
log.noticef("SQL: %s; params: %s", sql, json.encode(params));
|
||||||
end
|
--end
|
||||||
local is_child
|
local is_child
|
||||||
dbh:query(sql, params, function(row)
|
dbh:query(sql, params, function(row)
|
||||||
--for key, val in pairs(row) do
|
--for key, val in pairs(row) do
|
||||||
@@ -301,7 +301,8 @@
|
|||||||
uuid = row.call_uuid;
|
uuid = row.call_uuid;
|
||||||
call_hostname = row.hostname;
|
call_hostname = row.hostname;
|
||||||
end);
|
end);
|
||||||
|
--log.notice("uuid: "..uuid);
|
||||||
|
--log.notice("call_hostname: "..call_hostname);
|
||||||
if is_child then
|
if is_child then
|
||||||
-- we need intercept `parent` call e.g. call in FIFO/CallCenter Queue
|
-- we need intercept `parent` call e.g. call in FIFO/CallCenter Queue
|
||||||
if (call_hostname == hostname) then
|
if (call_hostname == hostname) then
|
||||||
|
|||||||
Reference in New Issue
Block a user