Module: kamailio
Branch: master
Commit: 412b6ddc26d9648363dc7a9288aec72c352322d3
URL:
https://github.com/kamailio/kamailio/commit/412b6ddc26d9648363dc7a9288aec72…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-08-01T11:08:38+02:00
kemix: exported KSR.kx.get_method() - return sip method string
---
Modified: src/modules/kemix/kemix_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/412b6ddc26d9648363dc7a9288aec72…
Patch:
https://github.com/kamailio/kamailio/commit/412b6ddc26d9648363dc7a9288aec72…
---
diff --git a/src/modules/kemix/kemix_mod.c b/src/modules/kemix/kemix_mod.c
index a3702e0043..a31588eb70 100644
--- a/src/modules/kemix/kemix_mod.c
+++ b/src/modules/kemix/kemix_mod.c
@@ -556,6 +556,34 @@ static sr_kemi_xval_t* ki_kx_gete_au(sip_msg_t *msg)
return ki_kx_get_auth_attr(msg, 1, SR_KEMI_XVAL_NULL_EMPTY);
}
+/**
+ *
+ */
+static sr_kemi_xval_t* ki_kx_get_method(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_NONE);
+ return &_sr_kemi_kx_xval;
+ }
+
+ _sr_kemi_kx_xval.vtype = SR_KEMIP_STR;
+ if(msg->first_line.type == SIP_REQUEST) {
+ _sr_kemi_kx_xval.v.s = msg->first_line.u.request.method;
+ return &_sr_kemi_kx_xval;
+ }
+
+ if(msg->cseq==NULL && ((parse_headers(msg, HDR_CSEQ_F, 0)==-1) ||
+ (msg->cseq==NULL))) {
+ LM_ERR("no CSEQ header\n");
+ sr_kemi_xval_null(&_sr_kemi_kx_xval, SR_KEMI_XVAL_NULL_NONE);
+ return &_sr_kemi_kx_xval;
+ }
+
+ _sr_kemi_kx_xval.v.s = get_cseq(msg)->method;
+ return &_sr_kemi_kx_xval;
+}
+
/**
*
*/
@@ -701,6 +729,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_method"),
+ SR_KEMIP_XVAL, ki_kx_get_method,
+ { 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 } }
};