<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    it was no longer about what tsilo stores internally, but what
    lookup_to_dset() is given to search for new contact.<br>
    <br>
    To explain with an example:<br>
    <br>
    Call to <a class="moz-txt-link-freetext" href="sip:user@domain">sip:user@domain</a>.<br>
    <br>
    After lookup("location"), the r-uri of INVITE is changed to contact
    address found in location table (let's say it was only one contact
    there, which is <a class="moz-txt-link-freetext" href="sip:randomstring@deviceip:deviceport">sip:randomstring@deviceip:deviceport</a>).<br>
    <br>
    t_relay() is execute and transaction is created, with uas field
    holding the INVITE with r-uri <a class="moz-txt-link-freetext" href="sip:randomstring@deviceip:deviceport">sip:randomstring@deviceip:deviceport</a>.<br>
    <br>
    After a while, a device for same user registers, if I call
    ts_append(..., <a class="moz-txt-link-rfc2396E" href="sip:user@domain">"sip:user@domain"</a>), it finds the INVITE transaction
    to be associated with <a class="moz-txt-link-freetext" href="sip:user@domain">sip:user@domain</a>, but lookup_to_dset() is
    executed internally by tsilo with the argument being the request
    from Transaction->uas (and no explicit URI parameter). So the
    lookup is done for <a class="moz-txt-link-freetext" href="sip:randomstring@deviceip:deviceport">sip:randomstring@deviceip:deviceport</a>), because
    that is the r-uri in T-uas reques. Obviously that will fail to find
    new contacts.<br>
    <br>
    Hopefully I could expose the issue better now.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 22/09/15 15:14, Federico Cabiddu
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAFOaF_hhs28_ynX9DYHq+tCUn=w0g0CASw=6V7RdyJYpoWqLng@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi,
        <div>I'm not sure I fully understand the problem. See my
          comments inline</div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Tue, Sep 22, 2015 at 2:24 PM,
            Daniel-Constantin Mierla <span dir="ltr"><<a
                moz-do-not-send="true" href="mailto:miconda@gmail.com"
                target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:miconda@gmail.com">miconda@gmail.com</a></a>></span> wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hello,<br>
              <br>
              tsilo is not using the uri parameter for looking up
              location for new<br>
              destinations. It passes the uas request from transaction
              module to<br>
              registrar lookup_to_dset() function, so the r-uri from
              that request is used.<br>
              <br>
              However, there is at least one scenario that makes tsilo
              not working<br>
              properly:<br>
              <br>
              - invite comes in<br>
              - lookup location finds a contact<br>
              - request is forwarded with a new r-uri (the contact of
              the location<br>
              record) -- t_relay() is used and trasaction created, r-uri
              stored for<br>
              uas is contact header<br>
              - a new registration comes and ts_append() is executed,
              failing to find<br>
              contacts for r-uri in uas because the r-uri there can be
              anything<br>
              pointing to the first device found in location<br>
            </blockquote>
            <div><br>
            </div>
            <div>This happens because since commit <span
                style="color:rgb(178,104,24);font-family:monospace">1e5bad019c450a003e812ee051d84134aad6c5f0, </span>we
              are using the current uri to store the transaction. </div>
            <div>That's why I was wondering (probably I have not been
              clear in my other mail :)) if, since now ts_store accepts
              uris as parameter, we still need this.</div>
            <div>In this case, the scenario you describe would work
              flawlessly and, if one need to store the transaction under
              a new ruri after some kind of message manipulation (like
              using alias etc) he can always call ts_store with the
              specific uri he wants to use.</div>
            <div>Am I missing something?</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    <blockquote
cite="mid:CAFOaF_hhs28_ynX9DYHq+tCUn=w0g0CASw=6V7RdyJYpoWqLng@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><span style="font-family:monospace"><br>
              </span></div>
            <div> Some solutions can be found by creating transaction
              earlier, but not</div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">easy
              to tackle always.<br>
              <br>
              I think it would be better to just pass the uri parameter
              from<br>
              ts_append() to lookup_to_dset(). But I noticed that the
              uri can be just<br>
              username if use_domain is 0, which makes things a little
              more complex,<br>
              because registrar/usrloc expect full sip uri.<br>
              <br>
              The solution would be to 'force' always that the uri
              parameters for<br>
              tsilo functions are full SIP uri, and let the code extract
              only username<br>
              when use_domain is 0. If someone has only the username in
              config, it can<br>
              simply put the uri parameter as <a class="moz-txt-link-rfc2396E" href="sip:username@localhost">"sip:username@localhost"</a>
              -- domain will<br>
              be ignored anyhow.<br>
              <br>
            </blockquote>
            <div><br>
            </div>
            <div> Agree that this could avoid future headaches and
              provide more flexibility for other use cases. In this
              case, should we totally remove the dependency on usrloc
              "use_domain" parameter?<br>
            </div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Alternative,
              if the parameter is just username, built a temporary uri<br>
              for it before passing to lookup_to_dset().<br>
              <br>
              I find first solution a bit better because the parameter
              for tsilo<br>
              functions is called uri and building an internal one can
              end up in some<br>
              limitations if it is going to be something that requires
              tel: or sips:<br>
              or parameters such as instance.<br>
              <br>
            </blockquote>
            <div><br>
            </div>
            <div>Agree.</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Any
              comments/suggestions?<br>
              <br>
              Cheers,<br>
              Daniel<br>
              <br>
            </blockquote>
            <div><br>
            </div>
            <div>Cheers,</div>
            <div><br>
            </div>
            <div>Federico </div>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - <a class="moz-txt-link-freetext" href="http://asipto.com/u/kat">http://asipto.com/u/kat</a></pre>
  </body>
</html>