VMware ESXi and vSphere Cluster Management

Managing Device States for Asterisk Queue Members

Learn how Asterisk tracks SIP queue member device states, uses callcounter with chan_sip, prevents calls to busy agents, and manages pause status.

Asterisk queues need an accurate view of each member's availability before they offer a caller to that member. Device state is the availability condition Asterisk associates with an endpoint, such as idle or busy. When state reporting works correctly, a queue can distinguish an idle phone from one that is already handling a call.

A queue member is an endpoint or channel assigned to receive calls from a queue. The member may be a static configuration entry or a dynamic queue member, which is added at runtime. In either case, the queue needs a usable device or channel identity to determine whether that member is available.

Why device state matters to queues

Suppose SIP/alice is a member of the sales queue. If Alice's phone is idle, the endpoint should report Not in use. If Alice is handling another call, it should report In use. The queue can then apply its member-selection policy to avoid sending another caller to the busy agent.

Accurate state reporting is especially important when ringinuse is disabled. That policy tells the queue not to ring a member whose device is already in use. The policy cannot work reliably if Asterisk incorrectly reports a busy endpoint as idle.

Reading queue member state

Use the Asterisk CLI command below to inspect a queue:

queue show sales

The output varies slightly by Asterisk version, but it normally identifies the member's channel or device, membership type, penalty, call history, pause state, ringinuse behavior, and current device state. State labels commonly include Not in use and In use.

  • Membership type: indicates whether the member is static or dynamic. A dynamic member was added at runtime and may also have login or runtime status information.
  • Device or channel reference: identifies the endpoint Asterisk attempts to ring, such as SIP/alice in a legacy chan_sip deployment.
  • Ring-in-use behavior: indicates whether the queue may ring that member while the device is already in use.
  • Current device state: reports whether Asterisk currently sees the endpoint as Not in use, In use, or another state.
  • Pause status: indicates whether an administrator has intentionally made the member ineligible for queue calls.

A member can remain listed as Not in use even while the phone is handling a call if the channel driver is not reporting call activity correctly, or if the queue member references a different device than the one being tested.

Queue member availability conditions

Reported conditionMeaningCan the endpoint be selected for a queue call?Relevant control
Not in useAsterisk considers the endpoint idle.Usually yes, subject to queue membership and other selection rules.Device state and normal queue policy.
In useThe endpoint is handling a call.Yes if ringinuse is enabled; no if it is disabled.ringinuse and accurate device state.
PausedThe member was deliberately removed from queue availability.No, even if the endpoint itself is idle.Queue pause and unpause controls.
In use with ringinuse enabledThe device is busy, but the queue policy allows another queue call attempt.Yes.Member or queue ringinuse setting.
In use with ringinuse disabledThe device is busy and the queue excludes it.No.Accurate device state plus disabled ringinuse.

Tracking SIP device state with chan_sip

chan_sip is the legacy Asterisk SIP channel driver configured through sip.conf. In chan_sip deployments, the callcounter option enables call-count and device-use tracking for SIP devices.

Place the setting in the [general] section of sip.conf:

[general]
callcounter=yes

This setting must be enabled before chan_sip can report a SIP endpoint as busy during an active call. It applies to chan_sip-based configurations only. Do not use this setting as the configuration method for PJSIP; PJSIP uses a different channel driver and configuration model.

What happens when call state tracking is missing

Consider a dynamic sales-queue member named SIP/alice:

  1. Alice is added to the sales queue.
  2. Alice places or receives a normal SIP call.
  3. The phone is genuinely busy, but chan_sip is not tracking its call state.
  4. You run queue show sales and the member still appears as Not in use.
  5. The queue sees an apparently idle member and may attempt to deliver another waiting caller to Alice.

The important difference is between an endpoint's real activity and the state Asterisk has received. A phone can be busy in the physical world while appearing available to the queue. Queue distribution uses the reported state, not an unobserved assumption about what the agent is doing.

Apply and validate chan_sip call tracking

  1. Confirm that the queue member is using chan_sip and identify the exact device reference shown by queue show.
  2. Edit sip.conf and add callcounter=yes under [general].
  3. Apply the change safely by reloading chan_sip:
module reload chan_sip.so

Use the reload method appropriate for your maintenance process and Asterisk version. Avoid making configuration changes without confirming that the reload succeeded.

  1. Place or receive an active call through the configured SIP endpoint.
  2. While the call is active, inspect the queue:
queue show sales

The member should change from Not in use while idle to In use during the active call. If ringinuse is disabled, the queue should exclude that busy member from new queue call attempts. Test again after the call ends; the member should return to Not in use, unless another status such as pause prevents selection.

