mod_callcenter: fix tracking agent external calls - prevent multiple track per channel

This commit is contained in:
Antonio Silva 2020-05-07 17:52:06 +02:00 committed by António Silva
parent bc8e3da74c
commit ed206b07e7
1 changed files with 6 additions and 0 deletions

View File

@ -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);