From 5cdd2561d2fd6118707a35bfbc6ba95da9abf02c Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sun, 7 Dec 2014 02:06:32 +0000 Subject: [PATCH] Prevent call_hostname nil issue by pre-defining it. Improve the uuid nil check to prevent an error. --- resources/install/scripts/intercept_group.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/resources/install/scripts/intercept_group.lua b/resources/install/scripts/intercept_group.lua index 50bb8cd361..aac8b9df06 100644 --- a/resources/install/scripts/intercept_group.lua +++ b/resources/install/scripts/intercept_group.lua @@ -157,6 +157,7 @@ assert(dbh:connected()); --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 .. "AND ("; @@ -169,10 +170,10 @@ end x = x + 1; end - sql = sql .. ")"; - if (domain_count > 1) then - sql = sql .. "and context = '"..context.."' "; - end + sql = sql .. ") "; + --if (domain_count > 1) then + -- sql = sql .. "and context = '"..context.."' "; + --end sql = sql .. "limit 1 "; if (debug["sql"]) then freeswitch.consoleLog("NOTICE", "sql "..sql.."\n"); @@ -192,7 +193,7 @@ freeswitch.consoleLog("NOTICE", "Hostname:"..hostname.." Call Hostname:"..call_hostname.."\n"); --intercept a call that is ringing - if (uuid) then + if (uuid ~= nil) then if (hostname == call_hostname) then session:execute("intercept", uuid); else