summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2014-12-05 04:03:06 +0000
committerLiong Sauw Ming <ming@teluu.com>2014-12-05 04:03:06 +0000
commit91ce3c4bf51a884f7534551669e38d6b44a2da55 (patch)
tree80f530908227549ce2bb1c67348c1c3fc7c7f002 /pjsip
parent092e35cdb39fd12d16e5db27d53947f4d85f95c5 (diff)
Fixed #1805: Make UAS as refresher in session timer when UAC doesn't support it (thanks to Glenn Walbran for the patch)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4967 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/src/pjsip-ua/sip_timer.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/pjsip/src/pjsip-ua/sip_timer.c b/pjsip/src/pjsip-ua/sip_timer.c
index c1831587..9417325f 100644
--- a/pjsip/src/pjsip-ua/sip_timer.c
+++ b/pjsip/src/pjsip-ua/sip_timer.c
@@ -1088,10 +1088,29 @@ PJ_DEF(pj_status_t) pjsip_timer_process_req(pjsip_inv_session *inv,
/* Update refresher role */
inv->timer->refresher = as_refresher? TR_UAS : TR_UAC;
} else {
- /* If UAC support timer (currently check the existance of
- * Session-Expires header in the request), set UAC as refresher.
+ /* If UAC supports timer and Session-Expires header is present
+ * in the request, set UAC as refresher.
+ * If UAC doesn't support timer and a proxy inserts a
+ * Session-Expires header, then UAS has to be the
+ * refresher (according to RFC 4028 Section 9).
*/
- inv->timer->refresher = se_hdr? TR_UAC : TR_UAS;
+ pj_bool_t uac_supports_timer = PJ_FALSE;
+ pjsip_supported_hdr *sup_hdr;
+
+ sup_hdr = (pjsip_supported_hdr*)
+ pjsip_msg_find_hdr(msg, PJSIP_H_SUPPORTED, NULL);
+ if (sup_hdr) {
+ unsigned i;
+
+ for (i = 0; i < sup_hdr->count; i++) {
+ if (pj_stricmp(&sup_hdr->values[i], &STR_TIMER) == 0) {
+ uac_supports_timer = PJ_TRUE;
+ break;
+ }
+ }
+ }
+ inv->timer->refresher = (uac_supports_timer && se_hdr)? TR_UAC:
+ TR_UAS;
}
}