<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/1541/">https://reviewboard.asterisk.org/r/1541/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By Terry Wilson.</div>
<p style="color: grey;"><i>Updated Oct. 25, 2011, 1:46 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Despite an ominous sounding comment stating that membercount was for "logged in" members only and thus we couldn't use ao2_container_count(), I could not find a single place in the code where that seemed to be accurate. The only time we decremented membercount was when we were marking something dead or actually removing it. The only places we incremented it were either after ao2_links, or trying to correct for having set it to 0 during a reload. In every case where we were correcting the value, it seems that we are trying to make the count actually match what ao2_container_count() would return. The only place I could find where we made a determination about something being "logged in" or not, we don't trust the membercount, but instead look at devicestate, paused, etc.
This patch removes membercount, replaces its use with ao2_container_count, and (hopefully correctly) manually adds the results of ao2_container_count to a "membercount" field for ast_data queue query results. I tested the same way I did for the other patch. Everything seems to work.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">With the situation:
queues.conf
[test]
strategy=ringall
member => Local/queue1@default,1
member => Local/queue2@default,1
member => Local/queue3@default,1
extensions.conf
[default]
exten => 100,1,Queue(test)
exten => _queueX,1,NoOp(Called ${EXTEN})
same => n,Ringing
same => n,Wait(5)
same => n,Hangup
Dialing 100 will ring all queue members. Changing the penalty of two of the members and doing a 'module reload app_queue.so' and redialing would still ring all of the members on the first try instead of just the lowest penalty member. This was because a reload would set the membercount to 0 and then only increase the membercount for *new* members and not reloaded members. Then, since the penaltymemberlimit = 0 and the membercount = 0, we ignored the penalties and would dial all members. This patch increases the member count for both reloaded and added members since we set the member count to zero on reloads anyway.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Fixes the above scenario.</pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://issues.asterisk.org/jira/browse/AST-676">AST-676</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/branches/1.8/apps/app_queue.c <span style="color: grey">(342327)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1541/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>