Module: kamailio
Branch: master
Commit: 2945ba448c6365728b49c10ba98824be357f85b3
URL:
https://github.com/kamailio/kamailio/commit/2945ba448c6365728b49c10ba98824b…
Author: lazedo <luis.azedo(a)factorlusitano.com>
Committer: lazedo <luis.azedo(a)factorlusitano.com>
Date: 2019-10-31T16:12:31Z
dispatcher: add state to mode in ds_list_exists
adds Bit 3 to allow the check of active/inactive entries in ds_list
---
Modified: src/modules/dispatcher/dispatch.c
Modified: src/modules/dispatcher/dispatch.h
Modified: src/modules/dispatcher/doc/dispatcher_admin.xml
---
Diff:
https://github.com/kamailio/kamailio/commit/2945ba448c6365728b49c10ba98824b…
Patch:
https://github.com/kamailio/kamailio/commit/2945ba448c6365728b49c10ba98824b…
---
diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index 18b713ce02..75b3b56f3a 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -2998,7 +2998,9 @@ int ds_is_addr_from_set(sip_msg_t *_m, struct ip_addr *pipaddr,
&& ((mode & DS_MATCH_NOPORT) || node->dlist[j].port == 0
|| tport == node->dlist[j].port)
&& ((mode & DS_MATCH_NOPROTO)
- || tproto == node->dlist[j].proto)) {
+ || tproto == node->dlist[j].proto)
+ && (((mode & DS_MATCH_ACTIVE) &&
!ds_skip_dst(node->dlist[j].flags))
+ || !(mode & DS_MATCH_ACTIVE))) {
if(export_set_pv && ds_setid_pvname.s != 0) {
memset(&val, 0, sizeof(pv_value_t));
val.flags = PV_VAL_INT | PV_TYPE_INT;
diff --git a/src/modules/dispatcher/dispatch.h b/src/modules/dispatcher/dispatch.h
index 3a6a5aedc6..e4a54944aa 100644
--- a/src/modules/dispatcher/dispatch.h
+++ b/src/modules/dispatcher/dispatch.h
@@ -57,6 +57,7 @@
#define DS_MATCH_ALL 0
#define DS_MATCH_NOPORT 1
#define DS_MATCH_NOPROTO 2
+#define DS_MATCH_ACTIVE 4
#define DS_SETOP_DSTURI 0
#define DS_SETOP_RURI 1
diff --git a/src/modules/dispatcher/doc/dispatcher_admin.xml
b/src/modules/dispatcher/doc/dispatcher_admin.xml
index 11881bbed5..94e7062705 100644
--- a/src/modules/dispatcher/doc/dispatcher_admin.xml
+++ b/src/modules/dispatcher/doc/dispatcher_admin.xml
@@ -1569,8 +1569,10 @@ if(ds_list_exists("10")) {
<listitem>
<para><emphasis>mode</emphasis> - (optional) - a bitmask to specify
how the matching should be done. If is 0, all ip, port and
- proto are matched. If bit one is set, then port is ignored.
- If bit two is set, then protocol is ignored. The parameter
+ proto are matched and active status is ignored.
+ If bit one is set, then port is ignored.
+ If bit two is set, then protocol is ignored.
+ If bit three is set, then state must be active. The parameter
can be an integer or a variable holding an integer value.
It must be provided if the uri parameter is provided.
</para>