Pausing and unpausing queue members

Pause is a queue-member status that intentionally prevents the member from receiving queue calls. It is separate from automatic device state detection. Pause an agent for a break, training, a meeting, or any other period when the agent should not receive queue work even if the phone is idle.

The Asterisk CLI provides queue member controls. Syntax can vary by Asterisk version and by whether the member is static or dynamic, so verify the command supported by the deployment:

queue pause member SIP/alice sales
queue unpause member SIP/alice sales
queue show sales

Some installations use the QueuePause dialplan application or another queue-management interface instead. Use the version-appropriate mechanism, then run queue show sales to verify the result.

  • After pausing, queue reporting should show the member as paused, and the member should not be eligible for queue calls even if the endpoint says Not in use.
  • After unpausing, the member becomes eligible again, provided the device is available and other queue rules permit selection.
  • Pausing does not disconnect an existing call and does not replace device-state tracking.

Device state versus ringinuse

These settings solve different parts of the problem:

  • Device state answers: “Is this endpoint idle or handling a call?”
  • ringinuse answers: “What should the queue do when the endpoint is reported as in use?”
  • Pause status answers: “Should this member receive queue calls at all right now?”

With reliable state tracking and ringinuse disabled, a member reported as In use is excluded from queue distribution. With ringinuse enabled, the queue may still ring that member. If state tracking is inaccurate, disabling ringinuse cannot protect the agent because the queue does not know that the endpoint is busy.

Practical example: a busy agent appears available

Assume SIP/alice is a dynamic member of the sales queue and is on a call.

  1. Run queue show sales. Without call state tracking, the member may be reported as Not in use.
  2. Explain the operational risk: the queue may select Alice for another caller despite the active call.
  3. Set callcounter=yes in the [general] section of sip.conf.
  4. Reload chan_sip, place another active call, and run queue show sales again.
  5. Confirm that the member is now reported as In use.
  6. When ringinuse is disabled, confirm that the queue excludes Alice while the call remains active.

This test validates both halves of the design: chan_sip reports the endpoint state, and the queue policy acts on that state.

Practical example: removing an idle agent temporarily

An agent's phone may be idle while the agent is on a break. Device state alone would report Not in use, so pause the member administratively:

  1. Pause the member using the version-appropriate CLI, dialplan, or queue-management interface.
  2. Run queue show sales and verify that the member is shown as paused.
  3. Confirm that the member does not receive queue calls while paused.
  4. Unpause the member when the agent is ready.
  5. Run queue show sales again and verify that the paused indicator is cleared.

The member is then eligible again, subject to its current device state and the queue's distribution policy.

Troubleshooting state reporting

ConditionQueue show result during an active SIP callLikely causeCorrective action
callcounter not enabled for chan_sipMember remains Not in use.callcounter=yes is absent or is not under [general].Add the setting to sip.conf, reload chan_sip, and retest.
callcounter enabled and chan_sip configuration appliedMember changes to In use.State tracking is operating as expected.With ringinuse disabled, verify that the queue excludes the member.
Member deliberately pausedPause status is shown; device state may still be Not in use.An administrator has intentionally removed the member from queue eligibility.Unpause the member when the agent is ready, then verify with queue show.
Incorrect queue member device or channel referenceThe tested phone does not cause the displayed member state to change.The queue references a different endpoint or identity.Compare the queue member reference with the endpoint used for the active call.

Busy member still receives queue call attempts

  • Run queue show while the agent is on a call and check whether the member is actually reported as In use.
  • Review whether ringinuse is enabled. If it is enabled, busy-member ringing may be intentional.
  • Confirm that the queue member references the endpoint whose state is being tested.
  • If the member is incorrectly reported as Not in use, correct chan_sip state tracking and repeat the test.

Idle member does not receive queue calls

  • Run queue show and inspect the member's pause status.
  • Unpause the member if the pause was intentional and the agent is ready.
  • Verify that the member is present in the intended queue and that its device reference is correct.
  • Check other queue eligibility and distribution rules after confirming state and pause status.

Exam-relevant notes

  • Not in use means Asterisk currently sees the endpoint as idle; it does not prove that the agent is physically available unless state reporting is configured correctly.
  • In use means Asterisk sees the endpoint handling a call.
  • callcounter=yes belongs in the [general] section of sip.conf for legacy chan_sip.
  • callcounter is not the PJSIP configuration method.
  • ringinuse is a queue policy, not the mechanism that detects whether a device is busy.
  • Disabling ringinuse only works as intended when the queue receives accurate device state.
  • Pause and unpause are administrative queue controls and are distinct from automatic busy detection.

For a broader reference to the terminology used in this lesson, see Device States.