Fixed intercept
Remove from SQL where as the call_uuid is not always used
This commit is contained in:
@@ -54,7 +54,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
--get the hostname
|
--get the hostname
|
||||||
local hostname = trim(api:execute("switchname", ""));
|
local hostname = trim(api:execute("hostname", ""));
|
||||||
|
|
||||||
-- redirect call to another box
|
-- redirect call to another box
|
||||||
local function make_proxy_call(destination, call_hostname)
|
local function make_proxy_call(destination, call_hostname)
|
||||||
@@ -286,7 +286,7 @@
|
|||||||
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 .. "ORDER BY created_epoch DESC LIMIT 1 ";
|
sql = sql .. "ORDER BY created_epoch DESC 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));
|
||||||
@@ -294,14 +294,17 @@
|
|||||||
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
|
||||||
-- log.notice("row "..key.." "..val);
|
-- log.notice("row "..key.." "..val);
|
||||||
--end
|
--end
|
||||||
--log.notice("-----------------------");
|
--log.notice("-----------------------");
|
||||||
is_child = (row.uuid == row.call_uuid)
|
is_child = (row.uuid == row.call_uuid)
|
||||||
uuid = row.call_uuid;
|
uuid = row.uuid;
|
||||||
|
if (row.call_uuid) then
|
||||||
|
uuid = row.call_uuid;
|
||||||
|
end
|
||||||
call_hostname = row.hostname;
|
call_hostname = row.hostname;
|
||||||
end);
|
end);
|
||||||
--log.notice("uuid: "..uuid);
|
|
||||||
--log.notice("call_hostname: "..call_hostname);
|
--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
|
||||||
@@ -348,6 +351,7 @@
|
|||||||
if (uuid ~= nil) then
|
if (uuid ~= nil) then
|
||||||
if (session:getVariable("billmsec") == nil) then
|
if (session:getVariable("billmsec") == nil) then
|
||||||
if (hostname == call_hostname) then
|
if (hostname == call_hostname) then
|
||||||
|
log.noticef("intercept `%s`.", uuid)
|
||||||
session:execute("intercept", uuid);
|
session:execute("intercept", uuid);
|
||||||
else
|
else
|
||||||
session:execute("export", "sip_h_X-intercept_uuid="..uuid);
|
session:execute("export", "sip_h_X-intercept_uuid="..uuid);
|
||||||
@@ -385,3 +389,4 @@
|
|||||||
--cmd = "originate user/1007@voip.example.com &intercept("..uuid..")";
|
--cmd = "originate user/1007@voip.example.com &intercept("..uuid..")";
|
||||||
--api = freeswitch.API();
|
--api = freeswitch.API();
|
||||||
--result = api:executeString(cmd);
|
--result = api:executeString(cmd);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user