Module: kamailio
Branch: master
Commit: 1632bb7ced8aab774cc3c77abba1246c1a848a5b
URL:
https://github.com/kamailio/kamailio/commit/1632bb7ced8aab774cc3c77abba1246…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-25T14:05:47+02:00
pv: xavp related functions exported to kemi framework
---
Modified: src/modules/pv/pv.c
Modified: src/modules/pv/pv_xavp.c
---
Diff:
https://github.com/kamailio/kamailio/commit/1632bb7ced8aab774cc3c77abba1246…
Patch:
https://github.com/kamailio/kamailio/commit/1632bb7ced8aab774cc3c77abba1246…
---
diff --git a/src/modules/pv/pv.c b/src/modules/pv/pv.c
index ad33d3b899..8dccdb3a0b 100644
--- a/src/modules/pv/pv.c
+++ b/src/modules/pv/pv.c
@@ -26,6 +26,7 @@
#include "../../core/pvar.h"
#include "../../core/lvalue.h"
#include "../../core/mod_fix.h"
+#include "../../core/xavp.h"
#include "../../core/kemi.h"
#include "../../core/rpc.h"
#include "../../core/rpc_lookup.h"
@@ -741,6 +742,11 @@ static int w_var_to_xavp(sip_msg_t *msg, char *s1, char *s2)
return pv_var_to_xavp(&varname, &xname);
}
+static int ki_var_to_xavp(sip_msg_t *msg, str *varname, str *xname)
+{
+ return pv_var_to_xavp(varname, xname);
+}
+
/**
* xavp to script variable
*/
@@ -756,6 +762,17 @@ static int w_xavp_to_var(sip_msg_t *msg, char *s1)
return pv_xavp_to_var(&xname);
}
+static int ki_xavp_to_var(sip_msg_t *msg, str *xname)
+{
+ return pv_xavp_to_var(xname);
+}
+
+static int ki_xavp_print(sip_msg_t* msg)
+{
+ xavp_print_list(NULL);
+ return 1;
+}
+
/**
*
*/
@@ -782,6 +799,17 @@ static int w_xavp_params_explode(sip_msg_t *msg, char *pparams, char
*pxname)
/**
*
*/
+static int ki_xavp_params_explode(sip_msg_t *msg, str *sparams, str *sxname)
+{
+ if(xavp_params_explode(sparams, sxname)<0)
+ return -1;
+
+ return 1;
+}
+
+/**
+ *
+ */
static int w_sbranch_set_ruri(sip_msg_t *msg, char p1, char *p2)
{
if(sbranch_set_ruri(msg)<0)
@@ -962,6 +990,26 @@ static sr_kemi_t sr_kemi_pvx_exports[] = {
{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("pvx"), str_init("pv_var_to_xavp"),
+ SR_KEMIP_INT, ki_var_to_xavp,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("pvx"), str_init("pv_xavp_to_var"),
+ SR_KEMIP_INT, ki_xavp_to_var,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("pvx"), str_init("pv_xavp_print"),
+ SR_KEMIP_INT, ki_xavp_print,
+ { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("pvx"), str_init("xavp_params_explode"),
+ SR_KEMIP_INT, ki_xavp_params_explode,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
};
@@ -979,4 +1027,4 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2)
return -1;
}
return register_trans_mod(path, mod_trans);
-}
+}
\ No newline at end of file
diff --git a/src/modules/pv/pv_xavp.c b/src/modules/pv/pv_xavp.c
index d556dda99f..c36a6c6f1f 100644
--- a/src/modules/pv/pv_xavp.c
+++ b/src/modules/pv/pv_xavp.c
@@ -555,7 +555,7 @@ int pv_parse_xavp_name(pv_spec_p sp, str *in)
return -1;
}
-int pv_xavp_print(struct sip_msg* msg, char* s1, char *s2)
+int pv_xavp_print(sip_msg_t* msg, char* s1, char *s2)
{
xavp_print_list(NULL);
return 1;