<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 />




<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 10, 2013, 6:20 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;">Rather than attaching the bridging_internal.h file, I have now uploaded a new review that has everything where it should be.</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-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> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">

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

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

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

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

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

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

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

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

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

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

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

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

 <li>/trunk/main/stasis_bridging.c <span style="color: grey">(393998)</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>