Module: kamailio
Branch: 5.4
Commit: 3c8d3df471c92068144f84f2f02b9e79c8c723d2
URL:
https://github.com/kamailio/kamailio/commit/3c8d3df471c92068144f84f2f02b9e7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-12-01T09:44:43+01:00
dlgs: fix counting dialogs function
- count the dialog in initial state
- GH #2568
(cherry picked from commit 6376e24960878ca510ab6f1ce0594a351debc409)
---
Modified: src/modules/dlgs/dlgs_mod.c
Modified: src/modules/dlgs/dlgs_records.c
---
Diff:
https://github.com/kamailio/kamailio/commit/3c8d3df471c92068144f84f2f02b9e7…
Patch:
https://github.com/kamailio/kamailio/commit/3c8d3df471c92068144f84f2f02b9e7…
---
diff --git a/src/modules/dlgs/dlgs_mod.c b/src/modules/dlgs/dlgs_mod.c
index e26e0d9899..c7f60fcab8 100644
--- a/src/modules/dlgs/dlgs_mod.c
+++ b/src/modules/dlgs/dlgs_mod.c
@@ -250,13 +250,16 @@ static int w_dlgs_update(sip_msg_t *msg, char *p1, char *p2)
*/
static int ki_dlgs_count(sip_msg_t *msg, str *vfield, str *vop, str *vdata)
{
+ int ret;
+
LM_DBG("counting by: [%.*s] [%.*s] [%.*s]\n", vfield->len, vfield->s,
vop->len, vop->s, vdata->len, vdata->s);
- if(dlgs_count(msg, vfield, vop, vdata) < 0) {
- return -1;
+ ret = dlgs_count(msg, vfield, vop, vdata);
+ if(ret <= 0) {
+ return (ret-1);
}
- return 1;
+ return ret;
}
/**
diff --git a/src/modules/dlgs/dlgs_records.c b/src/modules/dlgs/dlgs_records.c
index 6b4a6b70e8..1f6af22ba3 100644
--- a/src/modules/dlgs/dlgs_records.c
+++ b/src/modules/dlgs/dlgs_records.c
@@ -340,6 +340,7 @@ int dlgs_add_item(sip_msg_t *msg, str *src, str *dst, str *data)
prev->next = nitem;
}
dsht->slots[idx].esize++;
+ dlgs_update_stats(&dsht->slots[idx].astats, nitem->state, 1);
lock_release(&dsht->slots[idx].lock);
return 0;
}