Sometimes queue member receive call while in use even if ringinuse=no


#1

Hi, I have a problem with an asterisk implementation with a client (is a Centos 7 and a compiled asterisk 13.22.0).
Basically sometimes, mostly when callcenter is full, agents recevie two calls, when they shouldn’t. The ringinuse parameter is “no”, which works most of the time, but in some cases, somedays more frequent than others, an agent receive a call while in call.
There is 10 queues, and the agent is in at least 7 queues. I use local channels for the agents and the agents are added via AMI commands, The queues and the SIP devices (chan_sip) are in realtime (postgresql-9.6). So a queue look like this in the CLI:

queue_1 has 0 calls (max unlimited) in ‘rrmemory’ strategy (9s holdtime, 184s talktime), W:8, C:1, A:0, SL:0.0% within 0s
Members:
denisse.quizhpe (local/queue-1-denisse.quizhpe@agent/n from sip/705) with penalty 2 (ringinuse disabled) (dynamic) (Not in use) has taken no calls yet
miguel.paspuel (local/queue-1-miguel.paspuel@agent/n from sip/717) with penalty 1 (ringinuse disabled) (dynamic) (Not in use) has taken no calls yet
alexandra.ochoa (local/queue-1-alexandra.ochoa@agent/n from sip/713) with penalty 2 (ringinuse disabled) (dynamic) (In use) has taken no calls yet
fabian.paredes (local/queue-1-fabian.paredes@agent/n from sip/callcenter710) with penalty 1 (ringinuse disabled) (dynamic) (paused) (Not in use) has taken no calls yet
margarita.vaca (local/queue-1-margarita.vaca@agent/n from sip/callcenter707) with penalty 2 (ringinuse disabled) (dynamic) (paused) (Not in use) has taken no calls yet
marcela.penagos (local/queue-1-marcela.penagos@agent/n from sip/callcenter703) with penalty 2 (ringinuse disabled) (dynamic) (Not in use) has taken no calls yet
gerardo.castro (local/queue-1-gerardo.castro@agent/n from sip/callcenter702) with penalty 2 (ringinuse disabled) (dynamic) (paused) (Not in use) has taken no calls yet
fernanda.morales (local/queue-1-fernanda.morales@agent/n from sip/callcenter701) with penalty 2 (ringinuse disabled) (dynamic) (Not in use) has taken no calls yet
juan.sanchez (local/queue-1-juan.sanchez@agent/n from sip/callcenter704) with penalty 2 (ringinuse disabled) (dynamic) (In use) has taken 1 calls (last was 259 secs ago)
No Callers

Then sometimes what happens is that an agent (for the example just alexandra.ochoa) receive a call from other queues when the agent is in call. I have the queue log (also realtime) where you can see this:

id | time | callid | queuename | agent | event | data1 | data2 | data3 | data4 | data5 | _queues
-------±---------------------------±-----------------±----------±----------------±---------------±------±-----------------±------±------±------±--------
35250 | 2019-03-12 16:35:57.126073 | 1552426514.43559 | queue_1 | NONE | ENTERQUEUE | | 23814920 | 1 | |
|
35252 | 2019-03-12 16:37:25.458015 | 1552426514.43559 | queue_1 | alexandra.ochoa | CONNECT | 88 | 1552426640.43567 | 4 | |
|
35253 | 2019-03-12 16:38:29.011991 | 1552426669.43580 | queue_6 | NONE | ENTERQUEUE | | 42680796 | 1 | |
|
35255 | 2019-03-12 16:39:15.599177 | 1552426731.43583 | queue_4 | NONE | ENTERQUEUE | | 42442983 | 1 | |
|
35256 | 2019-03-12 16:39:45.145153 | 1552426514.43559 | queue_1 | alexandra.ochoa | COMPLETECALLER | 88 | 140 | 1 | |
|
35257 | 2019-03-12 16:39:53.172078 | 1552426731.43583 | queue_4 | alexandra.ochoa | CONNECT | 38 | 1552426785.43588 | 7 | |
|
35258 | 2019-03-12 16:39:55.665431 | 1552426669.43580 | queue_6 | alexandra.ochoa | RINGNOANSWER | 10000 | 111 | | |
|
35262 | 2019-03-12 16:41:18.11285 | 1552426669.43580 | queue_6 | gerardo.castro | CONNECT | 169 | 1552426869.43619 | 8 | |
|
35275 | 2019-03-12 16:43:50.452874 | 1552427013.43657 | queue_5 | NONE | ENTERQUEUE | | 100 | 1 | |
|
35276 | 2019-03-12 16:43:50.873512 | 1552426731.43583 | queue_4 | alexandra.ochoa | COMPLETEAGENT | 38 | 237 | 1 | |
|

In the log you can see that in log 35257 alexandra.ochoa CONNECT with a call from queue_4, after completing a call in queue_1, but just after this you can see a RINGNOANSWER to the same agent, from queue_6, which is a problem because all the queues are with RINGINUSE=no and the agents shouldn’t receive calls if they are in a call.

As I said it works most of the time, and this cases are rare, I haven’t been able to reproduce the error voluntarily, so I’m chasing for the full log in this case (I’m plannig to capture the full log in asterisk messages); but as you can see with the logs and config it is a problem.

Can someone help me, or someone has the same problem?
Should I open a bug report?


#2

There is no locking between the test and the call attempt. Also, at least some of the device status handling for this involves message passing between multiple threads. As such, it doesn’t surprise me that you get the odd race condition.