Module: kamailio Branch: master Commit: 0e284b0632f5c1ca9d82b87e0b158e2858d1de5d URL: https://github.com/kamailio/kamailio/commit/0e284b0632f5c1ca9d82b87e0b158e2858d1de5d
Author: Matteo Brancaleoni <matteo.brancale...@voismart.it> Committer: Henning Westerholt <h...@gilawa.com> Date: 2025-08-11T20:07:50+02:00 pua_reginfo: use expires from contact for publish rq --- Modified: src/modules/pua_reginfo/usrloc_cb.c --- Diff: https://github.com/kamailio/kamailio/commit/0e284b0632f5c1ca9d82b87e0b158e2858d1de5d.diff Patch: https://github.com/kamailio/kamailio/commit/0e284b0632f5c1ca9d82b87e0b158e2858d1de5d.patch --- diff --git a/src/modules/pua_reginfo/usrloc_cb.c b/src/modules/pua_reginfo/usrloc_cb.c index 8bc5a7884bd..dff68b626e4 100644 --- a/src/modules/pua_reginfo/usrloc_cb.c +++ b/src/modules/pua_reginfo/usrloc_cb.c @@ -257,6 +257,33 @@ str *build_reginfo_full(urecord_t *record, str uri, ucontact_t *c, int type) return NULL; } +int reginfo_get_expires(urecord_t *record) +{ + // Loop through all record contacts and set the publish Expire value + // to the max expire of the contacts + ucontact_t *ptr; + time_t cur_time = time(0); + int expires = -1; + int tmp_expires; + + ptr = record->contacts; + while(ptr) { + if(VALID_CONTACT(ptr, cur_time)) { + tmp_expires = (int)(ptr->expires - cur_time); + if(tmp_expires > expires) { + expires = tmp_expires; + } + } + ptr = ptr->next; + } + if(expires < 0) { + /* if we cannot calc expire from reg contacts, just use this default */ + expires = 3600; + } + + return expires; +} + void reginfo_usrloc_cb(ucontact_t *c, int type, void *param) { str *body = NULL; @@ -371,7 +398,7 @@ void reginfo_usrloc_cb(ucontact_t *c, int type, void *param) publ.id.s = id_buf; publ.id.len = id_buf_len; publ.content_type = content_type; - publ.expires = 3600; + publ.expires = reginfo_get_expires(record); /* make UPDATE_TYPE, as if this "publish dialog" is not found by pua it will fallback to INSERT_TYPE anyway */ _______________________________________________ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!