Hi, When using RFC4028, client and server must agree on a timeout for the session. The client proposes a max value in Session-Expires header and the server answers with the value which suits it. In PJSIP, you can specify the min and max value with function pjsip_timer_init_session (). But when an INVITE is received, PJSIP takes the value found in Session-Expires header and does not take into account what was set with pjsip_timer_init_session(). I propose the attached patch but perhaps it could be simplified with something like: --- ./pjsip/src/pjsip-ua/sip_timer.c 2012-07-23 15:31:26.000000000 +0200 +++ /opt/mmx/sip.d/my_sip_timer.c 2014-06-06 11:00:30.000000000 +0200 @@ -961,16 +961,10 @@ * request (which means remote doesn't want/support it), but local insists * to use Session Timers. */ - if (se_hdr) { - /* Update SE as specified by peer. */ + if (se_hdr && inv->timer->setting.sess_expires > se_hdr->sess_expires) inv->timer->setting.sess_expires = se_hdr->sess_expires; - } else if (inv->timer->setting.sess_expires < min_se) { - /* There is no SE in the request (remote support Session Timers but - * doesn't want to use it, it just specify Min-SE) and local SE is - * lower than Min-SE specified by remote. - */ + else if (inv->timer->setting.sess_expires < min_se) inv->timer->setting.sess_expires = min_se; - } /* Set the refresher */ if (se_hdr && pj_stricmp(&se_hdr->refresher, &STR_UAC) == 0) Thanks Bernard -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20140606/77954924/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: sip_timer.patch Type: application/octet-stream Size: 792 bytes Desc: sip_timer.patch URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20140606/77954924/attachment.patch>