<div dir="ltr">Hello,<div><br></div><div>It works also for me with UDP contacts, thank you. One more thing I noticed - by using <b>db_mode=1</b> and <b>db_load=1</b> after restarting Kamailio it's not loading anymore all contacts from the DB or it's loading but then keepalive module it's removing them from the local memory, I believe this is because keepalive doesn't know the status of the extension, will be nice to have that fixed as well.</div><div><br></div><div>Regards,</div><div>Ilie.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 23 Sep 2020 at 16:35, Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>Hello,</p>
    <p>actually the expires processing on keepalive was done in a
      callback function triggered only by nathelper, only sending
      keepalive and computing roundtrip was done on usrloc internal
      timer callbacks. I pushed fixes to master and 5.4 branches, I
      tested briefly with a tcp contact and all seemed ok. Let me know
      if works for you as well.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <p><br>
    </p>
    <div>On 23.09.20 10:51, Ilie Soltanici
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>Hello,</div>
        <div><br>
        </div>
        <div>It's sitting in the memory until the expiration time it's
          arriving. See below the ul dump output:</div>
        <div><br>
        </div>
        <div>Every 2.0s: /usr/local/sbin/kamcmd ul.dump                
                                                                       
                                                                       
                                                                       
                      Wed Sep 23 09:43:44 2020<br>
          <br>
          {<br>
                  Domains: {<br>
                          Domain: {<br>
                                  Domain: location<br>
                                  Size: 1024<br>
                                  AoRs: {<br>
                                          Info: {<br>
                                                  AoR: 101<br>
                                                  HashID: -1698832128<br>
                                                  Contacts: {<br>
                                                          Contact: {<br>
                                                                 
          Address: <a>sip:101@192.168.0.18:49195;ob</a><br>
                                                                 
          Expires: 3548<br>
                                                                  Q:
          1.000000<br>
                                                                 
          Call-ID: 03514e7aff5a4c3785b471923ef9a4c5<br>
                                                                  CSeq:
          49773<br>
                                                                 
          User-Agent: MicroSIP/3.20.0<br>
                                                                 
          Received: sip:<a href="http://8.8.8.123:10037" target="_blank">8.8.8.123:10037</a><br>
                                                                  Path:
          [not set]<br>
                                                                  State:
          CS_SYNC<br>
                                                                  Flags:
          0<br>
                                                                 
          CFlags: 12288<br>
                                                                 
          Socket: udp:<a href="http://1.1.1.10:5060" target="_blank">1.1.1.10:5060</a><br>
                                                                 
          Methods: 8159<br>
                                                                  Ruid:
          uloc-b-5f6a75ac-7ed8-1<br>
                                                                 
          Instance: [not set]<br>
                                                                 
          Reg-Id: 0<br>
                                                                 
          Server-Id: 11<br>
                                                                 
          Tcpconn-Id: -1<br>
                                                                 
          Keepalive: 1<br>
                                                                 
          Last-Keepalive: 1600850587<br>
                                                                 
          KA-Roundtrip: 20790<br>
                                                                 
          Last-Modified: 1600850572<br>
                                                          }<br>
                                                  }<br>
                                          }<br>
                                  }<br>
                                  Stats: {<br>
                                          Records: 1<br>
                                          Max-Slots: 1<br>
                                  }<br>
                          }<br>
                  }<br>
          }</div>
        <div><br>
        </div>
        <div>So, for the above extension (101) it will be removed from
          the memory only after 3548 sec, even if I killed manually that
          connection and the softphone it's not replying anymore to the
          keepalive options. By using the keepalive_timeout function
          from the nathelper module - it's working fine. <br>
        </div>
        <div><br>
        </div>
        <div>Regards,</div>
        <div>Ilie.<br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, 23 Sep 2020 at 08:05,
          Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div>
            <p>Hello,</p>
            <p>have you watched for how long it stays in memory? The
              usrloc keepalive should leverage the same mechanism that
              was used by the keepalive done by nathelper module, it
              should not delete the record immediately, but after
              ka_timeout elapsed from the last received keepalive, then
              expires is set to current timestamp + 10 seconds, so the
              next timer cleanup should remove with.</p>
            <p>Can you get the kamctl up dump for the phone you tested
              with? The keepalive related attributes (last keepalive
              timestamp, last rtt) should be in the json output/</p>
            <p>Cheers,<br>
              Daniel<br>
            </p>
            <div>On 23.09.20 00:13, Ilie Soltanici wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">Hello,
                <div><br>
                </div>
                <div>Tried with the latest 5.4 branch, but ka_timeout
                  still not working for me, the record it's still
                  available in ul.dump even if that extension is not
                  replying anymore to the Options sent by the module.</div>
                <div><br>
                </div>
                <div>See below used configuration:</div>
                <div>modparam("usrloc", "nat_bflag", FLB_NATB)<br>
                  modparam("usrloc", "use_domain", FLS_MULTIDOMAIN)<br>
                  modparam("usrloc", "timer_interval", 30)<br>
                  modparam("usrloc", "db_mode", 1)<br>
                  modparam("usrloc", "db_load", 1)<br>
                  modparam("usrloc", "db_insert_update", 1)<br>
                  modparam("usrloc", "matching_mode", 3)<br>
                  modparam("usrloc", "fetch_rows", 4000)<br>
                  modparam("usrloc", "timer_procs", 4)<br>
                  modparam("usrloc", "handle_lost_tcp", 1)<br>
                  modparam("usrloc", "close_expired_tcp", 1)<br>
                  modparam("usrloc", "db_timer_clean", 1)<br>
                  modparam("usrloc", "server_id_filter", 1)<br>
                  modparam("usrloc", "ka_mode", 1)<br>
                  modparam("usrloc", "ka_method", "OPTIONS")<br>
                  modparam("usrloc", "ka_from", "<a href="mailto:sip%3Aoptions@devserver.net" target="_blank">sip:options@devserver.net</a>")<br>
                  modparam("usrloc", "ka_domain", "<a href="http://devserver.net" target="_blank">devserver.net</a>")<br>
                  modparam("usrloc", "ka_filter", 0)<br>
                  modparam("usrloc", "ka_timeout", 60)<br>
                  modparam("tm|usrloc", "xavp_contact", "ulattrs")<br>
                </div>
                <div><br>
                </div>
                <div>version: kamailio 5.4.1 (x86_64/linux) 609685<br>
                </div>
                <div><br>
                </div>
                <div>Regards,</div>
                <div>Ilie</div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Tue, 22 Sep 2020 at
                  18:58, Ilie Soltanici <<a href="mailto:iliusha.md@gmail.com" target="_blank">iliusha.md@gmail.com</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                  <div dir="auto">Thank you Daniel for the latest
                    update, I will try to test the latest 5.4 branch on
                    the Dev environment and will come back here for any
                    issues encountered.</div>
                  <div dir="auto"><br>
                  </div>
                  <div dir="auto">Regards,</div>
                  <div dir="auto">Ilie.</div>
                  <div><br>
                    <div class="gmail_quote">
                      <div dir="ltr" class="gmail_attr">On Tue 22 Sep
                        2020 at 18:44, Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>
                        wrote:<br>
                      </div>
                      <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
                        <br>
                        <br>
                        <br>
                        <br>
                        <br>
                        <br>
                        <br>
                        <div><br>
                          <br>
                          <p>Hello,</p>
                          <br>
                          <br>
                          <p>the usrloc keepalive are done on its timer
                            interval:</p>
                          <br>
                          <br>
                          <p>  -<br>
                            <br>
                            <a href="https://www.kamailio.org/docs/modules/stable/modules/usrloc.html#usrloc.p.timer_interval" target="_blank">https://www.kamailio.org/docs/modules/stable/modules/usrloc.html#usrloc.p.timer_interval</a></p>
                          <br>
                          <br>
                          <p>For the keepalive timeout I was misled by
                            presence of the global<br>
                            <br>
                            variable in the usrloc, but was actually not
                            exported by this<br>
                            <br>
                            module. I did it afterwards, just pushed to
                            branch 5.4 as well.</p>
                          <br>
                          <br>
                          <p>While is not recommended to run both at the
                            same time, imo<br>
                            <br>
                            nothing really bad can happen, you may see
                            more keepalives for<br>
                            <br>
                            natted udp contacts (not for tls, tcp, ...).</p>
                          <br>
                          <br>
                          <p>As for an unorthodox and untested idea :-)
                            : if you do not want<br>
                            <br>
                            to run from latest 5.4 branch yet, you can
                            eventually set<br>
                            <br>
                            natping_interval to a very large value, like
                            20 years in seconds,<br>
                            <br>
                            so you are pretty sure you will do an
                            upgrade before nathelper<br>
                            <br>
                            timer fires,</p>
                          <br>
                          <br>
                          <p>Cheers,<br>
                            <br>
                            <br>
                            Daniel<br>
                            <br>
                            <br>
                          </p>
                        </div>
                        <div><br>
                          <br>
                          <div>On 22.09.20 19:17, Ilie Soltanici<br>
                            <br>
                            wrote:<br>
                            <br>
                            <br>
                          </div>
                          <br>
                          <br>
                        </div>
                        <div>
                          <blockquote type="cite"><br>
                            <br>
                            <br>
                            <br>
                            <div dir="ltr"><br>
                              <br>
                              <div>Hello,</div>
                              <br>
                              <br>
                              <div><br>
                                <br>
                                <br>
                              </div>
                              <br>
                              <br>
                              <div>Is there any way to add those
                                functions from the nathelper<br>
                                <br>
                                module to the usrloc module?</div>
                              <br>
                              <br>
                              <div><br>
                                <br>
                                <br>
                              </div>
                              <br>
                              <br>
                              <div><b>keepalive_timeout<br>
                                  <br>
                                  <br>
                                  natping_interval</b></div>
                              <br>
                              <br>
                              <div><br>
                                <br>
                                <br>
                              </div>
                              <br>
                              <br>
                              <div>I'm looking to use ka_mode feature
                                from the usrloc module<br>
                                <br>
                                in order to have roundtrip time computed
                                for each extension<br>
                                <br>
                                but because those functions are missing
                                in the usrloc module<br>
                                <br>
                                and per documentation this functionality
                                conflicts in some way<br>
                                <br>
                                with nathelper module it's not
                                recommended to have both<br>
                                <br>
                                modules enabled.  Or maybe there is
                                another way to have them<br>
                                <br>
                                "interconnected"?<br>
                                <br>
                                <br>
                              </div>
                              <br>
                              <br>
                              <div><br>
                                <br>
                                <br>
                              </div>
                              <br>
                              <br>
                              <div>Thank you.<br>
                                <br>
                                <br>
                              </div>
                              <br>
                              <br>
                            </div>
                            <br>
                            <br>
                            <br>
                            <br>
                            <br>
                            <fieldset></fieldset>
                            <br>
                            <br>
                          </blockquote>
                        </div>
                        <div>
                          <blockquote type="cite">
                            <pre style="font-family:monospace">_______________________________________________

