Setting a "dynamic limit" to max active calls permitted

Hello everyone,
I’m currently reviewing a step in a customer’s asterisk configuration. The customer would like to set a limit on maximum active calls, based on how many receptionist (Agents) are in the office. Each receptionist/Agent has got its own phone and a unique SIP extension assigned.

Right now, in the extensions.conf file, I’m running this block of code:

exten => 1,3,Set(GROUP()=chiam_in)
exten => 1,4,Verbose(1,**** Numero chiamate ${GROUP_COUNT(chiam_in)})
exten => 1,5,GotoIf($[${GROUP_COUNT(chiam_in)} >12]?3,1)
exten => 1,6,WaitExten(2)
exten => 1,7,Queue(Segreteria,t,,,600)
exten => 1,8,Background(/var/lib/asterisk/sounds/it/custom/BusyOperators)
exten => 1,9,Hangup()

exten => 2,1,Answer
exten => 2,2,Dial(SIP/301&SIP/422&SIP/423&SIP/425&SIP/426&SIP/490&SIP/497&SIP/498&SIP/499,30,tTr)
exten => 2,3,Background(/var/lib/asterisk/sounds/it/custom/out-of-working-time)
exten => 2,4,Hangup()

exten =>3,1,Verbose(1,***LIMIT EXCEEDED ${GROUP_COUNT(server2Trunkgroup)})
exten =>3,2,Background(/var/lib/asterisk/sounds/it/custom/BusyOperators)
exten =>3,3,Set(DIALSTATUS=CHANUNAVAIL)

With the help of the customer, we would like to dynamically change that limit that is currently set on 12.
We elaborated a formula that fits his desire, which I’m trying to translate in my code this way:

exten => 1,5,GotoIf($[${GROUP_COUNT(chiam_in)} > (K * NumberOfAgents)]?3,1)

where K is a number which is (“the number of calls in the queue we decide we want for each agent” + 1).
Also, we would like to call a function to get the “NumberOfAgents” currently working from Asterisk, is there such function?

Is this thing feasible?

Question:
How about if use dynamic queue members? So each operator can login to group by Application AddQueueMember(gruop_Name,PJSIP/{EXTEN}). So by using dialplan function as {QUEUE_MEMBER_COUNT(group_name)} could know how many agent logged on, and so on with others functions.

Queue(), QueueLog(), AddQueueMember(), RemoveQueueMember(), PauseQueueMember(),
UnpauseQueueMember(), QUEUE_VARIABLES, QUEUE_MEMBER, QUEUE_MEMBER_COUNT,
QUEUE_EXISTS, QUEUE_GET_CHANNEL, QUEUE_WAITING_COUNT, QUEUE_MEMBER_LIST,
QUEUE_MEMBER_PENALTY

2 Likes

Thanks, that sounds exactly what I’d like to do.
In fact, we’re already implementing dynamic queue members in our configuration. The only problem is that the operators do not want to log out of the queue after they end their work time. What I mean is that most of the time, in the queue Segreteria, there are some SIP extensions that are unreachable (meaning the operator is not at work / phone is plugged off) yet they still are in the queue, so next time they get online they won’t have to log in back to the queue.
So of course the function I’m looking for should return as a QUEUE_MEMBER_COUNT only the number of active operators ( = the active extensions logged in the queue).

Any suggestions for this?

Many thanks again.

Unfortunately Asterisk it seems no have agent auto logout and I don’t see how could solve your issue.
For “operators do not want to log out of the queue after they end their work time “ could be made by manually that it seems probably you are doing (it understand why your request for QUEUE_MEMBER_COUNT).
Maybe can complement with blf keys .

Thanks for the answer.
There’s already a simple extension which logs in and out of the queue, which is *54.
Unfortunately, the operators do not use it very much, since we all agreed it was better for them to remain “persistent”, so they won’t have to digit the extension every time they come back to work.
Aren’t there any functions to get only the number of “active”/reachable operators in the queue ?

Thanks again.

Unfortunately I guess no, probably through external application.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.