[asterisk-commits] app queue: fix Calculate talktime when is first call answered (asterisk[11])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 18 13:38:23 CST 2016


Joshua Colp has submitted this change and it was merged.

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(-)

Approvals:
  Joshua Colp: Looks good to me, approved; Verified
  George Joseph: Looks good to me, but someone else must approve



diff --git a/apps/app_queue.c b/apps/app_queue.c
index 78ac4c5..4a80290 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4950,9 +4950,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/2269
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I94f79028935913cd9174b090b52bb300b91b9492
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Rodrigo Ramirez Norambuena <a at rodrigoramirez.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list