From 74401ed00b256238bee0c9e452a765ca37b71628 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sun, 27 Jan 2013 15:06:43 -0500 Subject: [PATCH] FS-3924 --resolve --- .../mod_callcenter/mod_callcenter.c | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index bab093ae8e..a2c6d7dc85 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -245,7 +245,6 @@ static char tiers_sql[] = " position INTEGER NOT NULL DEFAULT 1\n" ");\n"; static switch_xml_config_int_options_t config_int_0_86400 = { SWITCH_TRUE, 0, SWITCH_TRUE, 86400 }; -static switch_xml_config_int_options_t config_int_5_86400 = { SWITCH_TRUE, 5, SWITCH_TRUE, 86400 }; /* TODO This is temporary until we either move it to the core, or use it differently in the module */ switch_time_t local_epoch_time_now(switch_time_t *t) @@ -548,7 +547,7 @@ cc_queue_t *queue_set_config(cc_queue_t *queue) SWITCH_CONFIG_SET_ITEM(queue->config[i++], "max-wait-time", SWITCH_CONFIG_INT, 0, &queue->max_wait_time, 0, &config_int_0_86400, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "max-wait-time-with-no-agent", SWITCH_CONFIG_INT, 0, &queue->max_wait_time_with_no_agent, 0, &config_int_0_86400, NULL, NULL); - SWITCH_CONFIG_SET_ITEM(queue->config[i++], "max-wait-time-with-no-agent-time-reached", SWITCH_CONFIG_INT, 0, &queue->max_wait_time_with_no_agent_time_reached, 5, &config_int_5_86400, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "max-wait-time-with-no-agent-time-reached", SWITCH_CONFIG_INT, 0, &queue->max_wait_time_with_no_agent_time_reached, 5, &config_int_0_86400, NULL, NULL); switch_assert(i < CC_QUEUE_CONFIGITEM_COUNT); @@ -2306,23 +2305,22 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj switch_channel_set_flag_value(member_channel, CF_BREAK, 2); } - /* Will drop the caller if no agent was found for more than X seconds */ - 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); - } + if (queue->max_wait_time_with_no_agent > 0 && queue->last_agent_exist_check > queue->last_agent_exist) { + if (queue->last_agent_exist_check - queue->last_agent_exist >= queue->max_wait_time_with_no_agent) { + if (queue->max_wait_time_with_no_agent_time_reached > 0) { + if (queue->last_agent_exist_check - m->t_member_called >= queue->max_wait_time_with_no_agent + 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); - /* 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); + } + } else { + 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); + + } + } } /* TODO Go thought the list of phrases */