From 6805b3670f6a0ae4e833b7bcdd42786dc1440814 Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Fri, 9 Oct 2009 12:19:35 +0000 Subject: Ticket #954: Updated session timer to tolerate 'bad' SE (less than Min-SE specified in request) in 2xx response. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2933 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsip-ua/sip_timer.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'pjsip') diff --git a/pjsip/src/pjsip-ua/sip_timer.c b/pjsip/src/pjsip-ua/sip_timer.c index bc2b0293..51f40c11 100644 --- a/pjsip/src/pjsip-ua/sip_timer.c +++ b/pjsip/src/pjsip-ua/sip_timer.c @@ -791,11 +791,25 @@ PJ_DEF(pj_status_t) pjsip_timer_process_resp(pjsip_inv_session *inv, if (se_hdr && se_hdr->sess_expires < inv->timer->setting.min_se) { - if (st_code) - *st_code = PJSIP_SC_SESSION_TIMER_TOO_SMALL; - pjsip_timer_end_session(inv); - return PJSIP_ERRNO_FROM_SIP_STATUS( - PJSIP_SC_SESSION_TIMER_TOO_SMALL); + /* See ticket #954, instead of returning non-PJ_SUCCESS (which + * may cause disconnecting call/dialog), let's just accept the + * SE and update our local SE, as long as it isn't less than 90s. + */ + if (se_hdr->sess_expires >= ABS_MIN_SE) { + PJ_LOG(3, (inv->pool->obj_name, + "Peer responds with bad Session-Expires, %ds, " + "which is less than Min-SE specified in request, " + "%ds. Well, let's just accept and use it.", + se_hdr->sess_expires, inv->timer->setting.min_se)); + + inv->timer->setting.sess_expires = se_hdr->sess_expires; + } + + //if (st_code) + // *st_code = PJSIP_SC_SESSION_TIMER_TOO_SMALL; + //pjsip_timer_end_session(inv); + //return PJSIP_ERRNO_FROM_SIP_STATUS( + // PJSIP_SC_SESSION_TIMER_TOO_SMALL); } /* Update SE. Session-Expires in response cannot be lower than Min-SE. -- cgit v1.2.3