Module: kamailio Branch: master Commit: bd62a2fcd24eb038156c7d80c66e8d8c14e4e6a3 URL: https://github.com/kamailio/kamailio/commit/bd62a2fcd24eb038156c7d80c66e8d8c...
Author: Viktor Litvinov viktor.litvinov@net2phone.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2025-02-21T08:52:22+01:00
dmq: added remove_inactive parameter
---
Modified: src/modules/dmq/dmq.c Modified: src/modules/dmq/dmq.h Modified: src/modules/dmq/doc/dmq_admin.xml Modified: src/modules/dmq/notification_peer.c
---
Diff: https://github.com/kamailio/kamailio/commit/bd62a2fcd24eb038156c7d80c66e8d8c... Patch: https://github.com/kamailio/kamailio/commit/bd62a2fcd24eb038156c7d80c66e8d8c...
---
diff --git a/src/modules/dmq/dmq.c b/src/modules/dmq/dmq.c index 7c430ac0f53..5fc5f84c500 100644 --- a/src/modules/dmq/dmq.c +++ b/src/modules/dmq/dmq.c @@ -68,6 +68,7 @@ str dmq_notification_channel = str_init("notification_peer"); int dmq_multi_notify = 0; static sip_uri_t dmq_notification_uri = {0}; int dmq_ping_interval = 60; +int dmq_remove_inactive = 1;
/* TM bind */ struct tm_binds _dmq_tmb = {0}; @@ -125,6 +126,7 @@ static param_export_t params[] = { {"notification_channel", PARAM_STR, &dmq_notification_channel}, {"multi_notify", PARAM_INT, &dmq_multi_notify}, {"worker_usleep", PARAM_INT, &dmq_worker_usleep}, + {"remove_inactive", PARAM_INT, &dmq_remove_inactive}, {0, 0, 0} };
diff --git a/src/modules/dmq/dmq.h b/src/modules/dmq/dmq.h index 6ebce766d40..cca70bc3266 100644 --- a/src/modules/dmq/dmq.h +++ b/src/modules/dmq/dmq.h @@ -50,6 +50,7 @@ extern str dmq_server_socket; extern sip_uri_t dmq_server_uri; extern str_list_t *dmq_notification_address_list; extern int dmq_multi_notify; +extern int dmq_remove_inactive; /* sl and tm */ extern struct tm_binds _dmq_tmb; extern sl_api_t _dmq_slb; diff --git a/src/modules/dmq/doc/dmq_admin.xml b/src/modules/dmq/doc/dmq_admin.xml index dade156af06..b75b43e8490 100644 --- a/src/modules/dmq/doc/dmq_admin.xml +++ b/src/modules/dmq/doc/dmq_admin.xml @@ -297,6 +297,26 @@ modparam("dmq", "ping_interval", 90) </programlisting> </example> </section> + <section id="dmq.p.remove_inactive"> + <title><varname>remove_inactive</varname>(int)</title> + <para> + A value of zero disable removing dmq nodes. Node status will be changed to pending. + A non-zero value (default is 1) enable removing nodes. + For node that is defined as notification address status will be changed to pending. + Otherwise it will be marked as disabled and then will be removed. + </para> + <para> + <emphasis>Default value is <quote>1</quote>.</emphasis> + </para> + <example> + <title>Set <varname>remove_inactive</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("dmq", "remove_inactive", 0) +... +</programlisting> + </example> + </section> </section>
<section> diff --git a/src/modules/dmq/notification_peer.c b/src/modules/dmq/notification_peer.c index 0b8a41b3b91..7a88209a7b4 100644 --- a/src/modules/dmq/notification_peer.c +++ b/src/modules/dmq/notification_peer.c @@ -628,6 +628,11 @@ int notification_resp_callback_f( run_init_callbacks(); } } else if(code == 408) { + if(!dmq_remove_inactive) { + /* put the node in pending state */ + update_dmq_node_status(dmq_node_list, node, DMQ_NODE_PENDING); + return 0; + } /* TODO this probably do not work for dmq_multi_notify */ slp = dmq_notification_address_list; while(slp != NULL) {