[asterisk-users] Realtime Call Queues : call members in certain order

Steven Wheeler SWheeler at usinternet.com
Fri Feb 28 09:10:04 CST 2014


From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Jonas Kellens
Sent: Thursday, February 27, 2014 7:35 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Realtime Call Queues : call members in certain order

On 13-02-14 17:33, Steven Wheeler wrote:

From: asterisk-users-bounces at lists.digium.com<mailto:asterisk-users-bounces at lists.digium.com> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Jonas Kellens
Sent: Thursday, February 13, 2014 7:12 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Realtime Call Queues : call members in certain order


On 12-02-14 16:58, Steven Wheeler wrote:
From: asterisk-users-bounces at lists.digium.com<mailto:asterisk-users-bounces at lists.digium.com> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Jonas Kellens
Sent: Wednesday, February 12, 2014 3:46 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [asterisk-users] Realtime Call Queues : call members in certain order

Hello,

I'm using MySQL realtime Call Queues (table queues and table queue_members).

I would like to ring the members of the call queue in a certain order. Therefore I use ring strategy lineair and I put the members into the table queue_members in the order in which they have to be rang.


So I have the queue :

| name           | musicclass | announce | context | timeout | monitor_type | monitor_format | queue_youarenext | queue_thereare | queue_callswaiting | queue_holdtime | queue_minutes | queue_seconds | queue_lessthan | queue_thankyou | queue_reporthold | announce_frequency | announce_round_seconds | announce_holdtime | announce_position | retry | wrapuptime | maxlen | servicelevel | strategy | joinempty | leavewhenempty | eventmemberstatus | eventwhencalled | reportholdtime | memberdelay | weight | timeoutrestart | periodic_announce | periodic_announce_frequency | ringinuse |
+----------------+------------+----------+---------+---------+--------------+----------------+------------------+----------------+--------------------+----------------+---------------+---------------+----------------+----------------+------------------+--------------------+------------------------+-------------------+-------------------+-------+------------+--------+--------------+----------+-----------+----------------+-------------------+-----------------+----------------+-------------+--------+----------------+-------------------+-----------------------------+-----------+
| queue6 | default    | NULL     |         |      12 | NULL         | NULL           | NULL             | NULL           | NULL               | NULL           | NULL          | NULL          | NULL           | NULL           | NULL             |                 30 |                   NULL | No                | yes               |     5 |         10 |      0 |         NULL | linear   | strict    | strict         | NULL              | NULL            |           NULL |        NULL |   NULL | no             |                   |                           0 | no        |
+----------------+------------+----------+---------+---------+--------------+----------------+------------------+----------------+--------------------+----------------+---------------+---------------+----------------+----------------+------------------+--------------------+------------------------+-------------------+-------------------+-------+------------+--------+--------------+----------+-----------+----------------+-------------------+-----------------+----------------+-------------+--------+----------------+-------------------+-----------------------------+-----------+


and queue members :

+----------+----------------+----------------+--------------------+---------+--------+
| uniqueid | membername     | queue_name     | interface          | penalty | paused |
+----------+----------------+----------------+--------------------+---------+--------+
|       44 | queuemem4  | queue6 | SIP/queuemem4  |       0 |   NULL |
|       45 | queuemem2  | queue6 | SIP/queuemem2  |       0 |   NULL |
|       46 | queuemem5  | queue6 | SIP/queuemem5  |       0 |   NULL |
|       47 | queuemem1  | queue6 | SIP/queuemem1  |       0 |   NULL |
|       48 | queuemem10 | queue6 | SIP/queuemem10 |       0 |   NULL |
|       49 | queuemem18 | queue6 | SIP/queuemem18 |       0 |   NULL |
|       50 | queuemem17 | queue6 | SIP/queuemem17 |       0 |   NULL |
|       51 | queuemem12 | queue6 | SIP/queuemem12 |       0 |   NULL |
|       52 | queuemem16 | queue6 | SIP/queuemem16 |       0 |   NULL |
|       53 | queuemem13 | queue6 | SIP/queuemem13 |       0 |   NULL |
+----------+----------------+----------------+--------------------+---------+--------+



You can see that the member queuemem4 is first in line to be rang (has the first and lowest uniqueid in the table).

But the first member that is being rang, is queuemem1. How come ??


Kind regards,

Jonas.

Jonas,
We encountered the same problem. It is a bug in the Queue application. The Queue application actually orders members by their interface value. Here is the bug report I opened https://issues.asterisk.org/jira/browse/ASTERISK-18480 which was closed as "Not A Bug" by Digium.  We worked around this by prepending an integer (001__, 002__, ...) to the interface in the database table and then removing it later in the dial plan. Hope this helps.
Steven Wheeler

Hello,

thank you for your reply.


Is it the "membername" or the "interface" that needs to be sorted to have a certain order in the call queue ?


How do you remove the prefix (integer) from a call queue member from dialplan ?

If you call the queue in your dialplan as follow :

exten => s,n,Queue(${queuename},,,,${timeout})

How can you "edit" its members ??



Kind regards,

Jonas.


Jonas,
When asterisk queries the database for queue members it sorts the results based on the value of the interface column.  We use local channels for calling agents (i.e. Local/001__agent at queue_calling/n) so your mileage may vary. To strip off the prefix we have the following in our queue_calling context.
[queue_calling]
exten => _XXX__[A-Za-z0-9*#].,1,Goto(${EXTEN:5},1)
exten => _[A-Za-z0-9*#].,1,...
... Logic to call the agent's SIP phone ...


Hello,

I have tried this logic with Local channels and a prefix for sorting in the database, but this creates another problem :

Seemingly my Call Queue is empty, because I get a QUEUESTATUS = JOINEMPTY

This is now my data in my table :

+----------+-------------+--------------+--------------------------------------------+---------+--------+
| uniqueid | membername  | queue_name   | interface                                  | penalty | paused |
+----------+-------------+--------------+--------------------------------------------+---------+--------+
|     2381 | 3232323232  | voipq4       | Local/01_3232323232 at ExternalCallFromQueue  |       0 |   NULL |
|     2382 | voip1              | voipq4       | Local/02_voip1 at ExternalCallFromQueue             |       0 |   NULL |
|     2383 | voip2              | voipq4       | Local/03_voip2 at ExternalCallFromQueue             |       0 |   NULL |
|     2384 | 3131313131  | voipq4       | Local/04_3131313131 at ExternalCallFromQueue  |       0 |   NULL |
+----------+-------------+--------------+--------------------------------------------+---------+--------+


How can I make the queue members to be logged in to the call queue for accepting calls ?


Kind regards,

Jonas.

Jonas,
It looks like you are missing the state_interface column. Try adding it with this:
ALTER TABLE `<table name>` ADD COLUMN `state_interface` varchar(128) DEFAULT NULL AFTER `interface`;
You will need to specify a hint for each member, something like:
hint:<membername>@<blf/hint context>
Steven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20140228/6f83d512/attachment.html>


More information about the asterisk-users mailing list