Skip to content

Commit

Permalink
dialog: new parameters - early_timeout and noack_timeout
Browse files Browse the repository at this point in the history
- early_timeout - set the interval in seconds after which the dialogs in
  early state (not answered yet) are destroyed. Default value is 300.
- noack_timeout - set the interval in seconds after which the dialogs
  that were answered with 200ok but didn't receive the ACK are marked
  for termination (lifetime set to 10 more seconds). Default value 60.
  • Loading branch information
miconda committed Jul 12, 2017
1 parent 34db0b1 commit 3c6b3ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/modules/dialog/dialog.c
Expand Up @@ -107,6 +107,8 @@ int dlg_wait_ack = 1;
static int dlg_timer_procs = 0;
static int _dlg_track_cseq_updates = 0;
int dlg_ka_failed_limit = 1;
int dlg_early_timeout = 300;
int dlg_noack_timeout = 60;

int dlg_enable_dmq = 0;

Expand Down Expand Up @@ -301,7 +303,9 @@ static param_export_t mod_params[]={
{ "db_skip_load", INT_PARAM, &db_skip_load },
{ "ka_failed_limit", INT_PARAM, &dlg_ka_failed_limit },
{ "enable_dmq", INT_PARAM, &dlg_enable_dmq },
{"event_callback", PARAM_STR, &dlg_event_callback },
{ "event_callback", PARAM_STR, &dlg_event_callback },
{ "early_timeout", PARAM_INT, &dlg_early_timeout },
{ "noack_timeout", PARAM_INT, &dlg_noack_timeout },
{ 0,0,0 }
};

Expand Down
9 changes: 7 additions & 2 deletions src/modules/dialog/dlg_hash.c
Expand Up @@ -48,6 +48,9 @@ extern int dlg_ka_interval;

extern int dlg_enable_dmq;

extern int dlg_early_timeout;
extern int dlg_noack_timeout;

/*! global dialog table */
struct dlg_table *d_table = 0;

Expand Down Expand Up @@ -229,14 +232,16 @@ 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<tm-dlg_early_timeout) {
/* 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<tm-dlg_noack_timeout) {
if(update_dlg_timer(&tdlg->tl, 10)<0) {
LM_ERR("failed to update dialog lifetime in long non-ack state\n");
}
Expand Down

0 comments on commit 3c6b3ec

Please sign in to comment.