[svn-commits] dvossel: trunk r283560 - in /trunk: ./ channels/ channels/sip/include/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 25 10:56:09 CDT 2010


Author: dvossel
Date: Wed Aug 25 10:56:05 2010
New Revision: 283560

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=283560
Log:
Merged revisions 283559 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r283559 | dvossel | 2010-08-25 10:54:11 -0500 (Wed, 25 Aug 2010) | 16 lines
  
  Merged revisions 283558 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ........
    r283558 | dvossel | 2010-08-25 10:52:54 -0500 (Wed, 25 Aug 2010) | 10 lines
    
    Asterisk will not advertise session timers are supported when 'session-timers=refuse' is used.
    
    Asterisk now dynamically builds the "Supported" header depending
    on what is enabled/disabled in sip.conf.  Session timers used
    to always be advertised as being supported even when they were disabled
    in the configuration.  This caused problems with some end points.
    
    (issue #17005)
  ........
................

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c
    trunk/channels/sip/include/sip.h

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=283560&r1=283559&r2=283560
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Aug 25 10:56:05 2010
@@ -9014,6 +9014,20 @@
 	return found;
 }
 
+/*! \brief Add "Supported" header to sip message.  Since some options may
+ *  be disabled in the config, the sip_pvt must be inspected to determine what
+ *  is supported for this dialog. */
+static int add_supported_header(struct sip_pvt *pvt, struct sip_request *req)
+{
+	int res;
+	if (st_get_mode(pvt) != SESSION_TIMER_MODE_REFUSE) {
+		res = add_header(req, "Supported", "replaces, timer");
+	} else {
+		res = add_header(req, "Supported", "replaces");
+	}
+	return res;
+}
+
 /*! \brief Add header to SIP message */
 static int add_header(struct sip_request *req, const char *var, const char *value)
 {
@@ -9455,7 +9469,7 @@
 	if (!ast_strlen_zero(global_useragent))
 		add_header(resp, "Server", global_useragent);
 	add_header(resp, "Allow", ALLOWED_METHODS);
-	add_header(resp, "Supported", SUPPORTED_EXTENSIONS);
+	add_supported_header(p, resp);
 
 	/* If this is an invite, add Session-Timers related headers if the feature is active for this session */
 	if (p->method == SIP_INVITE && p->stimer && p->stimer->st_active == TRUE && p->stimer->st_active_peer_ua == TRUE) {
@@ -10935,7 +10949,7 @@
 	reqprep(&req, p, ast_test_flag(&p->flags[0], SIP_REINVITE_UPDATE) ?  SIP_UPDATE : SIP_INVITE, 0, 1);
 
 	add_header(&req, "Allow", ALLOWED_METHODS);
-	add_header(&req, "Supported", SUPPORTED_EXTENSIONS);
+	add_supported_header(p, &req);
 	if (sipdebug) {
 		if (oldsdp == TRUE)
 			add_header(&req, "X-asterisk-Info", "SIP re-invite (Session-Timers)");
@@ -11331,7 +11345,7 @@
 	}
 
 	add_header(&req, "Allow", ALLOWED_METHODS);
-	add_header(&req, "Supported", SUPPORTED_EXTENSIONS);
+	add_supported_header(p, &req);
 
 	if (p->options && p->options->addsipheaders && p->owner) {
 		struct ast_channel *chan = p->owner; /* The owner channel */
@@ -11886,7 +11900,7 @@
 	add_header(&req, "Subscription-state", terminate ? "terminated;reason=noresource" : "active");
 	add_header(&req, "Content-Type", "message/sipfrag;version=2.0");
 	add_header(&req, "Allow", ALLOWED_METHODS);
-	add_header(&req, "Supported", SUPPORTED_EXTENSIONS);
+	add_supported_header(p, &req);
 
 	snprintf(tmp, sizeof(tmp), "SIP/2.0 %s\r\n", message);
 	add_content(&req, tmp);
@@ -11995,7 +12009,7 @@
 			reqprep(&req, p, ast_test_flag(&p->flags[0], SIP_REINVITE_UPDATE) ? SIP_UPDATE : SIP_INVITE, 0, 1);
 
 			add_header(&req, "Allow", ALLOWED_METHODS);
-			add_header(&req, "Supported", SUPPORTED_EXTENSIONS);
+			add_supported_header(p, &req);
 			add_rpid(&req, p);
 			add_sdp(&req, p, FALSE, TRUE, FALSE);
 
@@ -12485,7 +12499,7 @@
 
 	add_header(&req, "Refer-To", referto);
 	add_header(&req, "Allow", ALLOWED_METHODS);
-	add_header(&req, "Supported", SUPPORTED_EXTENSIONS);
+	add_supported_header(p, &req);
 	if (!ast_strlen_zero(p->our_contact)) {
 		add_header(&req, "Referred-By", p->our_contact);
 	}

Modified: trunk/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sip/include/sip.h?view=diff&rev=283560&r1=283559&r2=283560
==============================================================================
--- trunk/channels/sip/include/sip.h (original)
+++ trunk/channels/sip/include/sip.h Wed Aug 25 10:56:05 2010
@@ -153,14 +153,6 @@
  *  allowsubscribe and allowrefer on in sip.conf.
  */
 #define ALLOWED_METHODS "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH"
-
-/*! \brief SIP Extensions we support
- *  \note This should be generated based on the previous array
- *  in combination with settings.
- *
- *  \todo We should not have "timer" if it's disabled in the configuration file.
- */
-#define SUPPORTED_EXTENSIONS "replaces, timer"
 
 /*! \brief Standard SIP unsecure port for UDP and TCP from RFC 3261. DO NOT CHANGE THIS */
 #define STANDARD_SIP_PORT	5060




More information about the svn-commits mailing list