Module: kamailio
Branch: master
Commit: bc41d0bc75f1b41f0185eeed37d5514525ef27be
URL:
https://github.com/kamailio/kamailio/commit/bc41d0bc75f1b41f0185eeed37d5514…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-09-11T16:41:55+02:00
dialog: update active and early dialogs stats for dmq operations
- related to GH #1591
---
Modified: src/modules/dialog/dlg_dmq.c
---
Diff:
https://github.com/kamailio/kamailio/commit/bc41d0bc75f1b41f0185eeed37d5514…
Patch:
https://github.com/kamailio/kamailio/commit/bc41d0bc75f1b41f0185eeed37d5514…
---
diff --git a/src/modules/dialog/dlg_dmq.c b/src/modules/dialog/dlg_dmq.c
index 0cfd8a522e..08dbc84686 100644
--- a/src/modules/dialog/dlg_dmq.c
+++ b/src/modules/dialog/dlg_dmq.c
@@ -38,6 +38,7 @@ dmq_resp_cback_t dlg_dmq_resp_callback = {&dlg_dmq_resp_callback_f,
0};
int dmq_send_all_dlgs(dmq_node_t* dmq_node);
int dlg_dmq_request_sync();
+extern int dlg_enable_stats;
/**
* @brief add notification peer
@@ -113,6 +114,7 @@ int dlg_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp,
dmq_node_t* no
unsigned int init_ts = 0, start_ts = 0, lifetime = 0;
unsigned int state = 1;
srjson_t *vj;
+ int newdlg = 0;
/* received dmq message */
LM_DBG("dmq message received\n");
@@ -246,6 +248,7 @@ int dlg_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp,
dmq_node_t* no
/* prevent DB sync */
dlg->dflags &= ~(DLG_FLAG_NEW|DLG_FLAG_CHANGED);
dlg->iflags |= DLG_IFLAG_DMQ_SYNC;
+ newdlg = 1;
} else {
/* remove existing profiles */
if (dlg->profile_links!=NULL) {
@@ -341,6 +344,13 @@ int dlg_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp,
dmq_node_t* no
dlg_unref(dlg, unref);
goto error;
}
+ if(newdlg==1) {
+ if (state==DLG_STATE_CONFIRMED_NA || state==DLG_STATE_CONFIRMED) {
+ if_update_stat(dlg_enable_stats, active_dlgs, 1);
+ } else if (dlg->state==DLG_STATE_EARLY) {
+ if_update_stat(dlg_enable_stats, early_dlgs, 1);
+ }
+ }
dlg->state = state;
break;
@@ -363,6 +373,11 @@ int dlg_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp,
dmq_node_t* no
dlg, dlg->h_entry, dlg->h_id);
}
}
+ if (state==DLG_STATE_CONFIRMED_NA || state==DLG_STATE_CONFIRMED) {
+ if_update_stat(dlg_enable_stats, active_dlgs, -1);
+ } else if (dlg->state==DLG_STATE_EARLY) {
+ if_update_stat(dlg_enable_stats, early_dlgs, -1);
+ }
/* prevent DB sync */
dlg->dflags |= DLG_FLAG_NEW;
dlg->iflags &= ~DLG_IFLAG_DMQ_SYNC;