Using Dynamic Routes to run a dialplan sub when queue agent answers

You can use Dynamic Routes to set a channel variable on a call before sending it to the queue. When an agent from that queue answers the call, it will run custom dialplan which you can use to send a notification or for some other purpose:

Step 1 - Create the custom dialplan

Using the Config Edit module (or the editor of your choice) you can add the following lines to /etc/asterisk/extensions_custom.conf

[sub-queue-answer]
exten => s,1,NoOp(Entering user defined context sub-queue-answer in extensions_custom.conf)
; exten => s,n,DumpChan    ; uncomment for debug
; additional lines as required
same => n,Return()

Step 2 - Create the Dynamic Route

Create a Dynamic route leaving most options disabled. Set the Source Type to “Asterisk Variable” and set the variable expression to:

${SET(__QGOSUB=sub-queue-answer)}

You don’t need any dynamic route entries, just set the dynroute default destination to the queue to which you want callers to go. In the GUI it would look like:

Step 3 - The Call Flow

Now route any inbound queue calls to the dynroute, which will then send them to the Queue. Each caller that enters the queue will get the QGOSUB var set, and each time a queue agent answers a call, the dialplan above will be executed. The custom dialplan is just a stub, you will need to edit it to ensure it actually does something.

4 Likes

Wow, this one is great!

1 Like

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