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
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;
}