diff options
author | Sungtae Kim <pchero21@gmail.com> | 2017-08-17 23:46:49 +0200 |
---|---|---|
committer | sungtae kim <pchero21@gmail.com> | 2017-08-22 08:28:11 -0500 |
commit | a4bf6d216b2faf46682f910794182d0b6592db66 (patch) | |
tree | 3af42f381d715e7b7b9bae20902d7e44ba92b896 /apps | |
parent | 4246900c0157ddd04e7a30a5cde04a7d09245dde (diff) |
app_queue: Fix initial hold time queue statistic
Fixed to use correct initial value and fixed to use the
correct queue info to check the first value.
ASTERISK-27204
Change-Id: Ia9e36c828e566e1cc25c66f73307566e4acb8e73
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_queue.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index 4a15e28a1..6324a0b68 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -4000,8 +4000,12 @@ static void recalc_holdtime(struct queue_ent *qe, int newholdtime) /* 2^2 (4) is the filter coefficient; a higher exponent would give old entries more weight */ ao2_lock(qe->parent); - oldvalue = qe->parent->holdtime; - qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newholdtime) >> 2; + if ((qe->parent->callscompleted + qe->parent->callsabandoned) == 0) { + qe->parent->holdtime = newholdtime; + } else { + oldvalue = qe->parent->holdtime; + qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newholdtime) >> 2; + } ao2_unlock(qe->parent); } @@ -5556,7 +5560,7 @@ static int update_queue(struct call_queue *q, struct member *member, int callcom if (callcompletedinsl) { q->callscompletedinsl++; } - if (q->callscompletedinsl == 1) { + if (q->callscompleted == 1) { q->talktime = newtalktime; } else { /* Calculate talktime using the same exponential average as holdtime code */ |