<div dir="ltr">Hi,<div>ok, now I understand :)</div><div>What do you think would be the best way to enforce the usage of complete sip uris in ts_append()?</div><div>Do you think that at this point "use_domain" would be useless in tsilo?</div><div><br></div><div>Regards,</div><div><br></div><div>Federico</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 22, 2015 at 3:37 PM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@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">
    And to add the relevant code:<br>
    <br>
    modules/tsilo/ts_append.c line 85:<br>
    <br>
        orig_msg = t->uas.request;<br>
    <br>
        ret = _regapi.lookup_to_dset(orig_msg, table, NULL);<br>
        if(ret != 1) {<br>
            LM_DBG("transaction %u:%u: error updating dset (%d)\n",
    tindex, tlabel, ret);<br>
            return -1;<br>
        }<br>
    <br>
    I want to pass the uri parameter given to t_append() to:<br>
    <br>
    ret = _regapi.lookup_to_dset(orig_msg, table, NULL);<br>
    <br>
    instead of NULL.<br>
    <br>
    Cheers,<br>
    Daniel<div><div class="h5"><br>
    <br>
    <div>On 22/09/15 15:34, Daniel-Constantin
      Mierla wrote:<br>
    </div>
    <blockquote type="cite">
      
      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>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>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>sip:randomstring@deviceip:deviceport</a>.<br>
      <br>
      After a while, a device for same user registers, if I call
      ts_append(..., <a>"sip:user@domain"</a>),
      it finds the INVITE transaction to be associated with <a></a><a>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>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>On 22/09/15 15:14, Federico Cabiddu
        wrote:<br>
      </div>
      <blockquote 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 href="mailto:miconda@gmail.com" target="_blank"></a><a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</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 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></a><a>"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 cols="72">-- 
Daniel-Constantin Mierla
<a href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - <a href="http://asipto.com/u/kat" target="_blank">http://asipto.com/u/kat</a></pre>
    </blockquote>
    <br>
    <pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - <a href="http://asipto.com/u/kat" target="_blank">http://asipto.com/u/kat</a></pre>
  </div></div></div>

</blockquote></div><br></div>