FreePBX Queue handling Agents

I can’t think of a practical way of using dynroutes for this.

If I was going to do this, I would define a new dial prefix for extensions with dialplan to check to see how many active queue calls there are before allowing the dial to continue. Instead of logging in the extensions to the queue directly, add them using a prefix. Asterisk doesn’t make this overly simple, but I think you could do it with the QUEUE_MEMBER function.

Subtract the QUEUE_MEMBER - ready value from the QUEUE_MEMBER count value and you’ll get the number of active calls. If that value exceeds a threshold, just end the channel.

References:
Creating a prefix: Open Source Pro Tips #8 - Creating a Custom Dial Prefix

May not really be a DIY project. If there’s budget, be aware that there is a forum section called Jobs where you can post for paid assistance with a project.