Module: kamailio
Branch: master
Commit: 3f52de273c359b60d0504e24b60401b5d1db2403
URL:
https://github.com/kamailio/kamailio/commit/3f52de273c359b60d0504e24b60401b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-01-28T10:15:09+01:00
sipdump: kemi exports to get src/dst ip of the message
---
Modified: src/modules/sipdump/sipdump_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/3f52de273c359b60d0504e24b60401b…
Patch:
https://github.com/kamailio/kamailio/commit/3f52de273c359b60d0504e24b60401b…
---
diff --git a/src/modules/sipdump/sipdump_mod.c b/src/modules/sipdump/sipdump_mod.c
index 1b77d13508..d686dc897e 100644
--- a/src/modules/sipdump/sipdump_mod.c
+++ b/src/modules/sipdump/sipdump_mod.c
@@ -504,6 +504,38 @@ static sr_kemi_xval_t* ki_sipdump_get_tag(sip_msg_t *msg)
return &_ksr_kemi_sipdump_xval;
}
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_sipdump_get_src_ip(sip_msg_t *msg)
+{
+ memset(&_ksr_kemi_sipdump_xval, 0, sizeof(sr_kemi_xval_t));
+
+ if (sipdump_event_info==NULL) {
+ sr_kemi_xval_null(&_ksr_kemi_sipdump_xval, SR_KEMI_XVAL_NULL_EMPTY);
+ return &_ksr_kemi_sipdump_xval;
+ }
+ _ksr_kemi_sipdump_xval.vtype = SR_KEMIP_STR;
+ _ksr_kemi_sipdump_xval.v.s = sipdump_event_info->src_ip;
+ return &_ksr_kemi_sipdump_xval;
+}
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_sipdump_get_dst_ip(sip_msg_t *msg)
+{
+ memset(&_ksr_kemi_sipdump_xval, 0, sizeof(sr_kemi_xval_t));
+
+ if (sipdump_event_info==NULL) {
+ sr_kemi_xval_null(&_ksr_kemi_sipdump_xval, SR_KEMI_XVAL_NULL_EMPTY);
+ return &_ksr_kemi_sipdump_xval;
+ }
+ _ksr_kemi_sipdump_xval.vtype = SR_KEMIP_STR;
+ _ksr_kemi_sipdump_xval.v.s = sipdump_event_info->dst_ip;
+ return &_ksr_kemi_sipdump_xval;
+}
+
/**
*
*/
@@ -524,6 +556,16 @@ static sr_kemi_t sr_kemi_sipdump_exports[] = {
{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("sipdump"), str_init("get_src_ip"),
+ SR_KEMIP_XVAL, ki_sipdump_get_src_ip,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("sipdump"), str_init("get_dst_ip"),
+ SR_KEMIP_XVAL, ki_sipdump_get_dst_ip,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
};