Unable to log out of queues

I am (still) using the ancient AsteriskNOW 2.0.2 consisting of Asterisk 1.8.15 and FreePBX, for a PBX I have established and am maintaining as a pro bono project for a local public-service non-profit.

(Please, PLEASE don’t tell me to upgrade. I know. Unfortunately at this time I am absolutely unable to do that. Hopefully before very much longer, but for now I’m stuck with what I have.)

I have several queues set up where people can log in using NNN* (extension number followed by star) and log out using NNN** (extension number followed by two stars).

Logging in works perfectly, logging out doesn’t work at all. If I say, for example, 407* I get “Agent login” and things proceed to completion. If I say 407**, instead of “Agent logout”, I get “Agent login” again.

The only way to clear people out of the queues is with asterisk -rx “queue remove member…” from the command line. Only the system administrator can do that; people can’t log themselves out of the queue.

If I open up a CLI I can watch what happens with the login and logout sequence. Logging in with 407* shows:

– Executing [407*@from-internal:1] Macro(“SIP/155-000000ad”, “agent-add,407,”) in new stack

Looks good, all is well.

Attempting to log out with 407** shows the same thing…

– Executing [407*@from-internal:1] Macro(“SIP/155-000000ae”, “agent-add,407,”) in new stack

So, when dialing 407**, the system only sees the first star, not the second one.

The phones I am using are Grandstream GXP1400. Their dial plan looks like this:

{ x+ | x+ | xxx+ | x+ | x+** }

The first part, “x+ | x+ | xxx+", is the default dial plan that Grandstream provides. The "x+ | x+**” is what I put in there to handle the queue login (one star) and logout (two stars).

Any ideas what I should check to try to run this down? It’s a big problem for the non-profit that uses this system.


Eric in NH

This appears to be about the operation of FreePBX provided macros and FreePBX generated code.

Good afternoon, David.

Perhaps, but the end result is that certain Asterisk-specific code is generated that appears not to be doing what it’s supposed to.

Using our Queue 407 as an example, here is the code snippet from extensions_additional.conf:

exten => 407,1,Macro(user-callerid,)
exten => 407,n,Answer
exten => 407,n,Macro(blkvm-set,reset)
exten => 407,n,ExecIf($["${REGEX("(M[(]auto-blkvm[)])" ${DIAL_OPTIONS})}" != “1”]?
exten => 407,n,Set(__NODEST=${EXTEN})
exten => 407,n,Gosub(sub-record-check,s,1(q,407,dontcare))
exten => 407,n,Playback(custom/ThanksForHolding3)
exten => 407,n,QueueLog(407,${UNIQUEID},NONE,DID,${FROM_DID})
exten => 407,n,Queue(407,t,)
exten => 407,n,Macro(blkvm-clr,)
exten => 407,n,Gosub(sub-record-cancel,s,1())
exten => 407,n,Set(__NODEST=)
exten => 407,n,Goto(ivr-14,s,1)

exten => 407*,1,Macro(agent-add,407,)

exten => 407**,1,Macro(agent-del,407)

All of this, including the 407*, works fine, but the 407** does not. I did try moving the 407** so that it’s before the 407*, didn’t help.

I’m thinking that the system is seeing the first star after the 407 and is charging off to execute 407* without waiting to see if there is another star coming. Any ideas where I can look in the code to increase that delay?

Eric in NH

Do you call 407* and 407** from a sip phone or from the PSTN?

If from the PSTN you may want to adjust your TIMEOUT(digit) value and see if that helps.

If from a SIP phone then you may need to adjust the dial plan on that phone to wait for more digits before sending the dialed string to the PBX.

I personally would use different extensions for my sign in and sign out than what you have so I wouldn’t have ambiguity as to what the user dialed.

Good morning, John.

Currently trying to get this to work from a SIP phone. Once that’s working I’ll move on to being able to do it from the PSTN.

On the Grandstream GXP2100 and GXP1400 phones, I haven’t found a way to extend the delay before sending the dialed string to the PBX. I do know that the default is a few seconds, should be way more than enough, except when I dial a star, in which case the transmission to the PBX seems to be immediate. I know the “#” key is set to do that (transmit it now), not sure why the star key is doing it too.

I’ve asked on the Grandstream forum but if anyone here is experienced with Grandstream phones and knows off the top of your head, sure appreciate a reply.



Somehow, when I cut and pasted the Grandstream dial plans into the original post, they got all munged up and I didn’t notice it until now.

The real dial plan I’m using is:

{ x+ | x+ | xxx+ | x+ | x+** }

The first part, x+ | x+ | xxx+, is the Grandstream default. The second part, x+ | x+**, is what I added to get queues to work.

Wow. It did it again. This forum apparently won’t let me type in the real Grandstream dial plan; it mungs it all up.

I’ll try it one more time, manually this time instead of cut and paste…

{ x+ | x+ | xxx+ | x+ | x+** }

Should be “x plus pipe star x plus pipe star x x star x plus pipe x plus star pipe x plus star star”

I discovered why it’s doing this.

The dial plan includes "x+* | x+" to handle the e.g. 407* to log in and 407 to log out. Problem is that when dialing 407**, the first star matches the first part of the dial plan addition, and the string goes out to the PBX which recognizes it immediately, and branches to “Agent Login”. The second asterisk is apparently ignored.

There doesn’t appear to be a way within the Grandstream phone to compensate for this, at least none I can find. Instead it appears that Asterisk needs to delay for a short time after a matching pattern is detected, and include the second star in the matching pattern if it shows up before the timeout.

I can’t find any way to do that in Asterisk code. Anyone have any ideas?

Again, this forum is modifying my dial plan strings to look like something other than what I typed in.

What I’m trying to type is:

Then dial plan includes “x plus star pipe x plus star star”…

The first star results in the string being sent and the second star is ignored.

The Grandstream support community forum provided an answer that seems to work.

Instead of x+* | x+** … (that’s x plus star pipe x plus star star in case this forum mungs up my text strings again, use

x+*+ or x plus star plus.

The phone will wait until a timeout before sending the string, allowing both stars to get in there.

Since that requires reprogramming several dozen phones, some of which are scattered about the state, a temporary workaround is to instruct people that when they want to log out of a queue, leave the phone ON-HOOK and dial e.g. 407-star-star and then pick up the handset or punch the speakerphone button, and the PBX will recognize the entire string.