[asterisk-commits] jrose: branch 11 r399962 - in /branches/11: ./ channels/ channels/sip/include/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 27 12:25:05 CDT 2013


Author: jrose
Date: Fri Sep 27 12:24:58 2013
New Revision: 399962

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399962
Log:
chan_sip: Reject calls on 200 OKs if no SDP has been received

When Asterisk receives a 200 OK in response to an invite, that peer should have
sent an SDP at some point by then. If the channel has never received an SDP,
media won't have been set and the remote address won't be known. Endpoints in
general should not be doing this. This patch makes it so that Asterisk will
simply hang up a call if it sends a 200 OK at this point. So far this odd
behavior for endpoints has only been observed in tests which involved manually
created SIP transactions in SIPp.

(closes issue ASTERISK-22424)
Reported by: Jonathan Rose
Review: https://reviewboard.asterisk.org/r/2827/
........

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

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

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

Modified: branches/11/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_sip.c?view=diff&rev=399962&r1=399961&r2=399962
==============================================================================
--- branches/11/channels/chan_sip.c (original)
+++ branches/11/channels/chan_sip.c Fri Sep 27 12:24:58 2013
@@ -22788,6 +22788,15 @@
 					ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
 				}
 			ast_rtp_instance_activate(p->rtp);
+		} else if (!reinvite) {
+			struct ast_sockaddr remote_address = {{0,}};
+
+			ast_rtp_instance_get_remote_address(p->rtp, &remote_address);
+			if (ast_sockaddr_isnull(&remote_address) || (!ast_strlen_zero(p->theirprovtag) && strcmp(p->theirtag, p->theirprovtag))) {
+				ast_log(LOG_WARNING, "Received response: \"200 OK\" from '%s' without SDP\n", p->relatedpeer->name);
+				ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
+				ast_rtp_instance_activate(p->rtp);
+			}
 		}
 
 		if (!req->ignore && p->owner) {
@@ -23710,7 +23719,11 @@
 
 		gettag(req, "To", tag, sizeof(tag));
 		ast_string_field_set(p, theirtag, tag);
-	}
+	} else {
+		/* Store theirtag to track for changes when 200 responses to invites are received without SDP */
+		ast_string_field_set(p, theirprovtag, p->theirtag);
+	}
+
 	/* This needs to be configurable on a channel/peer level,
 	   not mandatory for all communication. Sadly enough, NAT implementations
 	   are not so stable so we can always rely on these headers.

Modified: branches/11/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/sip/include/sip.h?view=diff&rev=399962&r1=399961&r2=399962
==============================================================================
--- branches/11/channels/sip/include/sip.h (original)
+++ branches/11/channels/sip/include/sip.h Fri Sep 27 12:24:58 2013
@@ -1038,6 +1038,7 @@
 		AST_STRING_FIELD(rdnis);        /*!< Referring DNIS */
 		AST_STRING_FIELD(redircause);   /*!< Referring cause */
 		AST_STRING_FIELD(theirtag);     /*!< Their tag */
+		AST_STRING_FIELD(theirprovtag); /*!< Provisional their tag, used when evaluating responses to invites */
 		AST_STRING_FIELD(tag);          /*!< Our tag for this session */
 		AST_STRING_FIELD(username);     /*!< [user] name */
 		AST_STRING_FIELD(peername);     /*!< [peer] name, not set if [user] */




More information about the asterisk-commits mailing list