Module: kamailio
Branch: 5.0
Commit: 0725f750e1981be8e2058ce1a48e90eb7862e8bd
URL:
https://github.com/kamailio/kamailio/commit/0725f750e1981be8e2058ce1a48e90e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-11-10T09:35:53+01:00
dialog: set the end time stamp immediately after going into deleted state
- checks to see if time stamps are set when testing if dialogs lasted
too long in intermediary states
(cherry picked from commit 74825c896dacd3f39948395cebfcf7b6e0730b51)
---
Modified: src/modules/dialog/dlg_handlers.c
Modified: src/modules/dialog/dlg_hash.c
---
Diff:
https://github.com/kamailio/kamailio/commit/0725f750e1981be8e2058ce1a48e90e…
Patch:
https://github.com/kamailio/kamailio/commit/0725f750e1981be8e2058ce1a48e90e…
---
diff --git a/src/modules/dialog/dlg_handlers.c b/src/modules/dialog/dlg_handlers.c
index 886219543c..d5d8fbb5d5 100644
--- a/src/modules/dialog/dlg_handlers.c
+++ b/src/modules/dialog/dlg_handlers.c
@@ -453,6 +453,10 @@ static void dlg_onreply(struct cell* t, int type, struct tmcb_params
*param)
event = DLG_EVENT_RPL3xx;
next_state_dlg( dlg, event, &old_state, &new_state, &unref);
+ if(new_state==DLG_STATE_DELETED && old_state!=DLG_STATE_DELETED) {
+ /* set end time */
+ dlg->end_ts = (unsigned int)(time(0));
+ }
if(dlg_run_event_route(dlg, (rpl==FAKED_REPLY)?NULL:rpl, old_state,
new_state)<0) {
/* dialog is gone */
@@ -527,11 +531,6 @@ static void dlg_onreply(struct cell* t, int type, struct tmcb_params
*param)
goto done;
}
- if(new_state==DLG_STATE_DELETED && old_state!=DLG_STATE_DELETED) {
- /* set end time */
- dlg->end_ts = (unsigned int)(time(0));
- }
-
if ( new_state==DLG_STATE_DELETED
&& (old_state==DLG_STATE_UNCONFIRMED
|| old_state==DLG_STATE_EARLY) ) {
diff --git a/src/modules/dialog/dlg_hash.c b/src/modules/dialog/dlg_hash.c
index 8c5c7a6acb..73947263e7 100644
--- a/src/modules/dialog/dlg_hash.c
+++ b/src/modules/dialog/dlg_hash.c
@@ -229,21 +229,24 @@ int dlg_clean_run(ticks_t ti)
while (dlg) {
tdlg = dlg;
dlg = dlg->next;
- if(tdlg->state==DLG_STATE_UNCONFIRMED && tdlg->init_ts<tm-300) {
+ if(tdlg->state==DLG_STATE_UNCONFIRMED && tdlg->init_ts>0
+ && tdlg->init_ts<tm-300) {
/* dialog in early state older than 5min */
LM_NOTICE("dialog in early state is too old (%p ref %d)\n",
tdlg, tdlg->ref);
unlink_unsafe_dlg(&d_table->entries[i], tdlg);
destroy_dlg(tdlg);
}
- if(tdlg->state==DLG_STATE_CONFIRMED_NA && tdlg->start_ts<tm-60) {
+ if(tdlg->state==DLG_STATE_CONFIRMED_NA && tdlg->start_ts>0
+ && tdlg->start_ts<tm-60) {
if(update_dlg_timer(&tdlg->tl, 10)<0) {
LM_ERR("failed to update dialog lifetime in long non-ack state\n");
}
tdlg->lifetime = 10;
tdlg->dflags |= DLG_FLAG_CHANGED;
}
- if(tdlg->state==DLG_STATE_DELETED && tdlg->end_ts<tm-300) {
+ if(tdlg->state==DLG_STATE_DELETED && tdlg->end_ts>0
+ && tdlg->end_ts<tm-300) {
/* dialog in deleted state older than 5min */
LM_NOTICE("dialog in delete state is too old (%p ref %d)\n",
tdlg, tdlg->ref);