<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/4336/">https://reviewboard.asterisk.org/r/4336/</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.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers.</div>
<div>By Matt Jordan.</div>


<p style="color: grey;"><i>Updated Jan. 14, 2015, 12:07 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;">Addressed Richard's points.

Note that I took a pessimistic view of the world here, and am quite defensive with the logic on whether or not a DialEnd event needs to be raised. This is for two reasons:
(1) The Dial code is long, sequential, and filled with blocks that can easily have additional logic inserted where you would not expect. Hence, everyone check that they should raise the DialEnd event before doing so.
(2) Multiple DialEnd events are very, very, very, very bad.</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-24682">ASTERISK-24682</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;">The Dial application has some interesting options with the mid-call Macro (M) and GoSub (U) options. If the MACRO_RESULT/GOSUB_RESULT returns specific values, the Dial application will take some action upon the channels involved in the dial operation (such as hanging up a particular party, etc.) The Dial application ensures that a Stasis message is published in the event that MACRO_RESULT/GOSUB_RESULT returns a value that kills the dial operation, so that there is a corresponding DialEnd event published in AMI/ARI for the DialBegin event that preceeded it.

A bug exists where that same DialEnd event will be published on Stasis even if the value returned in MACRO_RESULT/GOSUB_RESULT is not one that the Dial application cares about. This causes two DialEnd events to be published - one with the MACRO_RESULT/GOSUB_RESULT and another with "ANSWERED" - which is all sorts of wrong.

This patch fixes the bug by ensuring that we only publish a DialEnd message to Stasis if the Dial application's mid-call Macro/GoSub returns something that Dial cares about.</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;">See https://reviewboard.asterisk.org/r/4337 for tests.</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>/branches/13/apps/app_dial.c <span style="color: grey">(430607)</span></li>

</ul>

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







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




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