Add queue members manually from the CLI
You can use the queue add command from the Asterisk CLI to manually add members to a queue. The syntax of the command is:
queue add member channel to queue [[[penalty penalty] as membername] state_interface interface]
Here is a description of each parameter:
- channel – the channel we want to add to the queue (e.g. SIP/alice for the SIP peer alice).
- queue – the queue we would like to add the member to (e.g. sales).
- penalty – an integer number greater or equal to 0 used to control the rank of a member within a queue.
- membername – a text label for easier identification of a queue member.
- state_interface – can be used to assign the device state of a SIP device to the pseudo channel, which allows the state of a SIP device to be applied to the Local channel for correct device state information.
For example, if we wish to add alice as a member to our sales queue, we would use the following command from the Asterisk CLI:
geek-university*CLI> queue add member SIP/alice to sales Added interface 'SIP/alice' to queue 'sales'
We can verify that the member alice has indeed been added to the queue by using the queue show sales command:
geek-university*CLI> queue show sales sales has 0 calls (max unlimited) in 'rrmemory' strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0% within 0s Members: SIP/alice (ringinuse disabled) (dynamic) (Not in use) has taken no calls yet No Callers
Now, if we dial the 705 extension, our call should enter the queue and ring alice, as shown in the CLI output:
geek-university*CLI> == Using SIP RTP CoS mark 5 -- Executing [705@local:1] Verbose("SIP/bob-0000003e", "2,"" <bob> entered the sales queue") in new stack == "" <bob> entered the sales queue -- Executing [705@local:2] Queue("SIP/bob-0000003e", "sales") in new stack -- Started music on hold, class 'default', on channel 'SIP/bob-0000003e' == Using SIP RTP CoS mark 5 -- Called SIP/alice -- SIP/alice-0000003f is ringing
To remove a member from a queue, we use the queue remove member channel from queue command:
geek-university*CLI> queue remove member SIP/alice from sales Removed interface SIP/alice from queue 'sales'