<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 6, 2015 at 3:46 PM, Dmitriy Serov <span dir="ltr"><<a href="mailto:serov.d.p@gmail.com" target="_blank">serov.d.p@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>07.03.2015 0:24, Kevin Harwell пишет:<br>
    </div><div><div class="h5">
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Fri, Mar 6, 2015 at 2:06 PM,
            Dmitriy Serov <span dir="ltr"><<a href="mailto:serov.d.p@gmail.com" target="_blank">serov.d.p@gmail.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> Hello.<br>
                <br>
                Asterisk 13.2.<br>
                I transfer configs from chan_sip to res_pjsip.<br>
                In chan_sip i have "match_auth_username=yes" and have
                nothing in pjsip.<br>
                <br>
                I have a lot of endpoints and registrations on same SIP
                server. And it's problem in pjsip now. Is not it?<br>
                <br>
                I requesting to add new value for endpoint option
                identify_by. The value 'uri'.<br>
                Simple config (cutted):<br>
                <br>
                <pre style="margin:0px 0px 1.4em;padding:0.7em 1em;font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;font-size:14px;direction:ltr;text-align:left;color:rgb(51,51,51);border-radius:2px;overflow:auto;word-wrap:normal;border:1px solid rgb(204,204,204);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:19.6px;text-indent:0px;text-transform:none;word-spacing:0px;background-color:rgb(251,250,249)">[siptrunk]
type=registration
transport=udp-transport
outbound_auth=siptrunk
server_uri=sip:<a href="http://sip.example.com" target="_blank">sip.example.com</a>
<a href="mailto:client_uri=sip:1234567890@sip.example.com" target="_blank">client_uri=sip:1234567890@sip.example.com</a>
retry_interval=60
contact_user=siptrunk-in

[siptrunk-in]
type=endpoint
transport=udp-transport
context=from-trunk
disallow=all
allow=ulaw
outbound_auth=siptrunk
aors=siptrunk
identify_by=uri
</pre>
                <br>
                Registration section has option "contact_user". Incoming
                call from this registration will be INVITE
                sip:siptrunk-in@....<br>
                I offer to change res_pjsip_endpoint_identifier_user to
                realize endpoint identification by sip uri.<br>
                <br>
                I think it will be usefull.<br>
                <br>
                P.S. i hope issues will be rejected: <a href="https://issues.asterisk.org/jira/browse/ASTERISK-22306" target="_blank">https://issues.asterisk.org/jira/browse/ASTERISK-22306</a>
                and SWP-6069  <span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:20px;text-align:start;text-indent:0px;text-transform:none;white-space:nowrap;word-spacing:0px;display:inline!important;float:none;background-color:rgb(230,230,230)"><span></span></span><span title="SWP-6069 res_pjsip endpoint config object's
                  'identify_by' option needs cleanup, removal or other
                  modification" style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:20px;text-align:start;text-indent:0px;text-transform:none;white-space:nowrap;word-spacing:0px;background-color:rgb(230,230,230)"><br>
                  <span><font color="#888888"> <br>
                      <br>
                    </font></span></span><span><font color="#888888">Dmitriy Serov </font></span></div>
              <br>
              -<br clear="all">
            </blockquote>
          </div>
          <br>
        </div>
        <div class="gmail_extra">I believe what you are looking for is
          already available. See the "identify" type (type=identify)
          section that is in the pjsip.conf file and the "identify"
          option for endpoints. These allow you to identify and endpoint
          by IP address. <br>
          <br>
          For more information see the pjsip.conf.sample file.  Also
          take a look at configuring Asterisk for res_pjsip [1]
          specifically the part about configuring endpoint
          identification by IP address [2]. If you run into problems
          more information can also be found in the res_pjsip
          troubleshooting guide [3], specifically the section on
          "identify by IP address"<br>
          <br>
          [1] <a href="https://wiki.asterisk.org/wiki/display/AST/Configuring+res_pjsip" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Configuring+res_pjsip</a><br>
          [2] <a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Configuration_res_pjsip_endpoint_identifier_ip" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Configuration_res_pjsip_endpoint_identifier_ip</a><br>
          [3] <a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+PJSIP+Troubleshooting+Guide" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Asterisk+PJSIP+Troubleshooting+Guide</a><br>
          <br>
        </div>
        <div class="gmail_extra">Hope that helps,<br>
        </div>
        <div class="gmail_extra"><br></div></div></blockquote><br></div></div>
    Thank you for answer. But...<br>
    ones again: I have a lot of endpoints and registrations on same SIP
    server. And it's problem in pjsip now. Is not it?<br>
    <br>
    Simple Example. I have two trunks with their own credentials (and
    did) to the same sip server:<br>
    - for home<br>
    - for bussiness<br>
    <br>
    [home-example.com-endpoint]<br>
    <br>
    [bussiness-example.com-endpoint]<br>
    <br>
    [home-example.com-registration]<br>
    contact_user=home-example.com-endpoint<br>
    <br>
    [bussiness-example.com-registration]<br>
    contact_user=bussiness-example.com-endpoint<br>
    <br>
    ;and ok... i wrote identify by IP section<br>
    [example.com-identify]<br>
    type=identify<br>
    match=<a href="http://example.com" target="_blank">example.com</a><br>
    endpoint= ???<br>
    <br>
    It is very! important for me to know what trunk passes through the
    incoming call: home or bussiness.<br>
    1. Identify by IP. Do you have answer?<br>
    2. Identify by username. What? I can't make endpoints to all of my
    contacts.<br>
    <br>
    Ok. I can use contact_user in registraction and route incoming call
    by INVITE uri.<br>
    Can i?<span class="HOEnZb"><font color="#888888"><br>
    <br>
    Dmitriy Serov<br>
    <br>
  </font></span></div>

<br></blockquote></div><br></div><div class="gmail_extra">I don't think I fully understand the scenario, but if you have different named endpoints originating from the same address (or even different addresses) then these can be identified by the username portion of the sip uri. However, if you have endpoints for instance with the same name, but different addresses then these can be distinguished by using the identity type.<br><br></div><div class="gmail_extra">Your scenario looks like the first option. The endpoint names are different, but the address is the same, so identification based on the username should be sufficient.<br><br></div><div class="gmail_extra">However, if you have a mix of both types on your system, for instance multiple endpoints on two different systems (IP addresses) with the same names, then I am unsure how you would select the correct endpoint even while attempting to "identify_by" uri.<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature"><div dir="ltr"><pre style="padding:2px;border:1px solid rgb(114,99,77);background-color:rgb(238,238,238);color:rgb(0,0,0);overflow:auto">Kevin Harwell
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: <a href="http://digium.com" target="_blank">http://digium.com</a> & <a href="http://asterisk.org" target="_blank">http://asterisk.org</a></pre></div></div>
</div></div>