From ed206b07e73c5ce9af6ec803bfbcf746dc7e41c8 Mon Sep 17 00:00:00 2001 From: Antonio Silva Date: Thu, 7 May 2020 17:52:06 +0200 Subject: [PATCH] mod_callcenter: fix tracking agent external calls - prevent multiple track per channel --- src/mod/applications/mod_callcenter/mod_callcenter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index f59b744098..54f6bd1cb9 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -3336,6 +3336,7 @@ SWITCH_STANDARD_APP(callcenter_track) char agent_status[255]; char *agent_name = NULL; char *sql = NULL; + const char *tracked_agent = NULL; if (zstr(data)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing agent name\n"); @@ -3347,6 +3348,11 @@ SWITCH_STANDARD_APP(callcenter_track) return; } + if ((tracked_agent = switch_channel_get_variable(channel, "cc_tracked_agent"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Already tracking agent %s in this channel.", tracked_agent); + return; + } + agent_name = switch_safe_strdup(data); switch_channel_set_variable(channel, "cc_tracked_agent", agent_name);