Module: kamailio
Branch: master
Commit: e9a19d5b4ebff9e06a061efdc5f2b91d4e1bf1b2
URL:
https://github.com/kamailio/kamailio/commit/e9a19d5b4ebff9e06a061efdc5f2b91…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-02-06T20:49:36+01:00
kemix: exported functions to get to-uri user and host
---
Modified: src/modules/kemix/kemix_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/e9a19d5b4ebff9e06a061efdc5f2b91…
Patch:
https://github.com/kamailio/kamailio/commit/e9a19d5b4ebff9e06a061efdc5f2b91…
---
diff --git a/src/modules/kemix/kemix_mod.c b/src/modules/kemix/kemix_mod.c
index b5b1047e0b..0409e56d21 100644
--- a/src/modules/kemix/kemix_mod.c
+++ b/src/modules/kemix/kemix_mod.c
@@ -341,6 +341,71 @@ static sr_kemi_xval_t* ki_kx_gete_fhost(sip_msg_t *msg)
return ki_kx_get_furi_attr(msg, 2, SR_KEMI_XVAL_NULL_EMPTY);
}
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_get_turi_attr(sip_msg_t *msg, int iattr, int xmode)
+{
+ sip_uri_t *uri;
+
+ memset(&_sr_kemi_kx_xval, 0, sizeof(sr_kemi_xval_t));
+ uri=parse_to_uri(msg);
+ if(uri==NULL) {
+ sr_kemi_xval_null(&_sr_kemi_kx_xval, xmode);
+ return &_sr_kemi_kx_xval;
+ }
+
+ return ki_kx_get_xuri_attr(msg, uri, iattr, xmode);
+}
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_get_tuser(sip_msg_t *msg)
+{
+ return ki_kx_get_turi_attr(msg, 1, SR_KEMI_XVAL_NULL_NONE);
+}
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_getw_tuser(sip_msg_t *msg)
+{
+ return ki_kx_get_turi_attr(msg, 1, SR_KEMI_XVAL_NULL_PRINT);
+}
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_gete_tuser(sip_msg_t *msg)
+{
+ return ki_kx_get_turi_attr(msg, 1, SR_KEMI_XVAL_NULL_EMPTY);
+}
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_get_thost(sip_msg_t *msg)
+{
+ return ki_kx_get_turi_attr(msg, 2, SR_KEMI_XVAL_NULL_NONE);
+}
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_getw_thost(sip_msg_t *msg)
+{
+ return ki_kx_get_turi_attr(msg, 2, SR_KEMI_XVAL_NULL_PRINT);
+}
+
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_gete_thost(sip_msg_t *msg)
+{
+ return ki_kx_get_turi_attr(msg, 2, SR_KEMI_XVAL_NULL_EMPTY);
+}
+
/**
*
*/
@@ -828,6 +893,36 @@ 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_tuser"),
+ SR_KEMIP_XVAL, ki_kx_get_tuser,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("kx"), str_init("gete_tuser"),
+ SR_KEMIP_XVAL, ki_kx_gete_tuser,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("kx"), str_init("getw_tuser"),
+ SR_KEMIP_XVAL, ki_kx_getw_tuser,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("kx"), str_init("get_thost"),
+ SR_KEMIP_XVAL, ki_kx_get_thost,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("kx"), str_init("gete_thost"),
+ SR_KEMIP_XVAL, ki_kx_gete_thost,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("kx"), str_init("getw_thost"),
+ SR_KEMIP_XVAL, ki_kx_getw_thost,
+ { 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,