From 50714ec5e4eb14976695ff29bc6528e0b9a16862 Mon Sep 17 00:00:00 2001
From: Italo Rossi <italorossib@gmail.com>
Date: Tue, 27 Dec 2016 21:35:17 -0300
Subject: [PATCH] [mod_callcenter] FS-9891: Get queue again to increase calls
 answered and abandoned

---
 src/mod/applications/mod_callcenter/mod_callcenter.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c
index 6eabeeba59..88250aefe0 100644
--- a/src/mod/applications/mod_callcenter/mod_callcenter.c
+++ b/src/mod/applications/mod_callcenter/mod_callcenter.c
@@ -3122,8 +3122,9 @@ 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 = get_queue(queue_name);
 		queue->calls_abandoned++;
-
+		queue_rwunlock(queue);
 	} 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);
 
@@ -3135,7 +3136,9 @@ 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 = get_queue(queue_name);
 		queue->calls_answered++;
+		queue_rwunlock(queue);
 
 	}