Module: kamailio
Branch: master
Commit: 86f4943b61eb4672d6b18caead75724d8ad78504
URL:
https://github.com/kamailio/kamailio/commit/86f4943b61eb4672d6b18caead75724…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: GitHub <noreply(a)github.com>
Date: 2020-06-16T10:32:58+02:00
Merge pull request #2358 from kamailio/dmq_usrloc-usrloc_delete
dmq_usrloc: add new parameter `usrloc_delete` to disable synchronizing delete actions
---
Modified: src/modules/dmq_usrloc/dmq_usrloc.c
Modified: src/modules/dmq_usrloc/doc/dmq_usrloc.xml
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/86f4943b61eb4672d6b18caead75724…
Patch:
https://github.com/kamailio/kamailio/commit/86f4943b61eb4672d6b18caead75724…
---
diff --git a/src/modules/dmq_usrloc/dmq_usrloc.c b/src/modules/dmq_usrloc/dmq_usrloc.c
index 62d8ba75d3..b7fbed9406 100644
--- a/src/modules/dmq_usrloc/dmq_usrloc.c
+++ b/src/modules/dmq_usrloc/dmq_usrloc.c
@@ -42,6 +42,7 @@ int _dmq_usrloc_batch_msg_contacts = 1;
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;
usrloc_api_t dmq_ul;
@@ -56,6 +57,7 @@ static param_export_t params[] = {
{"batch_size", INT_PARAM, &_dmq_usrloc_batch_size},
{"batch_usleep", INT_PARAM, &_dmq_usrloc_batch_usleep},
{"usrloc_domain", PARAM_STR, &_dmq_usrloc_domain},
+ {"usrloc_delete", INT_PARAM, &_dmq_usrloc_delete},
{0, 0, 0}
};
diff --git a/src/modules/dmq_usrloc/doc/dmq_usrloc.xml
b/src/modules/dmq_usrloc/doc/dmq_usrloc.xml
index 8391296cf8..61e594b40b 100644
--- a/src/modules/dmq_usrloc/doc/dmq_usrloc.xml
+++ b/src/modules/dmq_usrloc/doc/dmq_usrloc.xml
@@ -55,6 +55,22 @@
<copyright>
<year>2017</year>
</copyright>
+ <authorgroup>
+ <editor>
+ <firstname>Emmanuel</firstname>
+ <surname>Schmidbauer</surname>
+ <affiliation><orgname>TextNow Inc.</orgname></affiliation>
+ <email>emmanuel.schmidbauer(a)textnow.com</email>
+ <address>
+ <otheraddr>
+ <ulink></ulink>
+ </otheraddr>
+ </address>
+ </editor>
+ </authorgroup>
+ <copyright>
+ <year>2020</year>
+ </copyright>
</bookinfo>
<toc></toc>
diff --git a/src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml
b/src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml
index 52620f2b13..2bd0756c85 100644
--- a/src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml
+++ b/src/modules/dmq_usrloc/doc/dmq_usrloc_admin.xml
@@ -282,7 +282,25 @@ modparam("dmq_usrloc", "replicate_socket_info",
0)
</programlisting>
</example>
</section>
+ <section id="usrloc_dmq.p.usrloc_delete">
+ <title><varname>usrloc_delete</varname> (int)</title>
+ <para>
+ Enable (1) or disable (0) synchronizing usrloc delete actions. Disabling delete
actions can be useful when user location data is ephemeral.
+ </para>
+ <para>
+ <emphasis>
+ Default value is 1.
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>usrloc_domain</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("dmq_usrloc", "usrloc_delete", 0)
+...
+</programlisting>
+ </example>
+ </section>
</section>
</chapter>
-
diff --git a/src/modules/dmq_usrloc/usrloc_sync.c b/src/modules/dmq_usrloc/usrloc_sync.c
index 2c5b93292d..d52ddd4932 100644
--- a/src/modules/dmq_usrloc/usrloc_sync.c
+++ b/src/modules/dmq_usrloc/usrloc_sync.c
@@ -58,6 +58,7 @@ extern int _dmq_usrloc_batch_msg_size;
extern int _dmq_usrloc_batch_size;
extern int _dmq_usrloc_batch_usleep;
extern str _dmq_usrloc_domain;
+extern int _dmq_usrloc_delete;
static int add_contact(str aor, ucontact_info_t* ci)
{
@@ -815,7 +816,9 @@ void dmq_ul_cb_contact(ucontact_t* ptr, int type, void* param)
usrloc_dmq_send_contact(ptr, aor, DMQ_UPDATE, 0);
break;
case UL_CONTACT_DELETE:
- usrloc_dmq_send_contact(ptr, aor, DMQ_RM, 0);
+ if (_dmq_usrloc_delete >= 1) {
+ usrloc_dmq_send_contact(ptr, aor, DMQ_RM, 0);
+ }
break;
case UL_CONTACT_EXPIRE:
//usrloc_dmq_send_contact(ptr, aor, DMQ_UPDATE);