[Asterisk-code-review] app queue: fix Calculate talktime when is first call answered (asterisk[master])

Rodrigo Ramirez Norambuena asteriskteam at digium.com
Wed Feb 17 11:51:42 CST 2016


Rodrigo Ramirez Norambuena has uploaded a new change for review.

  https://gerrit.asterisk.org/2264

Change subject: app_queue: fix Calculate talktime when is first call answered
......................................................................

app_queue: fix Calculate talktime when is first call answered

Fix calculate of average time for talktime is wrong when is completed the
first call beacuse the time for talked would be that call.

ASTERISK-25800 #close

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


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/64/2264/1

diff --git a/apps/app_queue.c b/apps/app_queue.c
index 15f32fa..776ada4 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -5441,9 +5441,13 @@
 	if (callcompletedinsl) {
 		q->callscompletedinsl++;
 	}
-	/* Calculate talktime using the same exponential average as holdtime code*/
-	oldtalktime = q->talktime;
-	q->talktime = (((oldtalktime << 2) - oldtalktime) + newtalktime) >> 2;
+	if (q->callscompletedinsl == 1) {
+		q->talktime = newtalktime;
+	} else {
+		/* Calculate talktime using the same exponential average as holdtime code */
+		oldtalktime = q->talktime;
+		q->talktime = (((oldtalktime << 2) - oldtalktime) + newtalktime) >> 2;
+	}
 	ao2_unlock(q);
 	return 0;
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I94f79028935913cd9174b090b52bb300b91b9492
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Rodrigo Ramirez Norambuena <a at rodrigoramirez.com>



More information about the asterisk-code-review mailing list