From: Rodrigo Ramírez Norambuena Date: Wed, 17 Feb 2016 05:37:43 +0000 (-0300) Subject: app_queue: fix Calculate talktime when is first call answered X-Git-Tag: 13.8.0-rc1~66^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79dc5e2f00e0b78f6278c34740b824eb289d1518;p=thirdparty%2Fasterisk.git 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 --- diff --git a/apps/app_queue.c b/apps/app_queue.c index e77b2be23f..939a0e2ad9 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -5416,9 +5416,13 @@ static int update_queue(struct call_queue *q, struct member *member, int callcom 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; }