From bc1cb4726da012879955428d1f7016d9502dda41 Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Wed, 3 Apr 2019 17:56:14 +0200 Subject: [PATCH] TT#56483 pv_headers add support for int rvalue * rvalue in $x_hdr and other pseudovariables can now be also an integer. it is internally converted into a string. * fix a typo with SIP_URI_T type check Change-Id: I682eae1f436f67fbfe3dd90c4785a82957ac362c --- .../patches/sipwise/add_pv_headers_module.patch | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/debian/patches/sipwise/add_pv_headers_module.patch b/debian/patches/sipwise/add_pv_headers_module.patch index 39f217014..f12ab4b81 100644 --- a/debian/patches/sipwise/add_pv_headers_module.patch +++ b/debian/patches/sipwise/add_pv_headers_module.patch @@ -481,7 +481,7 @@ + --- /dev/null +++ b/src/modules/pv_headers/pv_headers.c -@@ -0,0 +1,1810 @@ +@@ -0,0 +1,1819 @@ +/* + * pv_headers + * @@ -1869,7 +1869,11 @@ + if (pv_set_xavp(msg, &xavp_name, &hname, NULL, SR_XTYPE_STR, idx, 0) < 0) + goto err; + } -+ } else if (val->flags & PV_VAL_STR) { ++ } else if (val->flags & (PV_VAL_STR|PV_TYPE_INT|PV_VAL_INT)) { ++ if (val->flags & (PV_TYPE_INT|PV_VAL_INT)) { ++ if (pv_get_sintval(msg, param, val, val->ri) < 0) ++ goto err; ++ } + if (pv_parse_format(&val->rs, &pv_format) < 0) { + LM_ERR("cannot parse format: %.*s\n", val->rs.len, val->rs.s); + goto err; @@ -1899,7 +1903,7 @@ + if (pv_format) + pv_elem_free_all(pv_format); + } else { -+ LM_ERR("header %.*s value can be either string or null\n", hname.len, hname.s); ++ LM_ERR("x_hdr %.*s value can be either string, integer or null\n", hname.len, hname.s); + goto err; + } + return 1; @@ -2028,6 +2032,11 @@ + goto err; + } + ++ if (val->flags & (PV_TYPE_INT|PV_VAL_INT)) { ++ if (pv_get_sintval(msg, param, val, val->ri) < 0) ++ goto err; ++ } ++ + if (pv_parse_format(&val->rs, &pv_format) < 0) { + LM_ERR("cannot parse format: %.*s\n", val->rs.len, val->rs.s); + goto err; @@ -2116,7 +2125,7 @@ + memcpy(merged->s+os, " ", 1); os+=1; + } + memcpy(merged->s+os, "<", 1); os+=1; -+ if (!SET_URI_T) { ++ if (type != SET_URI_T) { + uri_type_to_str(puri.type, &uri_t); + t_len = uri_t.len+1; + memcpy(merged->s+os, uri_t.s, uri_t.len); os+=uri_t.len;