Prevent call_hostname nil issue by pre-defining it. Improve the uuid nil check to prevent an error.
This commit is contained in:
parent
9cb7a97857
commit
5cdd2561d2
|
|
@ -157,6 +157,7 @@
|
||||||
assert(dbh:connected());
|
assert(dbh:connected());
|
||||||
|
|
||||||
--check the database to get the uuid of a ringing call
|
--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 = "SELECT call_uuid AS uuid, hostname, ip_addr FROM channels ";
|
||||||
sql = sql .. "WHERE callstate = 'RINGING' ";
|
sql = sql .. "WHERE callstate = 'RINGING' ";
|
||||||
sql = sql .. "AND (";
|
sql = sql .. "AND (";
|
||||||
|
|
@ -169,10 +170,10 @@
|
||||||
end
|
end
|
||||||
x = x + 1;
|
x = x + 1;
|
||||||
end
|
end
|
||||||
sql = sql .. ")";
|
sql = sql .. ") ";
|
||||||
if (domain_count > 1) then
|
--if (domain_count > 1) then
|
||||||
sql = sql .. "and context = '"..context.."' ";
|
-- sql = sql .. "and context = '"..context.."' ";
|
||||||
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", "sql "..sql.."\n");
|
||||||
|
|
@ -192,7 +193,7 @@
|
||||||
freeswitch.consoleLog("NOTICE", "Hostname:"..hostname.." Call Hostname:"..call_hostname.."\n");
|
freeswitch.consoleLog("NOTICE", "Hostname:"..hostname.." Call Hostname:"..call_hostname.."\n");
|
||||||
|
|
||||||
--intercept a call that is ringing
|
--intercept a call that is ringing
|
||||||
if (uuid) then
|
if (uuid ~= nil) then
|
||||||
if (hostname == call_hostname) then
|
if (hostname == call_hostname) then
|
||||||
session:execute("intercept", uuid);
|
session:execute("intercept", uuid);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue