[asterisk-users] Queue Time to Speak to Agent Algorithm?

Jared Smith jsmith at digium.com
Tue Jul 31 09:48:07 CDT 2007


On Tue, 2007-07-31 at 10:16 -0400, Matt wrote:
> Does anyone know the algorithm that Asterisk uses to figure out when
> you'll be speaking with an agent?    I've heard it say such bizarre
> things as '2 minutes' when there area 2 calls waiting ahead of a
> person and 1 agent logged in.

I don't know the exact detail, but it's a moving average, based on the
hold times of the previous calls.  I spoke to the author of the code
about it once, and he described the algorithm as something like "a
recursive boxcar filter".  The source code (in apps/app_queue.c) also
seems to bear this out... if you look at the recalc_holdtime
function[1], you'll see that it says "Calculate holdtime using a
recursive boxcar filter".  (And if you understand C code, the algorithm
is really quite simple and efficient.)

Searching for "recursive boxcar" on the web seems to bring up a lot of
information about that particular algorithm.

[1] You can read the code for that function at
http://www.asterisk.org/doxygen/1.4/app__queue_8c.html#94119419d819a6af1b06f79ed4133192

-- 
Jared Smith
Community Relations Manager
Digium, Inc.




More information about the asterisk-users mailing list