Module: kamailio
Branch: master
Commit: b0cd09d2b451005a736396e6f38eac139ec31301
URL:
https://github.com/kamailio/kamailio/commit/b0cd09d2b451005a736396e6f38eac1…
Author: Olle E. Johansson <oej(a)edvina.net>
Committer: Olle E. Johansson <oej(a)edvina.net>
Date: 2016-05-11T21:59:44+02:00
dialog Make sure statistics are updated when initializing from database
Issue #424
---
Modified: modules/dialog/dlg_db_handler.c
Modified: modules/dialog/dlg_handlers.c
Modified: modules/dialog/dlg_hash.c
Modified: modules/dialog/dlg_var.c
Modified: modules/dialog/dlg_var.h
---
Diff:
https://github.com/kamailio/kamailio/commit/b0cd09d2b451005a736396e6f38eac1…
Patch:
https://github.com/kamailio/kamailio/commit/b0cd09d2b451005a736396e6f38eac1…
---
diff --git a/modules/dialog/dlg_db_handler.c b/modules/dialog/dlg_db_handler.c
index e27f8b2..1933849 100644
--- a/modules/dialog/dlg_db_handler.c
+++ b/modules/dialog/dlg_db_handler.c
@@ -37,6 +37,7 @@
#include "../../lib/srdb1/db.h"
#include "../../str.h"
#include "../../socket_info.h"
+#include "../../lib/kcore/statistics.h"
#include "dlg_hash.h"
#include "dlg_var.h"
#include "dlg_profile.h"
@@ -377,8 +378,10 @@ static int load_dialog_info_from_db(int dlg_hash_size, int
fetch_num_rows)
if (dlg->state==DLG_STATE_CONFIRMED_NA ||
dlg->state==DLG_STATE_CONFIRMED) {
active_dlgs_cnt++;
+ if_update_stat(dlg_enable_stats, active_dlgs, 1);
} else if (dlg->state==DLG_STATE_EARLY) {
early_dlgs_cnt++;
+ if_update_stat(dlg_enable_stats, early_dlgs, 1);
}
dlg->tl.timeout = (unsigned int)(VAL_INT(values+9));
diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c
index 36a807f..c5c748e 100644
--- a/modules/dialog/dlg_handlers.c
+++ b/modules/dialog/dlg_handlers.c
@@ -70,11 +70,6 @@ int spiral_detected = -1;
extern struct rr_binds d_rrb; /*!< binding to record-routing module */
-/* statistic variables */
-extern stat_var *early_dlgs; /*!< number of early dialogs */
-extern stat_var *processed_dlgs; /*!< number of processed dialogs */
-extern stat_var *expired_dlgs; /*!< number of expired dialogs */
-extern stat_var *failed_dlgs; /*!< number of failed dialogs */
extern pv_elem_t *ruri_param_model; /*!< pv-string to get r-uri */
diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c
index 9a96f1b..1f0470e 100644
--- a/modules/dialog/dlg_hash.c
+++ b/modules/dialog/dlg_hash.c
@@ -35,6 +35,7 @@
#include "../../ut.h"
#include "../../hashes.h"
#include "../../lib/kmi/mi.h"
+#include "../../lib/kcore/statistics.h"
#include "dlg_timer.h"
#include "dlg_var.h"
#include "dlg_hash.h"
diff --git a/modules/dialog/dlg_var.c b/modules/dialog/dlg_var.c
index 8d76b8f..e89ee27 100644
--- a/modules/dialog/dlg_var.c
+++ b/modules/dialog/dlg_var.c
@@ -29,6 +29,7 @@
#include "../../route.h"
#include "../../script_cb.h"
#include "../../pvapi.h"
+#include "../../lib/kcore/statistics.h"
#include "dlg_var.h"
#include "dlg_hash.h"
diff --git a/modules/dialog/dlg_var.h b/modules/dialog/dlg_var.h
index 7d4c360..dbf7505 100644
--- a/modules/dialog/dlg_var.h
+++ b/modules/dialog/dlg_var.h
@@ -76,6 +76,13 @@ int set_dlg_variable_unsafe(dlg_cell_t *dlg, str *key, str *val);
extern dlg_ctx_t _dlg_ctx;
+/* statistic variables */
+extern stat_var *active_dlgs; /*!< number of active dialogs */
+extern stat_var *early_dlgs; /*!< number of early dialogs */
+extern stat_var *processed_dlgs; /*!< number of processed dialogs */
+extern stat_var *expired_dlgs; /*!< number of expired dialogs */
+extern stat_var *failed_dlgs; /*!< number of failed dialogs */
+
int pv_get_dlg_ctx(sip_msg_t *msg, pv_param_t *param,
pv_value_t *res);
int pv_set_dlg_ctx(sip_msg_t *msg, pv_param_t *param,