<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">On 8/27/13 12:10 PM, Vitaliy
      Aleksandrov wrote:<br>
    </div>
    <blockquote cite="mid:521C7B29.3050604@gmail.com" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">On 08/27/2013 11:57 AM,
        Daniel-Constantin Mierla wrote:<br>
      </div>
      <blockquote cite="mid:521C69DF.2030305@gmail.com" type="cite">
        <meta content="text/html; charset=ISO-8859-1"
          http-equiv="Content-Type">
        Hello,<br>
        <br>
        thanks for the patch. Some remarks.<br>
        <br>
        As you highlighted that the solution is not very efficient (due
        to no direct mapping between records and tcp connection), it
        should have a way to disable it (maybe via mod param for
        usrloc).<br>
        <br>
        At this moment is hardcoded for 'location' table, but there can
        be other names used, since this value is given as parameter to
        save()/lookup(). It will have to iterate through all usrloc
        tables (called domains interanlly in the module).<br>
      </blockquote>
      Ok, I'll remove hardcoded "location" domain. It will search in all
      domains from dlist_t. Module parameter will be added too.<br>
      I understand that search through the all contacts is not for
      production use at all. I really need this feature and I'm sure
      everyone who uses tcp/tls/ws too so I wanted to start this
      discussion from a little peace of code to get feedback from
      community.<br>
    </blockquote>
    I understand, I just proposed a way to move further and improve a
    bit.<br>
    <br>
    <blockquote cite="mid:521C7B29.3050604@gmail.com" type="cite">
      <blockquote cite="mid:521C69DF.2030305@gmail.com" type="cite">
        Also, if I didn't get it wrong, it works only with in-memory
        records, if the usrloc is configured in db-only mode, it does
        not work with current patch, right?<br>
        <br>
      </blockquote>
      To remove old contacts i've used delete_ucontact from usrloc api.
      This function checks db_mode and removes contact from db in case
      of DB_ONLY mode and just updates expiration in case of WRITE_BACK.
      <br>
    </blockquote>
    <br>
    But the issue would be that the hash tables will not be in memory,
    so you will not get in this way to call the delete_ucontact()
    function. This function is called via a different code path for db
    only mode.<br>
    <br>
    <blockquote cite="mid:521C7B29.3050604@gmail.com" type="cite">
      <blockquote cite="mid:521C69DF.2030305@gmail.com" type="cite"> I
        had in mind to implement such features, but using timer, to
        iterate through tcp connections and see if there is still an
        open connection for it. This will do delayed discovery, but I am
        not sure it will bring more benefits -- initially I thought is
        faster lookup done by a dedicated timer, presumly there are less
        tcp connections that usrloc records.<br>
      </blockquote>
      <br>
      <blockquote cite="mid:521C69DF.2030305@gmail.com" type="cite">
        Anyhow, perhaps we should do some optimization here, we can
        store the connection id in usrloc structure and then match
        received address only if there is same conenction id. Or add
        received built from tcp connection close callback in a list that
        is used by usrloc expires timers.<br>
      </blockquote>
      Searching through a single list from a separate process sounds
      much better than my version. I'll try to implement this when I
      have free time.<br>
      <br>
    </blockquote>
    OK. My thought for the moment would be to keep this list in shared
    memory, and then usrloc cleaning-expired-records timers would check
    if there is a match for each tcp connection - no matter is expired
    record or not, because they iterate anyhow thorugh all records. This
    will need a different approach for db only mode as well.<br>
    <br>
    However, other solutions can be proposed and implemented.<br>
    <br>
    <blockquote cite="mid:521C7B29.3050604@gmail.com" type="cite"> <br>
      The way Olle proposed looks more preferable as it can work in
      environment with separate registrar and outbound servers. But I
      have to read some theory about outbound before moving this way.<br>
    </blockquote>
    That would be good too, but the number of devices with SIP Outbound
    support is still low out there.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<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>
Kamailio Advanced Trainings - Berlin, Oct 21-24; Miami, Nov 11-13, 2013
  - more details about Kamailio trainings at <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a> -
</pre>
  </body>
</html>