From d4f845ed0832659791bc07abd63350e1c901ba98 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Mon, 14 Mar 2011 12:42:02 -0400 Subject: [PATCH] =?UTF-8?q?mod=5Fcallcenter:=20Should=20resolve=20lot=20of?= =?UTF-8?q?=20loopback=20issues=20mentioned.=20=20Thanks=20to=20Fran=C3=A7?= =?UTF-8?q?ois=20Delawarde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mod_callcenter/mod_callcenter.c | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 84ff411b4d..65ad78f5d8 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1399,8 +1399,6 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_agent", "%s", h->agent_name); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_agent_type", "%s", h->agent_type); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "ignore_early_media", "true"); - /* Force loopback to remain live, if not, the loop will detect the actual channel to gone */ - switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "loopback_bowout", "false"); t_agent_called = switch_epoch_time_now(NULL); dialstr = switch_mprintf("%s", h->originate_string); @@ -1445,9 +1443,36 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa const char *agent_uuid = switch_core_session_get_uuid(agent_session); switch_channel_t *member_channel = switch_core_session_get_channel(member_session); switch_channel_t *agent_channel = switch_core_session_get_channel(agent_session); + const char *other_loopback_leg_uuid = switch_channel_get_variable(agent_channel, "other_loopback_leg_uuid"); switch_channel_set_variable(agent_channel, "cc_member_pre_answer_uuid", NULL); + /* Loopback special case */ + if (other_loopback_leg_uuid) { + switch_core_session_t *other_loopback_session = switch_core_session_locate(other_loopback_leg_uuid); + if (other_loopback_session) { + switch_channel_t *other_loopback_channel = switch_core_session_get_channel(other_loopback_session); + const char *real_uuid = switch_channel_get_variable(other_loopback_channel, SWITCH_SIGNAL_BOND_VARIABLE); + + switch_channel_set_variable(other_loopback_channel, "cc_member_pre_answer_uuid", NULL); + + /* Switch the agent session */ + if (real_uuid) { + switch_core_session_rwunlock(agent_session); + agent_uuid = real_uuid; + agent_session = switch_core_session_locate(agent_uuid); + agent_channel = switch_core_session_get_channel(agent_session); + + switch_channel_set_variable(agent_channel, "cc_queue", h->queue_name); + switch_channel_set_variable(agent_channel, "cc_agent", h->agent_name); + switch_channel_set_variable(agent_channel, "cc_agent_type", h->agent_type); + switch_channel_set_variable(agent_channel, "cc_member_uuid", h->member_uuid); + } + switch_core_session_rwunlock(other_loopback_session); + } + } + + if (!strcasecmp(h->queue_strategy,"ring-all")) { char res[256]; /* Map the Agent to the member */