From be3d9ad616a6da6cd49375da02a3bc0433bd0975 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Fri, 11 Dec 2020 16:57:42 +0100 Subject: [PATCH] TT#81500 cfgt: skip $_s and avp id 0 We are getting error: > [core/usr_avp.c:424]: search_avp(): 0 ID or NULL NAME AVP! Change-Id: I066b5da7afaf635a44f27344f9881284100a1858 --- debian/patches/series | 1 + debian/patches/sipwise/cfgt-skip.patch | 46 ++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 debian/patches/sipwise/cfgt-skip.patch diff --git a/debian/patches/series b/debian/patches/series index 1c3ca8171..b74ceb6e8 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -48,6 +48,7 @@ sipwise/pua_dialoginfo-local_identity_dlg_var.patch sipwise/pua_dialoginfo-use-lock-when-use_puburi_avps-is-set.patch sipwise/dialplan-don-t-stop-loading-rules-on-error.patch sipwise/cfgt-skip-tm-vars-T_.patch +sipwise/cfgt-skip.patch sipwise/rtpengine-codec-set-except.patch sipwise/topos-don-t-insert-contact-header-for-4xx-replies.patch sipwise/0001-sl-Fix-3xx-stats-RPC-marshalling.patch diff --git a/debian/patches/sipwise/cfgt-skip.patch b/debian/patches/sipwise/cfgt-skip.patch new file mode 100644 index 000000000..c2cd80f21 --- /dev/null +++ b/debian/patches/sipwise/cfgt-skip.patch @@ -0,0 +1,46 @@ +From: Victor Seva +Date: Fri, 11 Dec 2020 16:56:18 +0100 +Subject: cfgt: skip $_s and $avp with id 0 + +--- + src/modules/cfgt/cfgt_json.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/src/modules/cfgt/cfgt_json.c b/src/modules/cfgt/cfgt_json.c +index 8089c02..04aa032 100644 +--- a/src/modules/cfgt/cfgt_json.c ++++ b/src/modules/cfgt/cfgt_json.c +@@ -43,6 +43,10 @@ int _cfgt_get_array_avp_vals(struct sip_msg *msg, pv_param_t *param, + LM_ERR("invalid name\n"); + return -1; + } ++ if(name_type == 0 && avp_name.n == 0) { ++ LM_DBG("skip name_type:%d avp_name:%d\n", name_type, avp_name.n); ++ return 0; ++ } + *jobj = srjson_CreateArray(jdoc); + if(*jobj == NULL) { + LM_ERR("cannot create json object\n"); +@@ -286,8 +290,8 @@ int cfgt_get_json(struct sip_msg *msg, unsigned int mask, srjson_doc_t *jdoc, + el = el->next; + continue; + } +- if(srjson_GetArraySize(jdoc, jobj) == 0 +- && !(mask & CFGT_DP_NULL)) { ++ if(jobj == NULL || (srjson_GetArraySize(jdoc, jobj) == 0 ++ && !(mask & CFGT_DP_NULL))) { + el = el->next; + continue; + } +@@ -319,6 +323,11 @@ int cfgt_get_json(struct sip_msg *msg, unsigned int mask, srjson_doc_t *jdoc, + el = el->next; + continue; + } ++ if(el->pvname.len > 3 && strncmp("$_s", el->pvname.s, 3) == 0) { ++ LM_DBG("skip dynamic format [%.*s]\n", el->pvname.len, el->pvname.s); ++ el = el->next; ++ continue; ++ } + if(pv_get_spec_value(msg, &el->spec, &value) != 0) { + LM_WARN("can't get value[%.*s]\n", el->pvname.len, + el->pvname.s);