Queue pause not changing endpoint state


I have realtime queue confugured in asterisk(18.6.0) in which member logging in dynamically.

The problem i am facing is whenever any member put himself on break the endpoint state is not changing. Asterisk keeps showing state as “Not In Use”.

hyd-engagely-worker-1*CLI> queue show Hyd_noconnectivity
Hyd_noconnectivity has 0 calls (max unlimited) in ‘leastrecent’ strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0%, SL2:0.0% within 0s
PJSIP/4011 (ringinuse disabled) (dynamic) (Not in use) has taken no calls yet
No Callers

hyd-engagely-worker-1CLI> queue pause member PJSIP/4011
paused interface ‘PJSIP/4011’
hyd-engagely-worker-1*CLI> queue show Hyd_noconnectivity
Hyd_noconnectivity has 0 calls (max unlimited) in ‘leastrecent’ strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0%, SL2:0.0% within 0s
PJSIP/4011 (ringinuse disabled) (dynamic) (paused was 5 secs ago) (Not in use) has taken no calls yet

No Callers

Below are my configurations for queue, endpoint and dialplan not sure where i am missing the configuration. Please help me to understand as i tried multiple ways to figure this out.

My queue configuration is,

MariaDB [asterisk]> select * from queues where name=“Hyd_noconnectivity”\G
*************************** 1. row ***************************
name: Hyd_noconnectivity
musiconhold: excitel-hyd-support
announce: NULL
timeout: 15
ringinuse: no
setinterfacevar: NULL
setqueuevar: NULL
setqueueentryvar: NULL
monitor_format: wav
membermacro: NULL
membergosub: NULL
queue_quantity1: NULL
queue_quantity2: NULL
queue_holdtime: excitel_hyd/YourWaitTime_de
queue_minutes: NULL
queue_minute: NULL
queue_seconds: NULL
queue_callerannounce: NULL
queue_reporthold: NULL
announce_frequency: 5
announce_to_first_user: NULL
min_announce_frequency: 20
announce_round_seconds: NULL
announce_holdtime: no
announce_position: no
announce_position_limit: NULL
periodic_announce_frequency: 60
relative_periodic_announce: yes
random_periodic_announce: no
retry: 2
wrapuptime: 5
penaltymemberslimit: NULL
autofill: yes
monitor_type: MixMonitor
autopause: no
autopausedelay: 0
autopausebusy: no
maxlen: 0
servicelevel: NULL
strategy: leastrecent
joinempty: strict
leavewhenempty: strict
reportholdtime: no
memberdelay: 0
weight: NULL
timeoutrestart: NULL
defaultrule: NULL
timeoutpriority: NULL
1 row in set (0.00 sec)

My Endpoint configuration is,

MariaDB [asterisk]> select * from ps_endpoints where id=4011\G
*************************** 1. row ***************************
id: 4011
transport: transport-ws
aors: 4011
auth: 4011
context: outbound
disallow: all
allow: ulaw,alaw
direct_media: no
connected_line_method: NULL
direct_media_method: NULL
direct_media_glare_mitigation: NULL
disable_direct_media_on_nat: NULL
dtmf_mode: rfc4733
external_media_address: NULL
force_rport: NULL
ice_support: yes
identify_by: NULL
mailboxes: 4011@default
moh_suggest: NULL
outbound_auth: NULL
outbound_proxy: NULL
rewrite_contact: NULL
rtp_ipv6: NULL
rtp_symmetric: NULL
send_diversion: NULL
send_pai: NULL
send_rpid: NULL
timers_min_se: NULL
timers: no
timers_sess_expires: NULL
callerid: NULL
callerid_privacy: NULL
callerid_tag: NULL
100rel: NULL
aggregate_mwi: NULL
trust_id_inbound: NULL
trust_id_outbound: NULL
use_ptime: NULL
use_avpf: yes
media_encryption: dtls
inband_progress: NULL
call_group: NULL
pickup_group: NULL
named_call_group: NULL
named_pickup_group: NULL
device_state_busy_at: 1
fax_detect: NULL
t38_udptl: NULL
t38_udptl_ec: NULL
t38_udptl_maxdatagram: NULL
t38_udptl_nat: NULL
t38_udptl_ipv6: NULL
tone_zone: NULL
language: NULL
one_touch_recording: NULL
record_on_feature: NULL
record_off_feature: NULL
rtp_engine: NULL
allow_transfer: NULL
allow_subscribe: NULL
sdp_owner: NULL
sdp_session: NULL
tos_audio: NULL
tos_video: NULL
sub_min_expiry: NULL
from_domain: NULL
from_user: NULL
mwi_from_user: NULL
dtls_verify: fingerprint
dtls_rekey: NULL
dtls_cert_file: /etc/asterisk/keys/asterisk.pem
dtls_private_key: NULL
dtls_cipher: NULL
dtls_ca_file: /etc/asterisk/keys/ca.crt
dtls_ca_path: NULL
dtls_setup: actpass
srtp_tag_32: NULL
media_address: NULL
redirect_method: NULL
set_var: NULL
cos_audio: NULL
cos_video: NULL
message_context: NULL
force_avp: NULL
media_use_received_transport: yes
accountcode: NULL
user_eq_phone: NULL
moh_passthrough: NULL
media_encryption_optimistic: NULL
rpid_immediate: NULL
g726_non_standard: NULL
rtp_keepalive: NULL
rtp_timeout: NULL
rtp_timeout_hold: NULL
bind_rtp_to_media_address: NULL
voicemail_extension: NULL
mwi_subscribe_replaces_unsolicited: NULL
deny: NULL
permit: NULL
acl: NULL
contact_deny: NULL
contact_permit: NULL
contact_acl: NULL
subscribe_context: outbound
fax_detect_timeout: NULL
contact_user: NULL
preferred_codec_only: NULL
asymmetric_rtp_codec: NULL
rtcp_mux: yes
allow_overlap: NULL
refer_blind_progress: NULL
notify_early_inuse_ringing: NULL
max_audio_streams: NULL
max_video_streams: NULL
webrtc: yes
dtls_fingerprint: NULL
incoming_mwi_mailbox: NULL
bundle: NULL
dtls_auto_generate_cert: NULL
follow_early_media_fork: NULL
accept_multiple_sdp_answers: NULL
suppress_q850_reason_headers: NULL
trust_connected_line: NULL
send_connected_line: NULL
ignore_183_without_sdp: NULL
codec_prefs_incoming_offer: NULL
codec_prefs_outgoing_offer: NULL
codec_prefs_incoming_answer: NULL
codec_prefs_outgoing_answer: NULL
stir_shaken: NULL
send_history_info: NULL
allow_unauthenticated_options: NULL
1 row in set, 2 warnings (0.01 sec)

