<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/2232/">https://reviewboard.asterisk.org/r/2232/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On December 11th, 2012, 10:25 a.m., <b>jrose</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/2232/diff/2/?file=32328#file32328line868" style="color: black; font-weight: bold; text-decoration: underline;">/branches/10/apps/app_confbridge.c</a>
<span style="font-weight: normal;">
(Diff revision 2)
</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; ">void conf_moh_stop(struct conference_bridge_user *user)</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">868</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="n">in_bridge</span> <span class="o">=</span> <span class="o">!</span><span class="n">ast_bridge_suspend</span><span class="p">(</span><span class="n">user</span><span class="o">-></span><span class="n">conference_bridge</span><span class="o">-></span><span class="n">bridge</span><span class="p">,</span> <span class="n">user</span><span class="o">-></span><span class="n">chan</span><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;">Maybe I'm just naive, but setting a variable to !(some integer) strikes me as a little odd. Why not simply set it to ast_bridge_suspend and then use
if (!in_bridge) {
Actually since what we are looking for is a failure, we could also just do it this way:
change variable name to res
...
res = ast_bridge_suspend(...
...
if (res) {
goto bailout_label
}
ast_bridge_unsuspend(...)
bailout_label:
ao2_unlock(...)</pre>
</blockquote>
<p>On December 11th, 2012, 10:37 a.m., <b>rmudgett</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The in_bridge name would be incorrect if I just did
in_bridge = ast_bridge_suspend()
The name should then be not_in_bridge.
Then the code would be
if (!not_in_bridge)
I try to avoid the use of goto if there is a better way. :) Also what you are suggesting here would not start/stop MOH if the bridge channel was not in a bridge yet.</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;">I'm pretty sure what I suggested would do the exact same thing as what you are doing now. If ast_bridge_suspend returns success then it does ast_bridge_suspend followed by the ao2_unlock. If it failed, it just does the ao2_unlock.
The use of ... indicated stuff that happened between that I simply omitted.
Also that's why I suggested you change the variable name. I don't really 'in_bridge' is descriptive of the variable since it's a pass/fail thing.</pre>
<br />
<p>- jrose</p>
<br />
<p>On December 7th, 2012, 9:37 a.m., rmudgett 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.</div>
<div>By rmudgett.</div>
<p style="color: grey;"><i>Updated Dec. 7, 2012, 9:37 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;">When two users enter a new conference simultaneously, one of the callers hears MOH.
* Created a confbridge internal MOH API to eliminate the inlined MOH handling code.
Note that the conference mixing bridge needs to be locked when actually starting/stopping MOH because there is a small window between the conference join unsuspend MOH and actually joining the mixing bridge. Doing the lock this way may be a violation of the bridging API. I don't see an alternative though. See the comment in the conf_moh_start()/conf_moh_stop() functions.
* Created the concept of suspended MOH so it can be interrupted while conference join announcements and DTMF features can operate.
* Suspend any MOH until the user actually joins the bridge of the conference. This way any pre-join file playback does not need to worry about MOH.
* Made post-join actions only play deferred entry announcement files. Changing the user/conference state during that time is not protected or controlled by the state machine.</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;">Simultaneous entry to a new conference does not have one of the users still hearing MOH.
Simultaneous entry of the following user types:
unmarked - unmarked -> MOH is no longer played to the first user who "entered"
waitmarked - marked -> MOH is no longer played to the waitmarked user who "entered" first.
unmarked - waitmarked -> MOH is played to both users since the conference has not started.</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-20606">ASTERISK-20606</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">(377376)</span></li>
<li>/branches/10/apps/confbridge/conf_state.c <span style="color: grey">(377376)</span></li>
<li>/branches/10/apps/confbridge/conf_state_multi_marked.c <span style="color: grey">(377376)</span></li>
<li>/branches/10/apps/confbridge/include/confbridge.h <span style="color: grey">(377376)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2232/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>