Module: kamailio
Branch: master
Commit: 64adc989bd4655b395554023be2aa863f144d81e
URL:
https://github.com/kamailio/kamailio/commit/64adc989bd4655b395554023be2aa86…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-05-31T09:30:12+02:00
kemi: exported function to get msg type
---
Modified: src/modules/kemix/kemix_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/64adc989bd4655b395554023be2aa86…
Patch:
https://github.com/kamailio/kamailio/commit/64adc989bd4655b395554023be2aa86…
---
diff --git a/src/modules/kemix/kemix_mod.c b/src/modules/kemix/kemix_mod.c
index f94ff951d4..fdedda04be 100644
--- a/src/modules/kemix/kemix_mod.c
+++ b/src/modules/kemix/kemix_mod.c
@@ -872,6 +872,25 @@ static int ki_kx_get_msglen(sip_msg_t *msg)
return msg->len;
}
+/**
+ *
+ */
+static int ki_kx_get_msgtype(sip_msg_t *msg)
+{
+ if(msg==NULL) {
+ return -1;
+ }
+
+ if(msg->first_line.type == SIP_REQUEST) {
+ return 1;
+ } else if(msg->first_line.type == SIP_REPLY) {
+ return 2;
+ }
+
+ return 0;
+}
+
+
/**
*
*/
@@ -1122,6 +1141,11 @@ 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_msgtype"),
+ SR_KEMIP_INT, ki_kx_get_msgtype,
+ { 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 } }