TT#81500 cfgt: skip $_s and avp id 0

We are getting error:
> <core> [core/usr_avp.c:424]: search_avp(): 0 ID or NULL NAME AVP!

Change-Id: I066b5da7afaf635a44f27344f9881284100a1858
mr9.2
Victor Seva 5 years ago
parent 1c878136bf
commit be3d9ad616

@ -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/pua_dialoginfo-use-lock-when-use_puburi_avps-is-set.patch
sipwise/dialplan-don-t-stop-loading-rules-on-error.patch sipwise/dialplan-don-t-stop-loading-rules-on-error.patch
sipwise/cfgt-skip-tm-vars-T_.patch sipwise/cfgt-skip-tm-vars-T_.patch
sipwise/cfgt-skip.patch
sipwise/rtpengine-codec-set-except.patch sipwise/rtpengine-codec-set-except.patch
sipwise/topos-don-t-insert-contact-header-for-4xx-replies.patch sipwise/topos-don-t-insert-contact-header-for-4xx-replies.patch
sipwise/0001-sl-Fix-3xx-stats-RPC-marshalling.patch sipwise/0001-sl-Fix-3xx-stats-RPC-marshalling.patch

@ -0,0 +1,46 @@
From: Victor Seva <vseva@sipwise.com>
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);
Loading…
Cancel
Save