Limit active calls. Other calls remain queued

Hey all!

I am looking to configure my system such that only two total calls can be active on all extensions, including park extensions, at any given time. If there are already two calls then new calls go to the queue and stay there until one is freed up.

The tricky part is that we have seven phones in the queue and we would like all calls to be immediately available on any of them. So calls will keep ringing the phones even if two of the agents are busy.

I have this pretty silly unfinished custom application for sending calls to the queue when there are two or more active:

[call-count]
exten => s,1,Set(calls=${SHELL(asterisk -rx 'core show calls' | grep 'active call' | cut -f1 -d' ' | tr -d '\n')})
exten => s,n,Set(queuec=${SHELL(asterisk -rx 'queue show 630' | head -n1 | cut -f3 -d' ' | tr -d '\n')})
exten => s,n,GotoIf($[${calls} - ${queuec} > 1]?:busy)

Then I can make this application the inbound route destination and the sole queue agent. The problem with that though is that calls will just continuously leave the queue and lose their place in line.

Another idea might be to run a cron job every 10 seconds or so that checks the call count and pauses/unpauses members based on that number.

Just wondering if anyone has a less janky idea for this? Also if you can think of something similar but not quite this functionality let me know! Just looking for ideas. The biggest hurdle I am trying to avoid is having to manually unpause extensions.

Thank you!

ARI script that puts the call in stasis no matter what.
Second script the runs every x seconds and releases x oldest calls to queue based your thresholds.

This way or the way you mention above, you run the risk of callers jumping ahead in line unless

You might be able to do this by adapting the technique here: Queue Magic - #2 by lgaetz

It would mean creating 1 ring group and 2 custom extensions and I’m not sure what will happen when the same extension is part of 2 different groups that are called simultaneously. Thinking you will need queue autofill disabled and skip busy enabled at a minimum. Be warned the CDRs and queue logs will likely be a dog’s breakfast as a consequence of this config.

1 Like

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