Kamailio (SER) - Users Mailing List

<a href="mailto:sr-users@lists.kamailio.org" style="font-family:monospace" target="_blank">sr-users@lists.kamailio.org</a>

<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" style="font-family:monospace" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>

</pre>
                          </blockquote>
                        </div>
                        <div>
                          <blockquote type="cite"><br>
                            <br>
                          </blockquote>
                          <br>
                          <br>
                          <pre cols="72" style="font-family:monospace">-- 

Daniel-Constantin Mierla -- <a href="http://www.asipto.com" style="font-family:monospace" target="_blank">www.asipto.com</a>

<a href="http://www.twitter.com/miconda" style="font-family:monospace" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" style="font-family:monospace" target="_blank">www.linkedin.com/in/miconda</a>

Funding: <a href="https://www.paypal.me/dcmierla" style="font-family:monospace" target="_blank">https://www.paypal.me/dcmierla</a></pre>
                          <br>
                          <br>
                        </div>
                        <br>
                        <br>
                        <br>
                        <br>
                      </blockquote>
                    </div>
                  </div>
                </blockquote>
              </div>
            </blockquote>
            <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" target="_blank">https://www.paypal.me/dcmierla</a></pre>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" target="_blank">https://www.paypal.me/dcmierla</a></pre>
  </div>

</blockquote></div>