[asterisk-commits] mjordan: branch certified-11.2 r381445 - in /certified/branches/11.2: ./ chan...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 14 12:40:58 CST 2013


Author: mjordan
Date: Thu Feb 14 12:40:54 2013
New Revision: 381445

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381445
Log:
Process session timers, even if Session-Expires header is missing

Previously, Asterisk only processed session timer information if both the
'Supported: timer' and 'Session-Expires' headers were present. However, the
Session-Expires header is optional. If we were to receive a request with a
Min-SE greater than our configured session-expires, we would respond with a
'Session-Expires' header that was too small.

This patch cleans the situation up a bit, always processing timer information
if the 'Supported: timer' header is present.

(closes issue ASTERISK-20787)
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/2299/
........

Merged revisions 380696 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 380698 from http://svn.asterisk.org/svn/asterisk/branches/11

Modified:
    certified/branches/11.2/   (props changed)
    certified/branches/11.2/channels/chan_sip.c

Propchange: certified/branches/11.2/
------------------------------------------------------------------------------
--- branch-11-merged (original)
+++ branch-11-merged Thu Feb 14 12:40:54 2013
@@ -1,1 +1,1 @@
-/branches/11:378038,378287,378321,378409-378411,378582,378687,378690,378984,379513,379790,380465,380892,380894,381306
+/branches/11:378038,378287,378321,378409-378411,378582,378687,378690,378984,379513,379790,380465,380698,380892,380894,381306

Modified: certified/branches/11.2/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/certified/branches/11.2/channels/chan_sip.c?view=diff&rev=381445&r1=381444&r2=381445
==============================================================================
--- certified/branches/11.2/channels/chan_sip.c (original)
+++ certified/branches/11.2/channels/chan_sip.c Thu Feb 14 12:40:54 2013
@@ -25261,12 +25261,12 @@
 	parse_oli(req, p->owner);
 
 	/* Session-Timers */
-	if ((p->sipoptions & SIP_OPT_TIMER) && !ast_strlen_zero(sip_get_header(req, "Session-Expires"))) {
+	if ((p->sipoptions & SIP_OPT_TIMER)) {
 		enum st_refresher_param st_ref_param;
 
 		/* The UAC has requested session-timers for this session. Negotiate
 		the session refresh interval and who will be the refresher */
-		ast_debug(2, "Incoming INVITE with 'timer' option supported and \"Session-Expires\" header.\n");
+		ast_debug(2, "Incoming INVITE with 'timer' option supported\n");
 
 		/* Allocate Session-Timers struct w/in the dialog */
 		if (!p->stimer)
@@ -25274,21 +25274,25 @@
 
 		/* Parse the Session-Expires header */
 		p_uac_se_hdr = sip_get_header(req, "Session-Expires");
-		rtn = parse_session_expires(p_uac_se_hdr, &uac_max_se, &st_ref_param);
-		tmp_st_ref = (st_ref_param == SESSION_TIMER_REFRESHER_PARAM_UAC) ? SESSION_TIMER_REFRESHER_THEM : SESSION_TIMER_REFRESHER_US;
-		if (rtn != 0) {
-			transmit_response_reliable(p, "400 Session-Expires Invalid Syntax", req);
-			p->invitestate = INV_COMPLETED;
-			if (!p->lastinvite) {
-				sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
-			}
-			res = INV_REQ_ERROR;
-			goto request_invite_cleanup;
+		if (!ast_strlen_zero(p_uac_se_hdr)) {
+			ast_debug(2, "INVITE also has \"Session-Expires\" header.\n");
+			rtn = parse_session_expires(p_uac_se_hdr, &uac_max_se, &st_ref_param);
+			tmp_st_ref = (st_ref_param == SESSION_TIMER_REFRESHER_PARAM_UAC) ? SESSION_TIMER_REFRESHER_THEM : SESSION_TIMER_REFRESHER_US;
+			if (rtn != 0) {
+				transmit_response_reliable(p, "400 Session-Expires Invalid Syntax", req);
+				p->invitestate = INV_COMPLETED;
+				if (!p->lastinvite) {
+					sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
+				}
+				res = INV_REQ_ERROR;
+				goto request_invite_cleanup;
+			}
 		}
 
 		/* Parse the Min-SE header */
 		p_uac_min_se = sip_get_header(req, "Min-SE");
 		if (!ast_strlen_zero(p_uac_min_se)) {
+			ast_debug(2, "INVITE also has \"Min-SE\" header.\n");
 			rtn = parse_minse(p_uac_min_se, &uac_min_se);
 			if (rtn != 0) {
 				transmit_response_reliable(p, "400 Min-SE Invalid Syntax", req);
@@ -25328,6 +25332,9 @@
 				} else {
 					st_interval = uac_max_se;
 				}
+			} else if (uac_min_se > 0) {
+				int dlg_max_se = st_get_se(p, TRUE);
+				st_interval = MAX(dlg_max_se, uac_min_se);
 			} else {
 				/* Set to default max value */
 				st_interval = global_max_se;




More information about the asterisk-commits mailing list