From ed32dfd47437cf01b52485ce79e37daf3e058071 Mon Sep 17 00:00:00 2001 From: Antonio Silva Date: Thu, 11 Jul 2024 18:04:15 +0200 Subject: [PATCH 1/2] mod_callcenter: fix agent zombie call --- src/mod/applications/mod_callcenter/mod_callcenter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index b035b6d7f9..3ed5c1b5fa 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1771,7 +1771,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa dialstr = switch_channel_expand_variables(member_channel, h->originate_string); switch_channel_set_app_flag_key(CC_APP_KEY, member_channel, CC_APP_AGENT_CONNECTING); - status = switch_ivr_originate(NULL, &agent_session, &cause, dialstr, globals.agent_originate_timeout, NULL, cid_name ? cid_name : h->member_cid_name, cid_number ? cid_number : h->member_cid_number, NULL, ovars, SOF_NONE, NULL, NULL); + status = switch_ivr_originate(member_session, &agent_session, &cause, dialstr, globals.agent_originate_timeout, NULL, cid_name ? cid_name : h->member_cid_name, cid_number ? cid_number : h->member_cid_number, NULL, ovars, SOF_NONE, NULL, NULL); /* Search for loopback agent */ if (status == SWITCH_STATUS_SUCCESS) { From 8c5727e26bd7dfcb13e3e57515d91b4fe527d774 Mon Sep 17 00:00:00 2001 From: Antonio Silva Date: Mon, 15 Jul 2024 17:08:30 +0100 Subject: [PATCH 2/2] mod_callcenter: try to fix #2529 hangup the call when answered - already answered by other agent --- src/mod/applications/mod_callcenter/mod_callcenter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 3ed5c1b5fa..cc5875e303 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1922,6 +1922,8 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_safe_free(sql); if (atoi(res) == 0) { + /* Unexpected, it's possible the agent channel wasn't created when the agent that won the race was connected, so hangup the channel */ + switch_channel_hangup(switch_core_session_get_channel(agent_session), SWITCH_CAUSE_LOSE_RACE); goto done; } switch_core_session_hupall_matching_var("cc_member_pre_answer_uuid", h->member_uuid, SWITCH_CAUSE_LOSE_RACE);