Module: sip-router Branch: master Commit: 3ed5fe7f8e82b4d8792c3b468f9b426afc1d853e URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3ed5fe7f...
Author: Timo Reimann timo.reimann@1und1.de Committer: Timo Reimann timo.reimann@1und1.de Date: Thu Jun 24 18:39:49 2010 +0200
modules_k/dialog: Fix timer reset and improve timeout value logging
- Fix a bug that caused dialog timeout values to be refreshed only when a custom timeout was provided by the user via AVP. - Do not log failure to get timeout from AVP when in fact no AVP was used. - Add missing newline character.
---
modules_k/dialog/dlg_handlers.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/modules_k/dialog/dlg_handlers.c b/modules_k/dialog/dlg_handlers.c index 3b671ab..5fd3d31 100644 --- a/modules_k/dialog/dlg_handlers.c +++ b/modules_k/dialog/dlg_handlers.c @@ -469,11 +469,13 @@ inline static int get_dlg_timeout(struct sip_msg *req) { pv_value_t pv_val;
- if( timeout_avp && pv_get_spec_value( req, timeout_avp, &pv_val)==0 - && pv_val.flags&PV_VAL_INT && pv_val.ri>0 ) { - return pv_val.ri; + if( timeout_avp ) { + if ( pv_get_spec_value( req, timeout_avp, &pv_val)==0 && + pv_val.flags&PV_VAL_INT && pv_val.ri>0 ) { + return pv_val.ri; + } + LM_DBG("invalid AVP value, using default timeout\n"); } - LM_DBG("invalid AVP value, use default timeout"); return default_timeout; }
@@ -923,11 +925,11 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) && new_state==DLG_STATE_CONFIRMED) { LM_DBG("sequential request successfully processed\n"); timeout = get_dlg_timeout(req); - /* update timer during sequential request? */ if (timeout!=default_timeout) { dlg->lifetime = timeout; - if (update_dlg_timer( &dlg->tl, dlg->lifetime )==-1) - LM_ERR("failed to update dialog lifetime\n"); + } + if (update_dlg_timer( &dlg->tl, dlg->lifetime )==-1) { + LM_ERR("failed to update dialog lifetime\n"); } if (update_cseqs(dlg, req, dir)!=0) { LM_ERR("cseqs update failed\n");