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

Anonymous Coward asteriskteam at digium.com
Thu Feb 18 14:44:00 CST 2016


Anonymous Coward #1000019 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:
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved
  George Joseph: Looks good to me, but someone else must approve



diff --git a/apps/app_queue.c b/apps/app_queue.c
index e77b2be..939a0e2 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -5416,9 +5416,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/2270
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I94f79028935913cd9174b090b52bb300b91b9492
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
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>
Gerrit-Reviewer: Rodrigo Ramirez Norambuena <a at rodrigoramirez.com>



More information about the asterisk-code-review mailing list