[Asterisk-code-review] Fixed wrong queue stat calculation (asterisk[master])

sungtae kim asteriskteam at digium.com
Thu Aug 17 16:53:54 CDT 2017


sungtae kim has uploaded this change for review. ( https://gerrit.asterisk.org/6246


Change subject: Fixed wrong queue stat calculation
......................................................................

Fixed wrong queue stat calculation

Fixed to use correct initial value and fixed to use the
correct queue info to check the first value.

ASTERISK-27204

Change-Id: Ia9e36c828e566e1cc25c66f73307566e4acb8e73
---
M apps/app_queue.c
1 file changed, 7 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/46/6246/1

diff --git a/apps/app_queue.c b/apps/app_queue.c
index 004d93a..b139ef7 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4072,8 +4072,12 @@
 	/* 2^2 (4) is the filter coefficient; a higher exponent would give old entries more weight */
 
 	ao2_lock(qe->parent);
-	oldvalue = qe->parent->holdtime;
-	qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newholdtime) >> 2;
+	if ((qe->parent->callscompleted + qe->parent->callsabandoned) == 0) {
+		qe->parent->holdtime = newholdtime;
+	} else {
+		oldvalue = qe->parent->holdtime;
+		qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newholdtime) >> 2;
+	}
 	ao2_unlock(qe->parent);
 }
 
@@ -5651,7 +5655,7 @@
 	if (callcompletedinsl) {
 		q->callscompletedinsl++;
 	}
-	if (q->callscompletedinsl == 1) {
+	if (q->callscompleted == 1) {
 		q->talktime = newtalktime;
 	} else {
 		/* Calculate talktime using the same exponential average as holdtime code */

-- 
To view, visit https://gerrit.asterisk.org/6246
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9e36c828e566e1cc25c66f73307566e4acb8e73
Gerrit-Change-Number: 6246
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170817/0ff3ed19/attachment.html>


More information about the asterisk-code-review mailing list