[sr-dev] git:master:1e3f4664: kemix: exported functions to get dst-uri variants

Daniel-Constantin Mierla miconda at gmail.com
Tue Jan 28 14:36:01 CET 2020


Module: kamailio
Branch: master
Commit: 1e3f4664c3b568f310235c093218bf12cb7a52b4
URL: https://github.com/kamailio/kamailio/commit/1e3f4664c3b568f310235c093218bf12cb7a52b4

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-01-28T14:35:13+01:00

kemix: exported functions to get dst-uri variants

---

Modified: src/modules/kemix/kemix_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/1e3f4664c3b568f310235c093218bf12cb7a52b4.diff
Patch: https://github.com/kamailio/kamailio/commit/1e3f4664c3b568f310235c093218bf12cb7a52b4.patch

---

diff --git a/src/modules/kemix/kemix_mod.c b/src/modules/kemix/kemix_mod.c
index 91ad99dea9..7c87b7c68b 100644
--- a/src/modules/kemix/kemix_mod.c
+++ b/src/modules/kemix/kemix_mod.c
@@ -670,6 +670,46 @@ static sr_kemi_xval_t* ki_kx_getw_body(sip_msg_t *msg)
 	return ki_kx_get_body_mode(msg, SR_KEMI_XVAL_NULL_PRINT);
 }
 
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_get_duri_mode(sip_msg_t *msg, int xmode)
+{
+	memset(&_sr_kemi_kx_xval, 0, sizeof(sr_kemi_xval_t));
+	if(msg->dst_uri.s==NULL || msg->dst_uri.len<=0) {
+		sr_kemi_xval_null(&_sr_kemi_kx_xval, xmode);
+		return &_sr_kemi_kx_xval;
+	}
+
+	_sr_kemi_kx_xval.vtype = SR_KEMIP_STR;
+	_sr_kemi_kx_xval.v.s = msg->dst_uri;
+	return &_sr_kemi_kx_xval;
+}
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_get_duri(sip_msg_t *msg)
+{
+	return ki_kx_get_duri_mode(msg, SR_KEMI_XVAL_NULL_NONE);
+}
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_getw_duri(sip_msg_t *msg)
+{
+	return ki_kx_get_duri_mode(msg, SR_KEMI_XVAL_NULL_PRINT);
+}
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_gete_duri(sip_msg_t *msg)
+{
+	return ki_kx_get_duri_mode(msg, SR_KEMI_XVAL_NULL_EMPTY);
+}
+
 /**
  *
  */
@@ -755,6 +795,22 @@ static sr_kemi_t sr_kemi_kx_exports[] = {
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},
+	{ str_init("kx"), str_init("get_duri"),
+		SR_KEMIP_XVAL, ki_kx_get_duri,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("kx"), str_init("gete_duri"),
+		SR_KEMIP_XVAL, ki_kx_gete_duri,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("kx"), str_init("getw_duri"),
+		SR_KEMIP_XVAL, ki_kx_getw_duri,
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+
 	{ str_init("kx"), str_init("get_ua"),
 		SR_KEMIP_XVAL, ki_kx_get_ua,
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,




More information about the sr-dev mailing list