Dynamic Routes + Queue Login

@lgaetz maybe able to weigh in on this one.

I have a “Mobile” call center where I am using extensions with FMFM to cellphones via PSTN (requirement)

We have several queues built with no members defined, so extensions can freely move from queue to queue.

I need to create a login IVR that users can call and be prompted for their queue, then get logged into that queue (only in one queue at a time). Rather than building this in the conf files, I thought I would give dynamic routes a go.

I have the dynamic routes built to prompt the user for the queue they wish to login to. I have the dynamic routes to see if the caller is on the FMFM lists and set their caller id number to related extension. All good there.

What is the best way to use dynamic routes to log the extension in to the queue the user inputs? It would be great if I could just send to a misc destination of: *45${DYNROUTE_QID} but I don’t think I can put variables in the misc destinations?

I don’t want to use the asterisk CLI command: queue add member <dial string> to <queue> [[[penalty <penalty>] as <membername>] state_interface <interface>] because I have observed it dosen’t seem to log them in the same way as FreePBX does and, although the queueing would work, that can cause reporting issues with FreePBX and Asternic.

What do you guys think? Thanks in advance for any insights!

Once you have a queue with dynamic agents defined, you will be able to dial a string like this:


So if I want to log ext 7002 into queue 800, I would dial


And watching the Asterisk console while I dial that number:

[2022-12-01 14:09:27] VERBOSE[9900][C-0000003e] pbx.c: Executing [*457002*[email protected]:1] Set("PJSIP/7004-0000004f", "QUEUENO=800") in new stack
[2022-12-01 14:09:27] VERBOSE[9900][C-0000003e] pbx.c: Executing [*457002*[email protected]:2] Set("PJSIP/7004-0000004f", "QUEUEUSER=7002") in new stack
[2022-12-01 14:09:27] VERBOSE[9900][C-0000003e] pbx.c: Executing [*457002*[email protected]:3] Goto("PJSIP/7004-0000004f", "app-queue-toggle,s,start") in new stack
[2022-12-01 14:09:27] VERBOSE[9900][C-0000003e] pbx_builtins.c: Goto (app-queue-toggle,s,1)

What is happening when you dial that sequence? Asterisk parses out the agent extension number and the queue number, sets each to a specific channel variable and then sends the call to context app-queue-toggle. You’ll note that the log lines above show the call was placed by pjsip extension 7004, but looking at the queue details, you can see that 7002 was the agent that’s logged in:

9*CLI> queue show 800
800 has 0 calls (max unlimited) in 'ringall' strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0%, SL2:0.0% within 60s
      Reception (Local/[email protected]/n from hint:[email protected]) (ringinuse enabled) (dynamic) (In use) has taken no calls yet (login was 1 secs ago)
   No Callers

Using custom dialplan (or dynroutes), you could use that procedure to prompt the caller for their agent number and queue number, set the channel variables, and then send the call to a Custom destination defined as app-queue-toggle,s,1

Disclaimer: Didn’t test, works in theory.

1 Like

Thanks DYNamo @lgaetz.

One last question, Do you know if I can set two variables (QUEUENO & QUEUEUSER) in one dynamic route? I know there is an Asterisk option, but so far I have only used MySQL with Dynamic Routes.

Sort of. You could use a single dynroute to prompt the caller for both values at once separated by a * or # char, and then go to a single misc dest to assign the variables and send the caller to app-queue-toggle. If you need to validate the input, you prob want to prompt for each value separately.

I tried the asterisk command


But it didnt work.

It did work when I broke it out to two separate dynamic routes


Thanks again @lgaetz, another Dynamic Route win. We really have come to appreciate this module being baked into FreePBX.

1 Like

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