Module: kamailio Branch: master Commit: 2a1bd40c0264a600107c653e5803760d7173bdc2 URL: https://github.com/kamailio/kamailio/commit/2a1bd40c0264a600107c653e5803760d...
Author: Stefan Mititelu stefan.mititelu@net2phone.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2025-02-21T08:53:34+01:00
dmq_usrloc: add new modparam to sync UL_CONTACT_EXPIRE actions
---
Modified: src/modules/dmq_usrloc/dmq_usrloc.c Modified: src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml Modified: src/modules/dmq_usrloc/usrloc_sync.c
---
Diff: https://github.com/kamailio/kamailio/commit/2a1bd40c0264a600107c653e5803760d... Patch: https://github.com/kamailio/kamailio/commit/2a1bd40c0264a600107c653e5803760d...
---
diff --git a/src/modules/dmq_usrloc/dmq_usrloc.c b/src/modules/dmq_usrloc/dmq_usrloc.c index 98f3b222728..8c4544b1633 100644 --- a/src/modules/dmq_usrloc/dmq_usrloc.c +++ b/src/modules/dmq_usrloc/dmq_usrloc.c @@ -43,6 +43,7 @@ int _dmq_usrloc_batch_msg_size = 60000; int _dmq_usrloc_batch_usleep = 0; str _dmq_usrloc_domain = str_init("location"); int _dmq_usrloc_delete = 1; +int _dmq_usrloc_delete_expired = 0;
usrloc_api_t dmq_ul;
@@ -59,6 +60,7 @@ static param_export_t params[] = { {"batch_usleep", PARAM_INT, &_dmq_usrloc_batch_usleep}, {"usrloc_domain", PARAM_STR, &_dmq_usrloc_domain}, {"usrloc_delete", PARAM_INT, &_dmq_usrloc_delete}, + {"usrloc_delete_expired", PARAM_INT, &_dmq_usrloc_delete_expired}, {0, 0, 0} };
@@ -116,6 +118,7 @@ static int mod_init(void) LM_ERR("Error in dmq_usrloc_initialize()\n"); } } + return 0; }
diff --git a/src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml b/src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml index b94947e2c77..ff612b32eda 100644 --- a/src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml +++ b/src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml @@ -303,11 +303,30 @@ modparam("dmq_usrloc", "replicate_socket_info", 1) </emphasis> </para> <example> - <title>Set <varname>usrloc_domain</varname> parameter</title> + <title>Set <varname>usrloc_delete</varname> parameter</title> <programlisting format="linespecific"> ... modparam("dmq_usrloc", "usrloc_delete", 0) ... +</programlisting> + </example> + </section> + <section id="usrloc_dmq.p.usrloc_delete_expired"> + <title><varname>usrloc_delete_expired</varname> (int)</title> + <para> + Enable (1) or disable (0) synchronizing usrloc expire actions using delete actions. In other words, sync delete of (UL_CONTACT_EXPIRE) expired contacts. + </para> + <para> + <emphasis> + Default value is 0. + </emphasis> + </para> + <example> + <title>Set <varname>usrloc_delete_expired</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("dmq_usrloc", "usrloc_delete_expired", 1) +... </programlisting> </example> </section> diff --git a/src/modules/dmq_usrloc/usrloc_sync.c b/src/modules/dmq_usrloc/usrloc_sync.c index 00cf877e64b..73017c52877 100644 --- a/src/modules/dmq_usrloc/usrloc_sync.c +++ b/src/modules/dmq_usrloc/usrloc_sync.c @@ -66,6 +66,7 @@ extern int _dmq_usrloc_batch_size; extern int _dmq_usrloc_batch_usleep; extern str _dmq_usrloc_domain; extern int _dmq_usrloc_delete; +extern int _dmq_usrloc_delete_expired;
static int add_contact(str aor, ucontact_info_t *ci) { @@ -1043,7 +1044,9 @@ void dmq_ul_cb_contact(ucontact_t *ptr, int type, void *param) } break; case UL_CONTACT_EXPIRE: - //usrloc_dmq_send_contact(ptr, aor, DMQ_UPDATE); + if(_dmq_usrloc_delete_expired >= 1) { + usrloc_dmq_send_contact(ptr, aor, DMQ_RM, 0); + } LM_DBG("Contact <%.*s> expired\n", aor.len, aor.s); break; }