From a785292811872b87c388e13346472754b1ccf93f Mon Sep 17 00:00:00 2001 From: agree <37550360+greenbea@users.noreply.github.com> Date: Tue, 24 Oct 2023 19:07:55 -0400 Subject: [PATCH] [eavesdrop] Fix eavesdropping wrong uuid (#6815) If the extension is in a call and also receives calls at the same time, the query will return more than one uuid causing to eavesdrop the wrong channel. --- app/switch/resources/scripts/eavesdrop.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/switch/resources/scripts/eavesdrop.lua b/app/switch/resources/scripts/eavesdrop.lua index 9c70d7bae2..73fa6d9b1a 100644 --- a/app/switch/resources/scripts/eavesdrop.lua +++ b/app/switch/resources/scripts/eavesdrop.lua @@ -109,7 +109,7 @@ --check the database to get the uuid to eavesdrop on if (session:ready()) then - local sql = "select uuid from channels where presence_id = :presence_id "; + local sql = "select uuid from channels where presence_id = :presence_id and callstate = 'ACTIVE'"; local params = {presence_id = extension.."@"..domain_name}; if (debug["sql"]) then freeswitch.consoleLog("notice", "[eavesdrop] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");