From ac3f954d986116902c122bc7cb4735287d9ebb08 Mon Sep 17 00:00:00 2001 From: Alessio Garzi Date: Fri, 23 Jun 2023 16:23:42 +0200 Subject: [PATCH] MT#57706 New function del_pair in NGCPDlgCounters class New function del_pair() is a copy of del() but it does not delete call counters on db central. Useful if we want to clean pair db without changing db central. Change-Id: I936bbb99ce9d5698273d8f72e0f032358bd341cd (cherry picked from commit d9e55ae48c9fc86af88194dafebf9e236e24c14b) --- ngcp/dlgcnt.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ngcp/dlgcnt.lua b/ngcp/dlgcnt.lua index eabe957..f0629f5 100644 --- a/ngcp/dlgcnt.lua +++ b/ngcp/dlgcnt.lua @@ -182,6 +182,23 @@ end end end + function NGCPDlgCounters:del_pair(callid) + if not self.pair:test_connection() then + self.pair:connect() + end + local key = self.pair.client:lpop(callid); + if not key then + error(string.format("callid:%s list empty", callid)); + end + if not self.central:test_connection() then + self.central:connect() + end + while key do + KSR.dbg(string.format("pair:lpop[%s]=>[%s]\n", callid, key)); + key = self.pair.client:lpop(callid); + end + end + function NGCPDlgCounters:get(key) if not self.central:test_connection() then self.central:connect()