From 8e9dfba2763fc849aed171cd1c9d5409660e609e Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 10 Dec 2011 20:45:25 -0500 Subject: [PATCH] mod_callcenter: Bring up to date the max-wait-time-with-no-agent and max-wait-time-with-no-agent-time-reached param. I'll probably rename the param max-wait-time-with-no-agent-time-reached to something that actually make sense in the future --- .../mod_callcenter/mod_callcenter.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 05b7b8c635..b8353fae8c 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2284,9 +2284,20 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj } /* Will drop the caller if no agent was found for more than X seconds */ - if (queue->max_wait_time_with_no_agent > 0 && m->t_member_called < queue->last_agent_exist_check - queue->max_wait_time_with_no_agent_time_reached && - queue->last_agent_exist_check - queue->last_agent_exist >= queue->max_wait_time_with_no_agent) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> in queue '%s' reached max wait with no agent time\n", m->member_cid_name, m->member_cid_number, m->queue_name); + if (queue->max_wait_time_with_no_agent > 0 && + (queue->last_agent_exist >= m->t_member_called || queue->max_wait_time_with_no_agent_time_reached == 0) && + queue->last_agent_exist_check - queue->last_agent_exist > queue->max_wait_time_with_no_agent) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> in queue '%s' reached max wait of %d sec. with no agent\n", m->member_cid_name, m->member_cid_number, m->queue_name, queue->max_wait_time_with_no_agent); + m->member_cancel_reason = CC_MEMBER_CANCEL_REASON_NO_AGENT_TIMEOUT; + switch_channel_set_flag_value(member_channel, CF_BREAK, 2); + } + + /* Will drop the NEW caller if no agent was found for more than X seconds once they join */ + if (queue->max_wait_time_with_no_agent_time_reached > 0 && + queue->last_agent_exist < m->t_member_called && + queue->last_agent_exist_check - queue->last_agent_exist > queue->max_wait_time_with_no_agent && + queue->last_agent_exist_check - m->t_member_called >= queue->max_wait_time_with_no_agent_time_reached) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> in queue '%s' reached max wait of %d sec. with no agent plus join grace period of %d sec.\n", m->member_cid_name, m->member_cid_number, m->queue_name, queue->max_wait_time_with_no_agent, queue->max_wait_time_with_no_agent_time_reached); m->member_cancel_reason = CC_MEMBER_CANCEL_REASON_NO_AGENT_TIMEOUT; switch_channel_set_flag_value(member_channel, CF_BREAK, 2); }