<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/4476/">https://reviewboard.asterisk.org/r/4476/</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, Matt Jordan and rnewton.</div>
<div>By Dmitriy Serov.</div>


<p style="color: grey;"><i>Updated March 24, 2015, 12:23 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;">Fixed Copyright and the name of module.</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-24852">ASTERISK-24852</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 main task: to find the right endpoint for an incoming call with a trunk that has outbound registration.

Simple example (a piece of pjsip.conf):
[trunk1]
type=registration
transport=udp-transport
outbound_auth=trunk1
server_uri=sip:sip.example.com
client_uri=sip:user1@sip.example.com
contact_user=trunk1-in

[trunk2]
type=registration
transport=udp-transport
outbound_auth=trunk2
server_uri=sip:sip.example.com
client_uri=sip:user2@sip.example.com
contact_user=trunk2-in

[trunk1-in]
type=endpoint
context=from-trunk
disallow=all
allow=ulaw
outbound_auth=trunk1
aors=trunk1

[trunk2-in]
type=endpoint
context=from-trunk
disallow=all
allow=ulaw
outbound_auth=trunk2
aors=trunk2

trunk1, trunk2 - outbound registrations to EXTERNAL sip server sip.example.com. One server and two registrations.
; "contact_user=" sets the SIP contact header's user portion of the SIP URI this will affect the extension reached in dialplan when the far end calls you at this registration.
In example option has values "trunk1-in" and "trink2-in".

Case: random user admin@sip.example.com calling to user2@sip.example.com.
External sip server redirect call to my server with packet:
INVITE sip:trunk2-in@8.8.8.8:5060 SIP/2.0
From: "PhonerLite" <sip:admin@sip.example.com>;tag=5F39A540-782390-DE41886A_kmbdctn-8A47
To: <sip:user2@sip.example.com>

This invite can be:
- anonymous. Very bad.
- identified by IP. Config has two endpoints with same IP.
- identified by username From. It cannot identify by "admin" (random)

res_pjsip_endpoint_identifier_request_user helps to identify this invite by uri username in request line (contact_user in registration).</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/res/res_pjsip_endpoint_identifier_request_user.c <span style="color: grey">(PRE-CREATION)</span></li>

</ul>

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







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




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