]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_queue: fix Calculate talktime when is first call answered 69/2269/1
authorRodrigo Ramírez Norambuena <a@rodrigoramirez.com>
Wed, 17 Feb 2016 05:37:43 +0000 (02:37 -0300)
committerRodrigo Ramirez Norambuena <a@rodrigoramirez.com>
Wed, 17 Feb 2016 21:04:01 +0000 (15:04 -0600)
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

apps/app_queue.c

index 78ac4c5dcdc714bbe0173292a41728d96ba84c44..4a8029080d4b88a34a84f8d2b20491ba1dcbf6f0 100644 (file)
@@ -4950,9 +4950,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;
 }