[Asterisk-code-review] app queue: Fix initial hold time queue statistic (asterisk[14])

sungtae kim asteriskteam at digium.com
Tue Aug 22 08:28:12 CDT 2017


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


Change subject: app_queue: Fix initial hold time queue statistic
......................................................................

app_queue: Fix initial hold time queue statistic

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/56/6256/1

diff --git a/apps/app_queue.c b/apps/app_queue.c
index 4a15e28..6324a0b 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4000,8 +4000,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);
 }
 
@@ -5556,7 +5560,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/6256
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9e36c828e566e1cc25c66f73307566e4acb8e73
Gerrit-Change-Number: 6256
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/20170822/a06d900c/attachment.html>


More information about the asterisk-code-review mailing list