summaryrefslogtreecommitdiff
path: root/apps/app_queue.c
diff options
context:
space:
mode:
authorRodrigo Ramírez Norambuena <a@rodrigoramirez.com>2016-02-17 02:37:43 -0300
committerRodrigo Ramirez Norambuena <a@rodrigoramirez.com>2016-02-17 15:04:16 -0600
commit79dc5e2f00e0b78f6278c34740b824eb289d1518 (patch)
tree87a221585a26e25d12580080929210db797f13f5 /apps/app_queue.c
parent87ab65c557eccfe91c8aea6eba0568aa96de6412 (diff)
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
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r--apps/app_queue.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index e77b2be23..939a0e2ad 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;
}