[sr-dev] git:master:b81e049f: corex: new function via_use_xavp_fields(mode)

Daniel-Constantin Mierla miconda at gmail.com
Thu Oct 4 16:52:41 CEST 2018


Module: kamailio
Branch: master
Commit: b81e049f568c162d03c4d146a16f9d6c20898905
URL: https://github.com/kamailio/kamailio/commit/b81e049f568c162d03c4d146a16f9d6c20898905

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-10-04T16:47:52+02:00

corex: new function via_use_xavp_fields(mode)

- set/unset the flag for building local Via using fields from
via_xavp_fields xavp

---

Modified: src/modules/corex/corex_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/b81e049f568c162d03c4d146a16f9d6c20898905.diff
Patch: https://github.com/kamailio/kamailio/commit/b81e049f568c162d03c4d146a16f9d6c20898905.patch

---

diff --git a/src/modules/corex/corex_mod.c b/src/modules/corex/corex_mod.c
index 431d25ad16..a6a01e9af1 100644
--- a/src/modules/corex/corex_mod.c
+++ b/src/modules/corex/corex_mod.c
@@ -58,6 +58,7 @@ 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 w_via_use_xavp_fields(sip_msg_t *msg, char *pflags, char *p2);
 
 static int fixup_file_op(void** param, int param_no);
 
@@ -121,6 +122,8 @@ static cmd_export_t cmds[]={
 		0, ANY_ROUTE },
 	{"via_add_xavp_params", (cmd_function)w_via_add_xavp_params, 1, fixup_igp_null,
 		0, ANY_ROUTE },
+	{"via_use_xavp_fields", (cmd_function)w_via_use_xavp_fields, 1, fixup_igp_null,
+		0, ANY_ROUTE },
 
 	{0, 0, 0, 0, 0, 0}
 };
@@ -795,6 +798,35 @@ static int w_via_add_xavp_params(sip_msg_t *msg, char *pflags, char *s2)
 	return ki_via_add_xavp_params(msg, fval);
 }
 
+/**
+ *
+ */
+static int ki_via_use_xavp_fields(sip_msg_t *msg, int fval)
+{
+	if(msg==NULL)
+		return -1;
+	if(fval) {
+		msg->msg_flags |= FL_USE_XAVP_VIA_FIELDS;
+	} else {
+		msg->msg_flags &= ~(FL_USE_XAVP_VIA_FIELDS);
+	}
+	return 1;
+}
+
+/**
+ *
+ */
+static int w_via_use_xavp_fields(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_use_xavp_fields(msg, fval);
+}
+
+
 /**
  *
  */
@@ -900,6 +932,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_use_xavp_fields"),
+		SR_KEMIP_INT, ki_via_use_xavp_fields,
+		{ SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
 	{ str_init("corex"), str_init("has_ruri_user"),
 		SR_KEMIP_INT, ki_has_ruri_user,
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,




More information about the sr-dev mailing list