I need to set a concurrent call limitation of inbound calls for each extensions but not going very well.
Actually the minimum requirement is to prevent multiple calls ring the same extension. This should be done in the "RingInUse" settings but there is a bug in Asterisk if multiple calls joined the queue, it might break the RingInUse rule and ring the talking / ringing extension.
I was able to set call-limit=1 in Asterisk 1.6 but in Asterisk 13.7 it seems no effect (or depreciated). So I need to come up with another solution.
Some posts in forums says GROUP
and GROUP_COUNT
is a perfect solution for newer Asterisk versions. Then I found many examples that use GROUP
and GROUP_COUNT
but most of them are Trunk-based or Outbound calls. But the post mentioned Inbound calls are also work so I implemented it in the queue section of my extensions.conf
.
[only-dialextension-q6701]
exten = _.,1,Gotoif(${DB(DND/${EXTEN})}>0?h,1)
exten = _.,2,Set(ODETIME=30)
exten = _.,n,Set(GROUP()=Exceed_${EXTEN})
exten = _.,n,Gotoif($[${GROUP_COUNT(Exceed_${EXTEN})}>1]?h)
exten = _.,n,Goto(only-dialextension,${EXTEN},1)
exten = h,1,Hangup()
Issue
I was monitoring asterisk -vvvvvvvvvvr
and the output. When the first call comes, it returns 0 (In boolean that means false). That's correct because 1 is not greater than 1, then fine. But the second call comes, it still returns 0 because the count is still 1 but not 2.
I was very frustrated with this result because that won't stop further incoming call from the queue to call the same agent.
Just I mentioned above, there is a possible bug in Asterisk to break "Ring In Use" and ring the same agent if the timing of those two incoming calls are too close. So I need this to overwrite the "Ring In Use" (although I already turn it off for better fault tolerance).
Update 1 at 2017-0216 02:49 GMT
[only-dialextension-q6701]
exten = _.,1,Gotoif(${DB(DND/${EXTEN})}>0?h,1)
exten = _.,2,Set(ODETIME=30)
exten = _.,n,Gotoif($[${GROUP_COUNT(Exceed_${EXTEN})}>0]?callHangup:callQueueAgent)
exten = _.,n(callHangup),Hangup()
exten = _.,n(callHangup),Goto(always-Hangup,h,1)
exten = _.,n(callQueueAgent),Set(GROUP()=Exceed_${EXTEN})
exten = _.,n(callQueueAgent),Goto(only-dialextension,${EXTEN},1)
exten = h,1,Hangup()
I have changed the GROUP_COUNT order to make it easier to catch > 0 but failed.