Module: sip-router
Branch: master
Commit: b0e122d17a0b7964066b83edf5c1f2b1c3256d45
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b0e122d…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: Mon Mar 26 18:33:54 2012 +0300
modules_k/pv: added pseudo var $dic (diversion header counter)
---
modules_k/pv/pv.c | 3 +++
modules_k/pv/pv_core.c | 11 +++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/modules_k/pv/pv.c b/modules_k/pv/pv.c
index d907fe5..93955a1 100644
--- a/modules_k/pv/pv.c
+++ b/modules_k/pv/pv.c
@@ -153,6 +153,9 @@ static pv_export_t mod_pvs[] = {
{{"dip", (sizeof("dis")-1)}, /* */
PVT_OTHER, pv_get_diversion, 0,
0, 0, pv_init_iname, 3},
+ {{"dic", (sizeof("dic")-1)}, /* */
+ PVT_OTHER, pv_get_diversion, 0,
+ 0, 0, pv_init_iname, 4},
{{"dp", (sizeof("dp")-1)}, /* */
PVT_OTHER, pv_get_dsturi_attr, 0,
0, 0, pv_init_iname, 2},
diff --git a/modules_k/pv/pv_core.c b/modules_k/pv/pv_core.c
index bb11dbd..fb76583 100644
--- a/modules_k/pv/pv_core.c
+++ b/modules_k/pv/pv_core.c
@@ -734,6 +734,17 @@ int pv_get_diversion(struct sip_msg *msg, pv_param_t *param,
}
}
+ if(param->pvn.u.isname.name.n == 4) { /* counter param */
+ name.s = "counter";
+ name.len = 7;
+ val = get_diversion_param(msg, &name);
+ if (val) {
+ return pv_get_strval(msg, param, res, val);
+ } else {
+ return pv_get_null(msg, param, res);
+ }
+ }
+
LM_ERR("unknown diversion specifier\n");
return pv_get_null(msg, param, res);
}