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



 <p>Ship it!</p>



 <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 all looks functionally correct to me.  It would be nice if the sample config could be updated to better reflect the behavior of the &#39;secret&#39; and &#39;remotesecret&#39; options.  Something like &quot;The &#39;remotesecret&#39; option is only necessary if the password required to authenticate with the remote endpoint on an outgoing request is different than the one they use to authenticate with us, otherwise if left empty &#39;secret&#39; will be used for both.&quot;  At least I think that makes sense.
</pre>
 <br />





<div>




<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/1107/diff/1/?file=15507#file15507line17601" style="color: black; font-weight: bold; text-decoration: underline;">/branches/1.6.2/channels/chan_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 int build_reply_digest(struct sip_pvt *p, int method, char* digest, int digest_len)</pre></td>

  </tr>
 </tbody>






 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">17601</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="ew">         </span>        <span class="n">username</span> <span class="o">=</span> <span class="n">p</span><span class="o">-&gt;</span><span class="n">authname</span><span class="p">;</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">17601</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="ew">         </span>        <span class="n">username</span> <span class="o">=</span> <span class="n">p</span><span class="o">-&gt;</span><span class="n">authname</span><span class="p">;</span></pre></td>
  </tr>

 </tbody>


 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">17602</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="ew">         </span>        <span class="n">secret</span> <span class="o">=</span>  <span class="n">p</span><span class="o">-&gt;</span><span class="n">peersecret</span><span class="p">;</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">17602</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="ew">         </span>        <span class="n">secret</span> <span class="o">=</span> <span class="n">ast_test_flag</span><span class="p">(</span><span class="o">&amp;</span><span class="n">p</span><span class="o">-&gt;</span><span class="n">flags</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">SIP_OUTGOING</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="n">p</span><span class="o">-&gt;</span><span class="n">relatedpeer</span></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">17603</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="n">ast_strlen_zero</span><span class="p">(</span><span class="n">p</span><span class="o">-&gt;</span><span class="n">relatedpeer</span><span class="o">-&gt;</span><span class="n">remotesecret</span><span class="p">)</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">17604</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="o">?</span> <span class="n">p</span><span class="o">-&gt;</span><span class="n">relatedpeer</span><span class="o">-&gt;</span><span class="n">remotesecret</span> <span class="o">:</span> <span class="n">p</span><span class="o">-&gt;</span><span class="n">peersecret</span><span class="p">;</span></pre></td>
  </tr>

 </tbody>





 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">17603</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="ew">         </span>        <span class="n">md5secret</span> <span class="o">=</span> <span class="n">p</span><span class="o">-&gt;</span><span class="n">peermd5secret</span><span class="p">;</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">17605</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="ew">         </span>        <span class="n">md5secret</span> <span class="o">=</span> <span class="n">p</span><span class="o">-&gt;</span><span class="n">peermd5secret</span><span class="p">;</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Do we even have to check SIP_OUTGOING here?  Isn&#39;t this function always used for building the outbound authentication?</pre>
</div>
<br />



<p>- David</p>


<br />
<p>On February 14th, 2011, 11:58 a.m., Terry Wilson wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.orgrb/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, Olle E Johansson and David Vossel.</div>
<div>By Terry Wilson.</div>


<p style="color: grey;"><i>Updated 2011-02-14 11:58:28</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;">Asterisk 1.6.2+ has the &#39;remotesecret&#39; config option which is documented to be the password we use when connecting out to a peer. The &#39;secret&#39; option is supposed to be used for when we are authenticating an inbound request. &#39;remotesecret&#39; currently works for registration, but for sending an INVITE the &#39;secret&#39; is used instead. This patch tests if we are making an outgoing request and uses the peer remotesecret if it is set. Otherwise it still uses the secret as it always has.</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 that a peer with a &#39;remotesecret&#39; used that on an outbound call. Tested that if remotesecret is not set, secret is used.</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>/branches/1.6.2/channels/chan_sip.c <span style="color: grey">(307791)</span></li>

</ul>

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




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








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