[asterisk-users] Queues with ringinuse=yes

Vinícius Fontes vinicius at canall.com.br
Fri Jan 21 11:31:48 CST 2011


I'm setting up a queue for two independent operator phones that are capable of answering multiple calls at once. It's currently working with the following settings and Asterisk 1.4:

queues.conf:

[telefonistas]
strategy=roundrobin
;strategy=leastrecent
music=default
timeout=60
retry=0
maxlen=0
wrapuptime=0
ringinuse=yes
autofill=yes
joinempty=yes
member => SIP/8899
member => SIP/8898



extensions.conf:

exten => _900[0-2],1,Answer()
exten => _900[0-2],n,Queue(telefonistas,r,,,45)
exten => _900[0-2],n,Dial(DAHDI/g3/9072) ;If no operator answers



Both SIP phones are set up with call-limit=4 so each phone will receive a maximum of 4 calls before Asterisk considers the phone busy and don't sends calls to it anymore.

The tricky part comes now: the customer asked me to "load balance" the phones, so the next incoming call should be sent to the phone with the least calls. For example:

a) Phone1 has one call, Phone2 has two. Next incoming call should be routed to Phone1.
b) Phone1 has two calls, Phone2 has zero. Next incoming call should be routed to Phone2.
c) Both Phone1 and Phone2 have one call. Next incoming call can be routed to any of them.

And so on.

I have never done something similar before. I tried changing the queue strategy to leastrecent but that didn't solve the issue, because both Phone1 and Phone2 must also make calls in addition to answering them, and that should be taken in consideration.

I'm not sure if such a thing is possible using Queue() at all. As a last resort I'll write a dialplan that will check how many calls each phone has and route appropriately, but I really would like to implement that using Queue() if possible.

Any ideas? Thanks in advance.






More information about the asterisk-users mailing list