Hi Daniel, thanks for the suggestion, I will try to use the internal flags to store it. Please found attached the previous patch without reformatting.
Regards, Federico Cabiddu On Mon, Jan 6, 2014 at 1:46 PM, Daniel-Constantin Mierla <mico...@gmail.com>wrote: > Hello, > > since it is about 0|1 state, it can be probably stored as a bit over the > dialog internal flags, which is iflags column. > > Also, for the patch, do it without reformatting a lot of code, because it > is not easy to track the real chances and review it. If there is lot to > reformat, do a separate patch before or after the one that adds new > features. > > Cheers, > Daniel > > > On 06/01/14 13:31, Federico Cabiddu wrote: > > Hi, > we are using the dialog module to limit the duration of users' calls. > We recently discovered (well, it's stated in the module doc) that each > subsequent in-dialog request resets the dialog timeout. I can understand > that this behavior can be useful in some cases, but in our is causing the > call duration limitation to not work. I prepared a simple patch to > introduce a new parameter to make this behavior configurable (per module). > I would like to have it configurable per dialog, via means of an AVP, but > this would have implications on the dialog save/restore mechanism and on > the db schema, so for the moment I left it simple. > > Regards, > > Federico Cabiddu > > > _______________________________________________ > sr-dev mailing > listsr-...@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev > > > -- > Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda > - http://www.linkedin.com/in/miconda > > > _______________________________________________ > sr-dev mailing list > sr-dev@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev > >
From d54bb7f473efe38dc60190974927ac5740cd58d2 Mon Sep 17 00:00:00 2001 From: Federico Cabiddu <federico.cabi...@gmail.com> Date: Mon, 6 Jan 2014 13:15:39 +0100 Subject: [PATCH] modules/dialog: added parameter to enable/disable dialog timeout reset --- modules/dialog/dialog.c | 49 ++++++++++++++++++++++++------------------- modules/dialog/dlg_handlers.c | 13 ++++++------ 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/modules/dialog/dialog.c b/modules/dialog/dialog.c index 8d7be33..78ac922 100644 --- a/modules/dialog/dialog.c +++ b/modules/dialog/dialog.c @@ -123,6 +123,7 @@ int active_dlgs_cnt = 0; int early_dlgs_cnt = 0; int detect_spirals = 1; int dlg_send_bye = 0; +int reset_timeout = 1; stat_var *active_dlgs = 0; stat_var *processed_dlgs = 0; stat_var *expired_dlgs = 0; @@ -281,6 +282,7 @@ static param_export_t mod_params[]={ { "xavp_cfg", STR_PARAM, &dlg_xavp_cfg.s }, { "ka_timer", INT_PARAM, &dlg_ka_timer }, { "ka_interval", INT_PARAM, &dlg_ka_interval }, + { "reset_timeout", INT_PARAM, &reset_timeout, }, { 0,0,0 } }; @@ -577,6 +579,11 @@ static int mod_init(void) return -1; } + if (reset_timeout != 0 && reset_timeout != 1) { + LM_ERR("invalid value %d for reset_timeout param!!\n",reset_timeout); + return -1; + } + /* if statistics are disabled, prevent their registration to core */ if (dlg_enable_stats==0) exports.stats = 0; diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index 9393d7f..e608a5b 100644 --- a/modules/dialog/dlg_handlers.c +++ b/modules/dialog/dlg_handlers.c @@ -79,9 +79,10 @@ static str rr_param; /*!< record-route parameter for matching */ static int dlg_flag; /*!< flag for dialog tracking */ static pv_spec_t *timeout_avp; /*!< AVP for timeout setting */ static int default_timeout; /*!< default dialog timeout */ static int seq_match_mode; /*!< dlg_match mode */ static int shutdown_done = 0; /*!< 1 when destroy_dlg_handlers was called */ extern int detect_spirals; +extern int reset_timeout; /*!< reset dialog timeout for each in-dialog message */ extern int initial_cbs_inscript; extern int dlg_send_bye; extern int dlg_event_rt[DLG_EVENTRT_MAX]; @@ -1258,7 +1259,7 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) if (timeout!=default_timeout) { dlg->lifetime = timeout; } - if (new_state!=DLG_STATE_EARLY) { + if ((new_state!=DLG_STATE_EARLY) && (old_state!=DLG_STATE_CONFIRMED || reset_timeout)) { if (update_dlg_timer( &dlg->tl, dlg->lifetime )==-1) { LM_ERR("failed to update dialog lifetime\n"); } else { -- 1.8.3.2
_______________________________________________ sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev