Module: kamailio
Branch: master
Commit: 465516744241d1f82850bfb8be8a9a97c26b65bf
URL:
https://github.com/kamailio/kamailio/commit/465516744241d1f82850bfb8be8a9a9…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-04-19T18:17:32+02:00
corex: new function via_add_xavp_params(flags)
- control the flag for adding xavp fields to via params
---
Modified: src/modules/corex/corex_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/465516744241d1f82850bfb8be8a9a9…
Patch:
https://github.com/kamailio/kamailio/commit/465516744241d1f82850bfb8be8a9a9…
---
diff --git a/src/modules/corex/corex_mod.c b/src/modules/corex/corex_mod.c
index 2eb4ff2863..0d7ce35857 100644
--- a/src/modules/corex/corex_mod.c
+++ b/src/modules/corex/corex_mod.c
@@ -55,6 +55,7 @@ static int w_set_send_socket(sip_msg_t *msg, char *psock, char *p2);
static int w_set_recv_socket(sip_msg_t *msg, char *psock, char *p2);
static int w_set_source_address(sip_msg_t *msg, char *paddr, char *p2);
static int w_via_add_srvid(sip_msg_t *msg, char *pflags, char *p2);
+static int w_via_add_xavp_params(sip_msg_t *msg, char *pflags, char *p2);
static int fixup_file_op(void** param, int param_no);
@@ -114,6 +115,8 @@ static cmd_export_t cmds[]={
0, ANY_ROUTE },
{"via_add_srvid", (cmd_function)w_via_add_srvid, 1, fixup_igp_null,
0, ANY_ROUTE },
+ {"via_add_xavp_params", (cmd_function)w_via_add_xavp_params, 1,
fixup_igp_null,
+ 0, ANY_ROUTE },
{0, 0, 0, 0, 0, 0}
};
@@ -718,6 +721,34 @@ static int w_via_add_srvid(sip_msg_t *msg, char *pflags, char *s2)
return ki_via_add_srvid(msg, fval);
}
+/**
+ *
+ */
+static int ki_via_add_xavp_params(sip_msg_t *msg, int fval)
+{
+ if(msg==NULL)
+ return -1;
+ if(fval) {
+ msg->msg_flags |= FL_ADD_XAVP_VIA;
+ } else {
+ msg->msg_flags &= ~(FL_ADD_XAVP_VIA);
+ }
+ return 1;
+}
+
+/**
+ *
+ */
+static int w_via_add_xavp_params(sip_msg_t *msg, char *pflags, char *s2)
+{
+ int fval=0;
+ if(fixup_get_ivalue(msg, (gparam_t*)pflags, &fval)!=0) {
+ LM_ERR("no flag value\n");
+ return -1;
+ }
+ return ki_via_add_xavp_params(msg, fval);
+}
+
/**
*
*/
@@ -773,7 +804,11 @@ static sr_kemi_t sr_kemi_corex_exports[] = {
{ SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
-
+ { str_init("corex"), str_init("via_add_xavp_params"),
+ SR_KEMIP_INT, ki_via_add_xavp_params,
+ { SR_KEMIP_INT, 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 } }
};
/* clang-format on */