My Extensions.conf for outbound is,


exten => 4011,hint,Queue:Hyd_noconnectivity_pause_PJSIP/4011

I would not expect the device state to change, because you aren’t manipulating that aspect. It would remain not in use because the underlying device is not in use.

In such case it is affecting my queue logic for caller assignment to agents. Because app_queue is considering break time as idle time and assigning top caller to the agent who released the break recently rather than assigning members who were already there on idle waiting to receive call. How to handle this situation.

Is there any way i can manipulate the state of the device while agent is on pause?

Of the underlying device? No. The device state for “PJSIP/4011” is managed by chan_pjsip and can’t be overridden or changed. It is in control of it.

Any suggestions how would i override the situation of call assignment in the queues without considering break time when any member does unpause.

I’d re-evaluate your policy. This is the first time I can remember anyone being concerned about how pause interacts with the least recent strategy.

Just to add a quick notes about app_queue:

  • When an agent logged in, he will receive a start timestamp as 0.
    That timestamp is updated each end of call and at pause action.

Problems with that:
In a leastrecent strategy, already logged in member will “lost” their position (+1) due new agent will be the winner once 0 are lower than any other agent with correct timestamp.
This occurs when agent with wrapuptime unpause and can’t receive new call until wrapuptime timeout.

At v11 my company changed app_queue to use current timestamp at login, avoiding unfair new agents taking next calls. We also add a check at unpause code and remove wrapuptime from timestamp, allowing this agent to be ready to answer next call immediately.

I don’t know how’s the currently code but probably still with same issues.

@fsilvestre In my environment with “leastrecent” strategy the timestamp of Device State “Not in use” is not resetting. Even after unpause it keeps the timestamp from the time last call ended, which is causing issue in assigning head caller to most idle agent.

You need do some homework to confirm what kind of issue are happening.
What’s your Asterisk version? Are you using some web interface?

We are using asterisk version 18.6.0
Yes we are using web interface for agents to register and login to asterisk using webrtc (JSSip)

As far as I can see, Asterisk is behaving as intended and the problem is that the OP doesn’t like the intended behaviour.

The only real solution for that is for the OP to contribute code for a new, optional, setting, that behaves in the way they want. i.e. sets the last used time to the current time, on unpausing.

All the references to “not in use” are the result of confusing the status of the device with that of the queue member. It is best to completely forget about the “not in use” status.

can someone help me suggest some alternate way to achieve the desired functionality of call assignment with current behaviour.

Why would hints from dialplan doesn’t affect extension state?

I think you have terminology problems here. Extensions only have states for presence subscription, and hints simply list which devices are normally used by that extension. In fact the state reported for the extension is really just the state of the hinted devices.

Whilst you can create virtual device states (custom:name), manipulate them with the DEVICE_STATE function, and use them as the state interface for a queue member, I can’t see how that would help you, as I don’t believe that device state changes are used in any way in determining the last used time for a queue member.

Incidentally, I could see your desired policy being gamed by pausing, for a very short time, to reset the last used time.

depending on the phone
I know snom phones support that it can dial an extension when you press the DND button

and the you can define that 222 will set a customDeviceState “DeviceState-4011” to BUSY and 333 to IDLE
and then have a custom hint PJSIP/4011&DeviceState-4011

Firstly, you can only set device state manually on custom devices.

Secondly, this isn’t going to help, as member->lastcall is not reset on a device state change, only on end of call and some general resets of, at least, the whole queue.

Is there any way like reset the last call value by set variable function for a member in a queue?