As a result of a question that came up earlier in the week, I thought I would focus this week’s #FridayFun on how Queue feature codes work in FreePBX. If you browse to Admin → Feature codes and scroll to the queues section this is what you see:
Three simple dial codes but there are no tool tips for these feature codes, so unless you went to the fpbx wiki, you might not realize there’s much more to this than what shows in the admin GUI.
Starting with TangoPBX RC3 published a few hours ago, I have a queue created with a mix of static and dynamic agents and I have phones registered to each of them:
This is the result in Asterisk after the apply config:
tangopbx4*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
Members:
Extension 5001 (Local/5001@from-queue/n from hint:5001@ext-local) (ringinuse enabled) (Not in use) has taken no calls yet (login was 48 secs ago)
No Callers
If I dial the *45
feature code from extensions 5002 and 5003, each will be logged into the queue and start taking calls, again from the CLI
tangopbx4*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
Members:
Extension 5001 (Local/5001@from-queue/n from hint:5001@ext-local) (ringinuse enabled) (Not in use) has taken no calls yet (login was 156 secs ago)
Extension 5002 (Local/5002@from-queue/n from hint:5002@ext-local) (ringinuse enabled) (dynamic) (In use) has taken no calls yet (login was 5 secs ago)
Extension 5003 (Local/5003@from-queue/n from hint:5003@ext-local) (ringinuse enabled) (dynamic) (In use) has taken no calls yet (login was 1 secs ago)
No Callers
Dialing *45 again, logs extensions 5002 and 5003 out of the queue. As a static member, 5001 can dial *45 all they want, it will have no effect on their queue member status (but annoyingly, the recording played to 5001 when dialing *45 does not indicate this). This is all quite simple and I’m sure is common knowledge.
The #FridayFun begins when creating BLF buttons to speeddial queue login/logout. You can certainly program a button with the *45 dial string, and it will work, but the BLF LED will not do anything. In order for the BLF LED to show the login status, you must program the button with a dial string that matches the hint. The format for a button to toggle login for all queues is *45*XXX
where the X’s are the users extension number. For my example above, I would create a button on extension 5003 with a dial string of *45*5003
.
Before adding any buttons to phones, I can see all the 45 hints from the bash prompt using this command:
root@tangopbx4:~# asterisk -x "core show hints" | grep 45
_*45*X.@ext-queues : ${DB(AMPUSER/${EXTEN:4}/queuehint)} State:Unavailable Presence: Watchers 0
_*45XXXX*XXX@ext-queues : Custom:QUEUE${EXTEN:3} State:Unavailable Presence: Watchers 0
All that shows and the stock dynamic hint patterns. Running the same command again once the BLF has been created on the phone, I can see a new hint in the list, there’s a State associated with the hint, and now there is a watcher (some items removed for clarity going forward):
root@tangopbx4:~# asterisk -x "core show hints" | grep 45
*45*5003@ext-queues : Custom:QUEUE5003*800 State:Idle Presence:not_set Watchers 1
Now when I dial *45 or when I use the BLF to speeddial 455003, the BLF LED changes colour, and I can see the change reflected in the hint state in Asterisk
root@tangopbx4:~# asterisk -x "core show hints" | grep 45
*45*5003@ext-queues : Custom:QUEUE5003*800 State:InUse
There’s a second dynamic hint created for the *45 feature code, which shows above as:
_*45XXXX*XXX@ext-queues
This is the BLF dial string used to create a login toggle that only logs a user into a single queue instead of all queues. From the wiki we know the format is 45yyyyxxxx where xxxx is the queue number and yyyy is the user’s extension number. So for a button on extension 5002 for queue 800, I would program a BLF button with a dial string of
*455002*800
And when I do that, a new hint is created in Asterisk, we can see the BLF LED on the phone is lit and the hint state is in use:
*455003*800@ext-queues : Custom:QUEUE5002*800 State:InUse Presence:not_set Watchers 1
Pressing the button again logs user 5002 out of queue 800 only.
The other queue feature code with a hint is the *46 queue pause toggle. Much of the same applies. With no BLFs configured, you can see the dynamic hints with
root@tangopbx4:~# asterisk -x "core show hints" | grep 46
_*46*X.@ext-queues : ${DB(AMPUSER/${EXTEN:4}/pausequeuehint)} State:Unavailable Presence: Watchers 0
_*46*XXXX*800@ext-queues : Queue:800_pause_Local/${DB(DEVICE/${EXTEN:4:4}/user)}@from-q State:Unavailable Presence: Watchers 0
To create a button on extension 5003 that pauses the user in all queues the dial string would be
*46*5003
And a button on 5002 that pauses the user only in queue 800:
*46*5002*800
And from Asterisk:
root@tangopbx4:~# asterisk -x "core show hints" | grep 46
_*46*X.@ext-queues : ${DB(AMPUSER/${EXTEN:4}/pausequeuehint)} State:Unavailable Presence: Watchers 0
*46*5002*800@ext-queues : Queue:800_pause_Local/5002@from-queue/n State:InUse Presence:not_set Watchers 1
*46*5003@ext-queues : Queue:800_pause_Local/5003@from-queue/n State:InUse Presence:not_set Watchers 1
_*46*XXXX*800@ext-queues : Queue:800_pause_Local/${DB(DEVICE/${EXTEN:4:4}/user)}@from-q State:Unavailable Presence: Watchers 0