Hello,

this is the result of the timer-based approach of the involved modules. If you 
want a faster expire, reduce the timer interval of the usrloc module for 
example. The same applies for the keepalive pings.
Just a note, a delay of 1-2 for an expire minutes might be a good trade-off for 
a better performance in larger environments.

Cheers,

Henning

-----Original Message-----
From: xf han via sr-users <[email protected]> 
Sent: Thursday, May 21, 2026 5:20 AM
To: [email protected]
Cc: xf han <[email protected]>
Subject: [SR-Users] Re: Predictable nat keepalive OPTIONS from server

Hello everyone,

Following up on this thread, I have been testing the `usrloc` keepalive feature 
to detect zombie registrations. However, I noticed that it seems to take a 
relatively long time to actually detect and remove the dead contacts.

Here is the setup and the test I performed:

**Kamailio version:** v6.1.2

**Module parameters:**
```text
modparam("nathelper", "natping_interval", 0)

modparam("usrloc", "timer_interval", 30)
modparam("usrloc", "timer_procs", 2)
modparam("usrloc", "use_domain", 0)
modparam("usrloc", "db_url", DBURL)
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "ka_mode", 4) # udp only
modparam("usrloc", "ka_timeout", 40)
modparam("usrloc", "ka_interval", 30)
modparam("usrloc", "ka_randomize", 5)
modparam("usrloc", "ka_loglevel", 2)
modparam("usrloc", "ka_logmsg", " to-uri: [$tu] remote-addr: [$sas]")
modparam("usrloc", "ka_method", "OPTIONS")
```

**Test Timeline:**
* **21:57:27** - Received `REGISTER` message from MicroSIP.
* **21:58:25** - Sent keepalive `OPTIONS` to the registered contact.
* *(At this point, I killed the MicroSIP process to simulate a zombie 
registration)*
* **21:59:09** - Log shows: `DEBUG: usrloc [ul_keepalive.c:126]: 
ul_ka_urecord(): keepalive for aor: 1001`
* **21:59:09** - Log shows: `DEBUG: usrloc [ul_keepalive.c:157]: 
ul_ka_urecord(): set expired contact on keepalive (1779332305 + 40 < 
1779332349) - aor: 1001 c: sip:[email protected]:61876;ob`
* **22:00:01** - Log shows: `DEBUG: usrloc [urecord.c:393]: wb_timer(): Binding 
'1001','sip:[email protected]:61876;ob' has expired`

As seen above, there is quite a delay from the moment the endpoint dies to the 
moment `wb_timer()` finally expires the binding. 

Is there anything wrong with my current approach or configuration? Are there 
any recommended ways to further optimize this and speed up the detection and 
removal of zombie registrations?

Thanks in advance for any insights!

Best regards,
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- 
[email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- 
[email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to