[asterisk-dev] app_queue: extending QUEUESTATUS for joinempty/leaveempty

Sebastian Denz asterisk-dev at gonicus.de
Mon Nov 7 05:29:26 CST 2016


Hi,

while refactoring the callforwarding mechanisms for queues in our pbx i
encountered at least wrong documentation or a disappeared feature...

Until Asterisk 1.6.2 (i know, long time ago) it was possible to
distinguish between 'no agents logged in' and 'no agents available'
after executing the Queue() application in the dialplan.
Because QUEUESTATUS could have the values JOINEMPTY and JOINUNAVAIL.

This could be reached for example by setting joinempty=strict.

When no agents were logged in at all QUEUESTATUS contained JOINEMPTY.

When agents were logged in, but no one was available QUEUESTATUS
contained JOINUNAVAIL.

In git commit b8aed684f5f338cf124840376a934b6fed828870 the parameters
for joinempty and leaveempty were refactored to allow a more fine
configuration by setting flags under which circumstances the
agents are treated as unavailable.

Which was a great improvement!

But since that commit it is no longer possible to distuingish between
these two scenarios by evaluationg QUEUESTATUS because JOINUNAVAIL and
LEAVEUNAVAIL are no longer used.
When there are no agents available or even logged in, QUEUESTATUS is set
to JOINEMPTY in all cases.

Right now it would be possible to check for this situations in the
dialplan by using the QUEUE_MEMBER() function.

But that could possibly lead to race conditions when the state of an
agent changes between checking and joining/leaving the queue.

Long story short, the documentation in the source still contains
JOINUNAVAIL and LEAVEUNAVAIL although they are not used in app_queue.c
anymore. That is obviously wrong and should be fixed.

I would prefer a solution which allows to distinguish between 'no agents
logged in' and 'no agents available' in the dialplan without possible
sideeffects like it was before 1.6.2.

I would try to make a patch for this, but right now i am uncertain how
to represent it in the config.

Some thoughts on this:

1. joinempty/leaveempty are misleading and should in principle be
renamed to joinunavail/leaveunavail
-> propably not practicable?!

2. maybe a new parameter should be added to allow to configure not to
join or to leave when the queue is empty
-> joinempty/leaveempty would be good names

3. reuse one of the already existing flags (unavailable?!) and set
QUEUESTATUS to JOINEMPTY when flag is set and no agents are logged in

4. just remove JOINUNAVAIL and LEAVEUNAVAIL from app_queue.c and fix the
documentation

As i said i would prefer to have the option to distinguish, so 1-3 would
make the most sense to me.

What do you guys think about this?

Best regards,
Sebastian Denz



More information about the asterisk-dev mailing list