From 2a55b4b0b8e1c5271a23697a100347f7c7f798d0 Mon Sep 17 00:00:00 2001 From: Marco Capetta Date: Tue, 17 Sep 2024 17:45:16 +0200 Subject: [PATCH] MT#60830 ngcp-dlgcnt-clean fix parsing on json input text Remove from the existing string any comma or quote that could come from a json formatting. Change-Id: I1b22b5ce9cc2c17643558be60cea7bd785fbcf0a --- scripts/ngcp-dlgcnt-check | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/ngcp-dlgcnt-check b/scripts/ngcp-dlgcnt-check index 15f7246..620e145 100755 --- a/scripts/ngcp-dlgcnt-check +++ b/scripts/ngcp-dlgcnt-check @@ -50,13 +50,15 @@ while read -r i ; do if [[ "$i" == '[' || "$i" == ']' || "$i" == "Database is empty" ]]; then continue fi - if ! grep -q -- "$i" "$KAMAILIO_DIALOGS" + # remove from the existing string any comma or quote that could come from a json formatting + id=$(echo "$i" | tr -d ',\"') + if ! grep -q -- "$id" "$KAMAILIO_DIALOGS" then - printf "CallID:[%s] unknown\n" "$i" + printf "CallID:[%s] unknown\n" "$id" if $REMOVE ; then - ngcp-dlgcnt-clean "--" "$i" || true - if grep -q "list:$i" "$REDIS_CALLIDS" ; then - ngcp-dlglist-clean "--" "$i" || true + ngcp-dlgcnt-clean "--" "$id" || true + if grep -q "list:$id" "$REDIS_CALLIDS" ; then + ngcp-dlglist-clean "--" "$id" || true fi fi fi