[sr-dev] git:master:d19b32f7: pv: exported kemi functions to set root xavp values

Daniel-Constantin Mierla miconda at gmail.com
Fri Jun 7 09:15:33 CEST 2019


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-06-07T09:14:43+02:00

pv: exported kemi functions to set root xavp values

---

Modified: src/modules/pv/pv.c

---

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

---

diff --git a/src/modules/pv/pv.c b/src/modules/pv/pv.c
index 8af4af59e9..42ef30676b 100644
--- a/src/modules/pv/pv.c
+++ b/src/modules/pv/pv.c
@@ -899,6 +899,40 @@ static int w_xavp_params_implode(sip_msg_t *msg, char *pxname, char *pvname)
 	return ki_xavp_params_implode(msg, &sxname, (str*)pvname);
 }
 
+/**
+ *
+ */
+static int ki_xavp_seti(sip_msg_t *msg, str *rname, int ival)
+{
+	sr_xavp_t *xavp = NULL;
+	sr_xval_t xval;
+
+	memset(&xval, 0, sizeof(sr_xval_t));
+	xval.type = SR_XTYPE_INT;
+	xval.v.i = ival;
+
+	xavp = xavp_add_value(rname, &xval, NULL);
+
+	return (xavp!=NULL)?1:-1;
+}
+
+/**
+ *
+ */
+static int ki_xavp_sets(sip_msg_t *msg, str *rname, str *sval)
+{
+	sr_xavp_t *xavp = NULL;
+	sr_xval_t xval;
+
+	memset(&xval, 0, sizeof(sr_xval_t));
+	xval.type = SR_XTYPE_STR;
+	xval.v.s = *sval;
+
+	xavp = xavp_add_value(rname, &xval, NULL);
+
+	return (xavp!=NULL)?1:-1;
+}
+
 /**
  *
  */
@@ -1634,6 +1668,16 @@ static sr_kemi_t sr_kemi_pvx_exports[] = {
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
 	},
+	{ str_init("pvx"), str_init("xavp_seti"),
+		SR_KEMIP_INT, ki_xavp_seti,
+		{ SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
+	{ str_init("pvx"), str_init("xavp_sets"),
+		SR_KEMIP_INT, ki_xavp_sets,
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+	},
 	{ str_init("pvx"), str_init("xavp_get"),
 		SR_KEMIP_XVAL, ki_xavp_get,
 		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,




More information about the sr-dev mailing list