<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/2072/">https://reviewboard.asterisk.org/r/2072/</a>
     </td>
    </tr>
   </table>
   <br />








<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On September 21st, 2012, 11:11 a.m., <b>Matt Jordan</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://reviewboard.asterisk.org/r/2072/diff/8/?file=31269#file31269line66" style="color: black; font-weight: bold; text-decoration: underline;">/branches/10/apps/confbridge/conf_state_multi.c</a>
    <span style="font-weight: normal;">

     (Diff revision 8)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
   <td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static void join_marked(struct conference_bridge_user *cbu)</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">66</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="k">static</span> <span class="kt">void</span> <span class="nf">leave_unmarked</span><span class="p">(</span><span class="k">struct</span> <span class="n">conference_bridge_user</span> <span class="o">*</span><span class="n">cbu</span><span class="p">)</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">67</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="p">{</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">68</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="n">conf_remove_user_active</span><span class="p">(</span><span class="n">cbu</span><span class="o">-&gt;</span><span class="n">conference_bridge</span><span class="p">,</span> <span class="n">cbu</span><span class="p">);</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">69</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="k">if</span> <span class="p">(</span><span class="n">cbu</span><span class="o">-&gt;</span><span class="n">conference_bridge</span><span class="o">-&gt;</span><span class="n">activeusers</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">70</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="n">conf_change_state</span><span class="p">(</span><span class="n">cbu</span><span class="p">,</span> <span class="n">CONF_STATE_SINGLE</span><span class="p">);</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">71</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="p">}</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">72</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="p">}</span></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This transition has the potential to be incorrect.

Conference is in state MULTI with Marked User One and Unmarked User One.  Unmarked User One leaves the conference.  This changes the state to CONF_STATE_SINGLE, instead of CONF_STATE_SINGLE_MARKED.

At that point if an active user joins, we&#39;ll transition to CONF_STATE_MULTI, instead of CONF_STATE_MULTI_MARKED.

I&#39;m not sure how far off the tracks this gets, but whenever we have a person leave, we need to make sure that if the last person in the conference is marked, we transition back to the correct SINGLE state.</pre>
 </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">And this finding is incorrect, because you can&#39;t get into CONF_STATE_MULTI with a marked user.

This confused me, since the file names for single are conf_state_single and conf_state_single_marked; while multi are conf_state_multi and conf_state_marked.  Can we make them consistent?  I&#39;d prefer conf_state_multi (where no one is marked) and conf_state_multi_marked (where at least one person is marked)</pre>
<br />




<p>- Matt</p>


<br />
<p>On September 17th, 2012, 11:51 a.m., Terry Wilson wrote:</p>






<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 and Neil Tallim.</div>
<div>By Terry Wilson.</div>


<p style="color: grey;"><i>Updated Sept. 17, 2012, 11:51 a.m.</i></p>




<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;">Thank&#39;s to flan&#39;s tireless testing, issue reporting, and patches it became clear that app_confbridge had some complex logic and was missing some corner cases. In particular, it didn&#39;t handle mixing unmarked and waitmarked users very well and was inconsistent in how MOH and muting was applied.  flan&#39;s patches seem to fix the issue, but they highlight how hard the code could be to maintain. In an attempt to make things easier to maintain and to more fully enumerate the various cases that exist, I have attempted to break up the logic into a state machine-like setup.

This should fix all of the issues in the linked bugs, as well as a couple of other issues. I still need to add some documentation, but I thought I&#39;d give people a chance to look at it test it out, and comment.

One thing to note is that this solution involves treating waitmarked users without a marked user as essentially outside of the conference. For now, I have the announce_user_count stuff taking into account both the counts for waiting and active users which can lead to things like having a single waiting user followed by an unmarked user and the announcement that &quot;there is one other user in the conference&quot; (because we count the waiting user there) followed by &quot;you are the only user in the conference&quot; (because that prompt plays when you are the only active user) being played to the unmarked user. This is easy to fix, we just need to decide which way to go. Count users who are essentially outside the conference (they can&#39;t speak or hear) or not?</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;">Lots of calls. Need to do more formalized testing.</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/ASTERISK-19562">ASTERISK-19562</a>, 

 <a href="https://issues.asterisk.org/jira/browse/ASTERISK-19726">ASTERISK-19726</a>, 

 <a href="https://issues.asterisk.org/jira/browse/ASTERISK-20181">ASTERISK-20181</a>


</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/branches/10/apps/app_confbridge.c <span style="color: grey">(373118)</span></li>

 <li>/branches/10/apps/confbridge/conf_state.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/branches/10/apps/confbridge/conf_state_empty.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/branches/10/apps/confbridge/conf_state_inactive.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/branches/10/apps/confbridge/conf_state_marked.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/branches/10/apps/confbridge/conf_state_multi.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/branches/10/apps/confbridge/conf_state_single.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/branches/10/apps/confbridge/conf_state_single_marked.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/branches/10/apps/confbridge/include/conf_state.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/branches/10/apps/confbridge/include/confbridge.h <span style="color: grey">(373118)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/2072/diff/" style="margin-left: 3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>