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










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On July 4th, 2013, 10:29 p.m. UTC, <b>opticron</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/2654/diff/1/?file=41049#file41049line19" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/include/asterisk/bridging_private.h</a>
    <span style="font-weight: normal;">

     (Diff revision 1)

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



 
 

 <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">19</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm">/*!</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">20</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"> * \file</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">21</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"> * \brief Private Bridging API</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">22</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"> *</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">23</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"> * \author Mark Michelson &lt;mmichelson@digium.com&gt;</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">24</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"> *</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">25</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"> * See Also:</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">26</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"> * \arg \ref AstCREDITS</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">27</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cm"> */</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">28</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></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">29</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cp">#ifndef _ASTERISK_PRIVATE_BRIDGING_H</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">30</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cp">#define _ASTERISK_PRIVATE_BRIDGING_H</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 file should not be in include/asterisk as it will be installed with the other headers there. This would expose symbols to modules that can&#39;t actually be linked to.</pre>
 </blockquote>



 <p>On July 5th, 2013, 4:33 p.m. UTC, <b>Matt Jordan</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;">I&#39;m not sure I agree. We already have channel_internal.h, which is supposed to provide functions from the internal API for use only in channel.c. Simply locating this header file outside of include/asterisk doesn&#39;t prevent another translation unit from using that header file.

If you want to provide encapsulation beyond what translation units provide, you&#39;re going to run into some amount of manual enforcement. The fact that we&#39;re breaking things out of bridging.c and creating what is in effect &quot;protected&quot; access is a strong step in the right direction; preventing other units outside of the bridging framework from using those methods feels like it belongs in the domain of peer review.

(It would be nice we used the same naming convention for private/protected headers however)</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;">Hm, naming convention right now is a bit up in the air. On the one hand, you have include/asterisk/_private.h that has a leading _ as an indication that it is private along with the word &quot;private&quot; in the header title. There&#39;s also include/asterisk/channel_internal.h which has the word &quot;internal&quot; in it to indicate that it is not intended for public inclusion.

Of those two, I think &quot;channel_internal&quot; is the better example to follow since it follows a convention of &quot;&lt;API name&gt;_internal.h&quot; to indicate that these are some internal methods for a specific API and they are not intended to be included by code not internal to that API. For consistency&#39;s sake, I&#39;ll change this file&#39;s name to &quot;bridging_internal.h&quot; so that it more closely resembles what we already have.</pre>
<br />




<p>- Mark</p>


<br />
<p>On July 2nd, 2013, 10:11 p.m. UTC, Mark Michelson wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/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 Mark Michelson.</div>


<p style="color: grey;"><i>Updated July 2, 2013, 10:11 p.m.</i></p>







<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-21543">ASTERISK-21543</a>


</div>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>


<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;">This review contains the content necessary to get DTMF attended transfer feature complete.

In order to facilitate this, there are some background tasks that needed to be done first. First, when an attended transfer is initiated, it was clear that the bridge that the parties were in would need to behave differently from how it normally did. In order to allow for this to happen, the concept of bridge &quot;personalities&quot; was added. When a bridge is being used in an attended transfer, it has its personality changed to be that of an attended transfer basic bridge instead of a normal basic bridge. With this personality, the following changes are present:

* The bridge will never dissolve on its own. It must be destroyed by an outside influence.
* The bridge recognizes when a channel with the &quot;transferer&quot; role enters. This channel is bestowed with DTMF hooks and a hangup hook that other channels do not get.
* The normal DTMF hooks are not present for channels. This makes compounding transfers impossible.

In order to make use of an alternate personality for basic bridging, attended transfer functionality was moved from bridges/bridge_builtin_features.c to main/bridging_basic.c. While performing this move, it became clear that it made sense to move blind transfer functionality as well since attended and blind transfers share some common code.

Attended transfer operation has been completely overhauled from its old form. In its old form, the attended transfer DTMF hook would not return until a conclusive result of the transfer could be determined. With this set of changes, the attended transfer DTMF hook sets up an attended_transfer_properties structure that has all the relevant pieces of information for the attended transfer. After setting up the properties, the feature hook launches a monitoring thread and returns.

This monitor thread then runs a state machine that responds to stimuli from various hooks and callbacks. The state machine allows for orderly operation since stimuli may be coming from multiple other threads.

In addition to the normal feedback for reviews (i.e. memory leaks, potential deadlocks, etc.), let me know if you have alternate suggestions for names of things. I struggled to come up with cogent state names for the state machine, so if you have better suggestions for the names, please let me know.</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;">Using the state machine as a guide, I ran through every transition that can be reliably tested (for instance, I couldn&#39;t easily test transfer failures that rely on memory allocation failures). In all cases, I got the result I expected.</pre>
  </td>
 </tr>
</table>


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

 <li>/trunk/main/features.c <span style="color: grey">(393507)</span></li>

 <li>/trunk/main/bridging_roles.c <span style="color: grey">(393507)</span></li>

 <li>/trunk/main/bridging_basic.c <span style="color: grey">(393507)</span></li>

 <li>/trunk/main/bridging.c <span style="color: grey">(393507)</span></li>

 <li>/trunk/include/asterisk/stasis_bridging.h <span style="color: grey">(393507)</span></li>

 <li>/trunk/include/asterisk/features_config.h <span style="color: grey">(393507)</span></li>

 <li>/trunk/include/asterisk/bridging_roles.h <span style="color: grey">(393507)</span></li>

 <li>/trunk/include/asterisk/bridging_private.h <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/trunk/include/asterisk/bridging_features.h <span style="color: grey">(393507)</span></li>

 <li>/trunk/include/asterisk/bridging.h <span style="color: grey">(393507)</span></li>

 <li>/trunk/bridges/bridge_builtin_features.c <span style="color: grey">(393507)</span></li>

 <li>/trunk/main/features_config.c <span style="color: grey">(393507)</span></li>

 <li>/trunk/main/stasis_bridging.c <span style="color: grey">(393507)</span></li>

</ul>

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







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








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