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








<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On March 21st, 2013, 10:34 a.m., <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/2406/diff/1/?file=34844#file34844line502" style="color: black; font-weight: bold; text-decoration: underline;">/team/group/pimp_my_sip/res/res_sip.c</a>
    <span style="font-weight: normal;">

     (Diff revision 1)

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

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

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static const pjsip_method *get_pjsip_method(const char *method)</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">476</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="n">contact</span> <span class="o">=</span> <span class="n">ast_sip_location_retrieve_contact_from_aor_list</span><span class="p">(</span><span class="n">endpoint</span><span class="o">-&gt;</span><span class="n">aors</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;">Contact needs to be unreffed.</pre>
 </blockquote>



 <p>On March 21st, 2013, 2:23 p.m., <b>Mark Michelson</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;">Nope, it&#39;s an RAII_VAR.</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;">Not sure how I missed that...maybe I&#39;m going yellow-highlight-blind from doing code reviews all day.</pre>
<br />




<p>- opticron</p>


<br />
<p>On March 19th, 2013, 5:30 p.m., Mark Michelson 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 Joshua Colp.</div>
<div>By Mark Michelson.</div>


<p style="color: grey;"><i>Updated March 19, 2013, 5:30 p.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;">This adds support for outbound authentication. &quot;Outbound authentication&quot; here means sending requests with authentication credentials based on a challenge received in a 401 or 407 SIP response.

There are two main considerations here: in-dialog requests and out-of-dialog requests.

For in-dialog requests, one uses ast_sip_dialog_setup_outbound_auth() in order to prepare a dialog for performing outbound authentication. This registers a module as a dialog usage so that when an inbound response is received, the module can intercept the response. A callback can be provided when setting up in-dialog outbound authentication if there is any further housekeeping that needs to be done based on the application in use.

For out-of-dialog requests, the outbound authentication logic is taken care of for you by the ast_sip_send_request() function. It registers a callback that will take care of sending an authentication request if the situation arises.

Both make use of a pluggable framework similar to what is used for inbound authentication. Currently the only outbound authenticator written is one that uses digest authentication.

There are some decidedly non-outbound-auth-related changes in this diff; however, they were done so that I could properly test outbound auth. The ast_sip_send_request() method has been split into two functions: one to create a request and one to send a request. This diff actually fills in these functions to be more than just stubs. In doing this, I found code that I needed embedded in other functions, so I pulled out that logic into their own smaller functions so that code did not have to be repeated. sip_options.c has a CLI command that allows for sending an OPTIONS request to an arbitrary endpoint. This was done so that I could test out-of-dialog outbound authentication. While I could remove the CLI command, it seems like a useful thing to have. In addition, chan_sip has a &quot;sip qualify peer&quot; CLI command, so having something similar to work off of is a good thing.</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;">Tested by using SIPp to challenge INVITE requests and OPTIONS requests. In both cases, I tested with and without an outbound authenticator registered. In both cases, behavior was as expected.</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-21199">ASTERISK-21199</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>/team/group/pimp_my_sip/include/asterisk/res_sip.h <span style="color: grey">(383399)</span></li>

 <li>/team/group/pimp_my_sip/res/res_sip.c <span style="color: grey">(383399)</span></li>

 <li>/team/group/pimp_my_sip/res/res_sip.exports.in <span style="color: grey">(383399)</span></li>

 <li>/team/group/pimp_my_sip/res/res_sip/include/res_sip_private.h <span style="color: grey">(383399)</span></li>

 <li>/team/group/pimp_my_sip/res/res_sip/location.c <span style="color: grey">(383399)</span></li>

 <li>/team/group/pimp_my_sip/res/res_sip/sip_configuration.c <span style="color: grey">(383399)</span></li>

 <li>/team/group/pimp_my_sip/res/res_sip/sip_distributor.c <span style="color: grey">(383399)</span></li>

 <li>/team/group/pimp_my_sip/res/res_sip/sip_options.c <span style="color: grey">(383399)</span></li>

 <li>/team/group/pimp_my_sip/res/res_sip/sip_outbound_auth.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/team/group/pimp_my_sip/res/res_sip_authenticator_digest.c <span style="color: grey">(383399)</span></li>

 <li>/team/group/pimp_my_sip/res/res_sip_outbound_authenticator_digest.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/team/group/pimp_my_sip/res/res_sip_session.c <span style="color: grey">(383399)</span></li>

</ul>

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




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








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