diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 0b9e319902..d439f44ec3 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II + * Copyright (C) 2005-2016, Anthony Minessale II * * Version: MPL 1.1 * @@ -444,6 +444,8 @@ struct cc_queue { uint32_t max_wait_time; uint32_t max_wait_time_with_no_agent; uint32_t max_wait_time_with_no_agent_time_reached; + uint32_t calls_answered; + uint32_t calls_abandoned; switch_mutex_t *mutex; @@ -722,6 +724,8 @@ static cc_queue_t *load_queue(const char *queue_name) queue->last_agent_exist = 0; queue->last_agent_exist_check = 0; + queue->calls_answered = 0; + queue->calls_abandoned = 0; switch_mutex_init(&queue->mutex, SWITCH_MUTEX_NESTED, queue->pool); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added queue %s\n", queue->name); @@ -2871,6 +2875,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name, cc_member_cancel_reason2str(h->member_cancel_reason)); + queue->calls_abandoned++; } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> is answered by an agent in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); @@ -2883,6 +2888,7 @@ SWITCH_STANDARD_APP(callcenter_function) /* Update some channel variables for xml_cdr needs */ switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", "answered"); + queue->calls_answered++; } @@ -3300,7 +3306,12 @@ SWITCH_STANDARD_API(cc_config_api_function) /* queue list */ if (argc-initial_argc < 1) { switch_hash_index_t *hi; - stream->write_function(stream, "%s", "name|strategy|moh_sound|time_base_score|tier_rules_apply|tier_rule_wait_second|tier_rule_wait_multiply_level|tier_rule_no_agent_no_wait|discard_abandoned_after|abandoned_resume_allowed|max_wait_time|max_wait_time_with_no_agent|max_wait_time_with_no_agent_time_reached|record_template\n"); + stream->write_function(stream, "%s", + "name|strategy|moh_sound|time_base_score|tier_rules_apply|"\ + "tier_rule_wait_second|tier_rule_wait_multiply_level|"\ + "tier_rule_no_agent_no_wait|discard_abandoned_after|"\ + "abandoned_resume_allowed|max_wait_time|max_wait_time_with_no_agent|"\ + "max_wait_time_with_no_agent_time_reached|record_template|calls_answered|calls_abandoned\n"); switch_mutex_lock(globals.mutex); for (hi = switch_core_hash_first(globals.queue_hash); hi; hi = switch_core_hash_next(&hi)) { void *val = NULL; @@ -3309,7 +3320,23 @@ SWITCH_STANDARD_API(cc_config_api_function) cc_queue_t *queue; switch_core_hash_this(hi, &key, &keylen, &val); queue = (cc_queue_t *) val; - stream->write_function(stream, "%s|%s|%s|%s|%s|%d|%s|%s|%d|%s|%d|%d|%d|%s\n", queue->name, queue->strategy, queue->moh, queue->time_base_score, (queue->tier_rules_apply?"true":"false"), queue->tier_rule_wait_second, (queue->tier_rule_wait_multiply_level?"true":"false"), (queue->tier_rule_no_agent_no_wait?"true":"false"), queue->discard_abandoned_after, (queue->abandoned_resume_allowed?"true":"false"), queue->max_wait_time, queue->max_wait_time_with_no_agent, queue->max_wait_time_with_no_agent_time_reached, queue->record_template); + stream->write_function(stream, "%s|%s|%s|%s|%s|%d|%s|%s|%d|%s|%d|%d|%d|%s|%d|%d\n", + queue->name, + queue->strategy, + queue->moh, + queue->time_base_score, + (queue->tier_rules_apply?"true":"false"), + queue->tier_rule_wait_second, + (queue->tier_rule_wait_multiply_level?"true":"false"), + (queue->tier_rule_no_agent_no_wait?"true":"false"), + queue->discard_abandoned_after, + (queue->abandoned_resume_allowed?"true":"false"), + queue->max_wait_time, + queue->max_wait_time_with_no_agent, + queue->max_wait_time_with_no_agent_time_reached, + queue->record_template, + queue->calls_answered, + queue->calls_abandoned); queue = NULL; } switch_mutex_unlock(globals.mutex);