Device states
To properly manage queues, the Queue application needs to know the current state of a device. In order to enable Asterisk to monitor whether the device is in use or not, the callcounter option needs to be enabled in the sip.conf file.
Consider what happens if this option is not enabled. Let’s say that we have a device SIP/alice that is a part of the sales queue. If we make a call using that device, the device will not be marked as In Use, so the callers could be sent to the agent who is already on the phone!
geek-university*CLI> queue show sales sales has 0 calls (max unlimited) in 'rrmemory' strategy (7s holdtime, 0s talktime), W:0, C:2, A:1, SL:0.0% within 0s Members: SIP/alice (ringinuse disabled) (dynamic) (Not in use) has taken no calls yet No Callers
That is why we need to add the callcounter option to the general section of our sip.conf file:
callcounter=yes
Now, after we reload chan_sip, we can make the same call again, and the device will be market as In Use:
geek-university*CLI> queue show sales sales has 0 calls (max unlimited) in 'rrmemory' strategy (7s holdtime, 0s talktime), W:0, C:2, A:1, SL:0.0% within 0s Members: SIP/alice (ringinuse disabled) (dynamic) (In use) has taken no calls yet No Callers
Now, Asterisk will know that the device is in use and will not send callers to the member that is already on the phone.