Module: kamailio
Branch: master
Commit: 74f1179390475354cb6fe5983dc7c40afd294be4
URL:
https://github.com/kamailio/kamailio/commit/74f1179390475354cb6fe5983dc7c40…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-05-29T10:40:44+02:00
kemix: functions to get msg buffer and length
---
Modified: src/modules/kemix/kemix_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/74f1179390475354cb6fe5983dc7c40…
Patch:
https://github.com/kamailio/kamailio/commit/74f1179390475354cb6fe5983dc7c40…
---
diff --git a/src/modules/kemix/kemix_mod.c b/src/modules/kemix/kemix_mod.c
index 81e433c9e3..f94ff951d4 100644
--- a/src/modules/kemix/kemix_mod.c
+++ b/src/modules/kemix/kemix_mod.c
@@ -843,6 +843,35 @@ static int ki_kx_get_conid(sip_msg_t *msg)
return conid;
}
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_get_msgbuf(sip_msg_t *msg)
+{
+ memset(&_sr_kemi_kx_xval, 0, sizeof(sr_kemi_xval_t));
+ if(msg==NULL) {
+ sr_kemi_xval_null(&_sr_kemi_kx_xval, SR_KEMI_XVAL_NULL_EMPTY);
+ return &_sr_kemi_kx_xval;
+ }
+
+ _sr_kemi_kx_xval.vtype = SR_KEMIP_STR;
+ _sr_kemi_kx_xval.v.s.s = msg->buf;
+ _sr_kemi_kx_xval.v.s.len = msg->len;
+ return &_sr_kemi_kx_xval;
+}
+
+/**
+ *
+ */
+static int ki_kx_get_msglen(sip_msg_t *msg)
+{
+ if(msg==NULL) {
+ return -1;
+ }
+
+ return msg->len;
+}
+
/**
*
*/
@@ -1083,6 +1112,17 @@ 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_msgbuf"),
+ SR_KEMIP_XVAL, ki_kx_get_msgbuf,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("kx"), str_init("get_msglen"),
+ SR_KEMIP_INT, ki_kx_get_msglen,
+ { 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 } }
};