Pre-Submission Checklist

Type Of Change

Checklist:

Description

When the presence module attempts to clean up records in the presentity table, it replaces the etag with a static, hardcoded string:

 "*#-OFFLINE-#*" 

However, the presentity table enforces a uniqueness constraint on the following combination of fields:

MariaDB [kamailio]> show create table presentity;
| presentity | CREATE TABLE `presentity` (
...
  UNIQUE KEY `presentity_idx` (`username`,`domain`,`event`,`etag`),

This approach breaks the uniqueness of etag, which is intended to differentiate records , especially in cases such as parallel calls, or when using kamailio as a forking proxy.

Instead of overwriting the etag with the static offline marker, this patch appends the marker to the existing etag value. This ensures the offline flag is retained while preserving the uniqueness of the etag.

The deletion query was also updated accordingly: it now identifies offline records using a LIKE '%#-OFFLINE-#' clause.

Based on testing, the duplicate key errors no longer occur, and the cleanup logic now behaves as expected. This patch improves the reliability of presentity cleanup without requiring schema or index changes.

Please consider merging into master.

Thanks!


You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/4275

Commit Summary

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/pull/4275@github.com>