TT#91452 pv_headers: fix $x_hdr index

* previously we where not supporting pseudo-variables as index

Change-Id: If7d3dfd190b63f18750ff89fa2fbebc4be173396
mr7.5.6
Victor Seva 6 years ago
parent 953796223c
commit e25d51cf86

@ -1,13 +1,14 @@
From: Sipwise Development Team <support@sipwise.com>
Date: Mon, 18 Nov 2019 10:36:39 +0100
Subject: add_pv_headers_module
---
src/Makefile.groups | 2 +-
src/modules/pv_headers/Makefile | 12 +
src/modules/pv_headers/README | 488 ++++++++
src/modules/pv_headers/pv_headers.c | 2126 +++++++++++++++++++++++++++++++++++
src/modules/pv_headers/pv_headers.c | 2134 +++++++++++++++++++++++++++++++++++
src/modules/pv_headers/pv_headers.h | 30 +
5 files changed, 2657 insertions(+), 1 deletion(-)
5 files changed, 2665 insertions(+), 1 deletion(-)
create mode 100644 src/modules/pv_headers/Makefile
create mode 100644 src/modules/pv_headers/README
create mode 100644 src/modules/pv_headers/pv_headers.c
@ -540,10 +541,10 @@ index 0000000..30bd1da
+ $var(test) = $x_rr;
diff --git a/src/modules/pv_headers/pv_headers.c b/src/modules/pv_headers/pv_headers.c
new file mode 100644
index 0000000..f3c8a83
index 0000000..30a2909
--- /dev/null
+++ b/src/modules/pv_headers/pv_headers.c
@@ -0,0 +1,2126 @@
@@ -0,0 +1,2134 @@
+/*
+ * pv_headers
+ *
@ -1992,10 +1993,14 @@ index 0000000..f3c8a83
+ sr_xval_t *xval = NULL;
+ pv_value_t tv;
+ str hname = STR_NULL;
+ int idx = 0;
+ int idx, idxf;
+ int cnt = 0;
+
+ idx = param->pvi.u.ival;
+ /* get the index */
+ if(pv_get_spec_index(msg, param, &idx, &idxf) != 0) {
+ LM_ERR("invalid index\n");
+ return -1;
+ }
+
+ if (param->pvn.type == PV_NAME_PVAR)
+ {
@ -2021,7 +2026,7 @@ index 0000000..f3c8a83
+ cnt = xavp_count(&hname, &xavp);
+ idx = idx + cnt;
+ if (idx < 0)
+ pv_get_null(msg, param, res);
+ return pv_get_null(msg, param, res);
+ }
+
+ xval = pv_xavp_get_value(msg, &xavp_name, &hname, idx);
@ -2044,8 +2049,12 @@ index 0000000..f3c8a83
+ int cnt = 0;
+ int itype;
+
+ idx = param->pvi.u.ival;
+ itype = param->pvi.type;
+ /* get the index */
+ if(pv_get_spec_index(msg, param, &idx, &itype)!=0)
+ {
+ LM_ERR("invalid index\n");
+ return -1;
+ }
+
+ if (param->pvn.type == PV_NAME_PVAR)
+ {

Loading…
Cancel
Save