Asterisk Queue with limited calls per IAX agent

IAX2 does not have SIP-like call-limit configuration option. I was implementing a call queue, where clients used IAX2 softphone (idefisk). It was very disturbing for operators to have calls ringing on background of ongoing call, so I tried to find a solution to limit calling only to users not on the phone.

Queue members:

Define them like this:

member => Local/934@queue-to-agent/n



; this is just my exit handler. the important thing is in queue-to-agent context

exten => s-NOANSWER,1,NoOP(There was no answer to call from ${CALLERIDNUM})
exten => s-NOANSWER,2,Hangup

exten => s-BUSY,1,NoOP(Extension busy, call from ${CALLERIDNUM})
exten => s-BUSY,2,Hangup

exten => s-CHANUNAVAIL,1,NoOP(Channel unavailable, call from ${CALLERIDNUM})
exten => s-CHANUNAVAIL,2,Hangup

exten => s-CONGESTION,1,NoOP(Congestion, call from ${CALLERIDNUM})
exten => s-CONGESTION,2,Hangup

exten => s-ANSWER,1,NoOP(Answered and completed call from ${CALLERIDNUM})
exten => s-ANSWER,2,Hangup

exten => _9.,1,Set(GROUP()=${EXTEN})
exten => _9.,2,NoOP(Group count is ${GROUP_COUNT()}, group is ${GROUP()}, exten is ${EXTEN})
exten => _9.,3,GotoIf($[${GROUP_COUNT()} > 1]?6:4)
exten => _9.,4,Dial(IAX2/user${EXTEN},120,rtT) ; alternatively, you can goto extension in some context, my IAX users are called user9XX
exten => _9.,5,Goto(exithandling,s-${DIALSTATUS},1) ; be sure to hangup or return congestion on connection error, queue relies on returning
exten => _9.,6,Wait(7) ; limit cycling of calls, when all operators are busy/congested
exten => _9.,7,Congestion

See also

Created by: juraj, Last modification: Fri 05 of Nov, 2010 (22:07 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+