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


<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.</div>
<div>By David Vossel.</div>


<p style="color: grey;"><i>Updated 2010-12-09 12:16:42.954704</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;">This update is bas&#39;s port of this patch to 1.8 and trunk.  It adds an option to turn on and off matching by callbackextension.</pre>
  </td>
 </tr>
</table>


<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;">If there are a number of peers with different callbackextension parameters and the same host address.  The first peer found matching the address is used regardless if that peer&#39;s callbackextension matches the incoming extension or not.

Now, to better match peers with incoming calls, if an incoming call&#39;s address can match multiple peers by address, we check each of those peer&#39;s callbackextension against the incoming extension for the best possible match.

It is possible that my implementation may be too expensive and only serve to address a minor edge case in the usage of chan_sip.  I do not fully understand the impact my changes may have upon performance when a large number of peers are present.  This patch assumes the new parse_uri() change has been made.

-------------------------------------------
for example with two peers as follows
[trunk1]
host=sip.myitsp.com
callbackextension=9991
...
[trunk2]
host=sip.myitsp.com
callbackextension=9992
...

incoming calls to 9991 and to 9992 are both matched to the peer trunk1
--------------------------------------------
</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 multiple peers with the same address containing different callbackextensions. Verified the correct peers were matched with incoming calls.</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/view.php?id=14340">14340</a>


</div>


<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/channels/chan_sip.c <span style="color: grey">(297950)</span></li>

 <li>/trunk/channels/sip/include/sip.h <span style="color: grey">(297950)</span></li>

 <li>/trunk/configs/sip.conf.sample <span style="color: grey">(297950)</span></li>

</ul>

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




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




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