<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"> asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com]
<b>On Behalf Of </b>Jonas Kellens<br>
<b>Sent:</b> Thursday, February 13, 2014 7:12 AM<br>
<b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion<br>
<b>Subject:</b> Re: [asterisk-users] Realtime Call Queues : call members in certain order<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 12-02-14 16:58, Steven Wheeler wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
<a href="mailto:asterisk-users-bounces@lists.digium.com">asterisk-users-bounces@lists.digium.com</a> [<a href="mailto:asterisk-users-bounces@lists.digium.com">mailto:asterisk-users-bounces@lists.digium.com</a>]
<b>On Behalf Of </b>Jonas Kellens<br>
<b>Sent:</b> Wednesday, February 12, 2014 3:46 AM<br>
<b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion<br>
<b>Subject:</b> [asterisk-users] Realtime Call Queues : call members in certain order</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-family:"Helvetica","sans-serif"">Hello,<br>
<br>
I'm using MySQL realtime Call Queues (table <i>queues</i> and table <i>queue_members</i>).<br>
<br>
I would like to ring the members of the call queue in a certain order. Therefore I use ring strategy
<i>lineair </i>and I put the members into the table <i>queue_members</i> in the order in which they have to be rang.<br>
<br>
<br>
So I have the queue :<br>
<br>
| 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 |<br>
+----------------+------------+----------+---------+---------+--------------+----------------+------------------+----------------+--------------------+----------------+---------------+---------------+----------------+----------------+------------------+--------------------+------------------------+-------------------+-------------------+-------+------------+--------+--------------+----------+-----------+----------------+-------------------+-----------------+----------------+-------------+--------+----------------+-------------------+-----------------------------+-----------+<br>
| 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        |<br>
+----------------+------------+----------+---------+---------+--------------+----------------+------------------+----------------+--------------------+----------------+---------------+---------------+----------------+----------------+------------------+--------------------+------------------------+-------------------+-------------------+-------+------------+--------+--------------+----------+-----------+----------------+-------------------+-----------------+----------------+-------------+--------+----------------+-------------------+-----------------------------+-----------+<br>
<br>
<br>
and queue members :<br>
<br>
+----------+----------------+----------------+--------------------+---------+--------+<br>
| uniqueid | membername     | queue_name     | interface          | penalty | paused |<br>
+----------+----------------+----------------+--------------------+---------+--------+<br>
|       44 | queuemem4  | queue6 | SIP/queuemem4  |       0 |   NULL |<br>
|       45 | queuemem2  | queue6 | SIP/queuemem2  |       0 |   NULL |<br>
|       46 | queuemem5  | queue6 | SIP/queuemem5  |       0 |   NULL |<br>
|       47 | queuemem1  | queue6 | SIP/queuemem1  |       0 |   NULL |<br>
|       48 | queuemem10 | queue6 | SIP/queuemem10 |       0 |   NULL |<br>
|       49 | queuemem18 | queue6 | SIP/queuemem18 |       0 |   NULL |<br>
|       50 | queuemem17 | queue6 | SIP/queuemem17 |       0 |   NULL |<br>
|       51 | queuemem12 | queue6 | SIP/queuemem12 |       0 |   NULL |<br>
|       52 | queuemem16 | queue6 | SIP/queuemem16 |       0 |   NULL |<br>
|       53 | queuemem13 | queue6 | SIP/queuemem13 |       0 |   NULL |<br>
+----------+----------------+----------------+--------------------+---------+--------+<br>
<br>
<br>
<br>
You can see that the member <i>queuemem4</i> is first in line to be rang (has the first and lowest uniqueid in the table).<br>
<br>
But the first member that is being rang, is <i>queuemem1</i>. How come ??<br>
<br>
<br>
Kind regards,<br>
<br>
Jonas.</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext"> </span><o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext">Jonas,</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext">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 <a href="https://issues.asterisk.org/jira/browse/ASTERISK-18480">
https://issues.asterisk.org/jira/browse/ASTERISK-18480</a> 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.</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext">Steven Wheeler</span><o:p></o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:13.5pt;font-family:"Helvetica","sans-serif""><br>
Hello,<br>
<br>
thank you for your reply.<br>
<br>
<br>
Is it the "membername" or the "interface" that needs to be sorted to have a certain order in the call queue ?<br>
<br>
<br>
How do you remove the prefix (integer) from a call queue member from dialplan ?<br>
<br>
If you call the queue in your dialplan as follow :<br>
<br>
exten => s,n,Queue(${queuename},,,,${timeout})<br>
<br>
How can you "edit" its members ??<br>
<br>
<br>
<br>
Kind regards,<br>
<br>
Jonas.<br>
<br>
</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext">Jonas,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext">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@queue_calling/n) so your mileage may vary. To strip off the prefix we have the following in our queue_calling context.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:windowtext">[queue_calling]<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:windowtext">exten => _XXX__[A-Za-z0-9*#].,1,Goto(${EXTEN:5},1)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:windowtext">exten => _[A-Za-z0-9*#].,1,...<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext">… Logic to call the agent's SIP phone …<o:p></o:p></span></p>
</div>
</body>
</html>