[svn-commits] oej: branch oej/teapot-1.8 r430759 - in /team/oej/teapot-1.8: channels/ patch...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jan 19 08:13:49 CST 2015


Author: oej
Date: Mon Jan 19 08:13:47 2015
New Revision: 430759

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=430759
Log:
Adding patch to respond to messages missing from tag and with weird methods and such.

We should always try to respond if possible, not just drop a request

Added:
    team/oej/teapot-1.8/patches/sensha-handle-unknown-sip-messages-1.8.diff   (with props)
Modified:
    team/oej/teapot-1.8/channels/chan_sip.c
    team/oej/teapot-1.8/res/res_rtp_asterisk.c

Modified: team/oej/teapot-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/teapot-1.8/channels/chan_sip.c?view=diff&rev=430759&r1=430758&r2=430759
==============================================================================
--- team/oej/teapot-1.8/channels/chan_sip.c (original)
+++ team/oej/teapot-1.8/channels/chan_sip.c Mon Jan 19 08:13:47 2015
@@ -8435,12 +8435,24 @@
 		/* All messages must always have From: tag */
 		if (ast_strlen_zero(fromtag)) {
 			ast_debug(5, "%s request has no from tag, dropping callid: %s from: %s\n", sip_methods[req->method].text , callid, from );
+			/* Try to respond nevertheless */
+			transmit_response_using_temp(callid, addr, 1, intended_method,
+						     req, "400 Bad Request");
 			return NULL;
 		}
 		/* reject requests that must always have a To: tag */
-		if (ast_strlen_zero(totag) && (req->method == SIP_ACK || req->method == SIP_BYE || req->method == SIP_INFO )) {
-			ast_debug(5, "%s must have a to tag. dropping callid: %s from: %s\n", sip_methods[req->method].text , callid, from );
-			return NULL;
+		if (ast_strlen_zero(totag)) {
+ 			if  (req->method == SIP_ACK) {
+				ast_debug(5, "%s must have a to tag. dropping callid: %s from: %s\n", sip_methods[req->method].text , callid, from );
+				return NULL;
+			}
+			if (req->method == SIP_BYE || req->method == SIP_INFO ) {
+				/* We have to respond */
+				ast_debug(5, "%s must have a to tag. dropping callid: %s from: %s\n", sip_methods[req->method].text , callid, from );
+				transmit_response_using_temp(callid, addr, 1, intended_method,
+						     req, "400 Bad Request");
+				return NULL;
+			}
 		}
 	}
 
@@ -8517,6 +8529,7 @@
 
 		free_via(via);
 	} /* end of pedantic mode Request/Reponse to Dialog matching */
+
 
 	/* See if the method is capable of creating a dialog */
 	if (sip_methods[intended_method].can_create == CAN_CREATE_DIALOG) {

Added: team/oej/teapot-1.8/patches/sensha-handle-unknown-sip-messages-1.8.diff
URL: http://svnview.digium.com/svn/asterisk/team/oej/teapot-1.8/patches/sensha-handle-unknown-sip-messages-1.8.diff?view=auto&rev=430759
==============================================================================
--- team/oej/teapot-1.8/patches/sensha-handle-unknown-sip-messages-1.8.diff (added)
+++ team/oej/teapot-1.8/patches/sensha-handle-unknown-sip-messages-1.8.diff Mon Jan 19 08:13:47 2015
@@ -1,0 +1,41 @@
+Index: channels/chan_sip.c
+===================================================================
+--- channels/chan_sip.c	(.../branches/1.8)	(revision 430758)
++++ channels/chan_sip.c	(.../team/oej/sensha-handle-unknown-sip-messages-1.8)	(revision 430758)
+@@ -8419,12 +8419,24 @@
+ 		/* All messages must always have From: tag */
+ 		if (ast_strlen_zero(fromtag)) {
+ 			ast_debug(5, "%s request has no from tag, dropping callid: %s from: %s\n", sip_methods[req->method].text , callid, from );
++			/* Try to respond nevertheless */
++			transmit_response_using_temp(callid, addr, 1, intended_method,
++						     req, "400 Bad Request");
+ 			return NULL;
+ 		}
+ 		/* reject requests that must always have a To: tag */
+-		if (ast_strlen_zero(totag) && (req->method == SIP_ACK || req->method == SIP_BYE || req->method == SIP_INFO )) {
+-			ast_debug(5, "%s must have a to tag. dropping callid: %s from: %s\n", sip_methods[req->method].text , callid, from );
+-			return NULL;
++		if (ast_strlen_zero(totag)) {
++ 			if  (req->method == SIP_ACK) {
++				ast_debug(5, "%s must have a to tag. dropping callid: %s from: %s\n", sip_methods[req->method].text , callid, from );
++				return NULL;
++			}
++			if (req->method == SIP_BYE || req->method == SIP_INFO ) {
++				/* We have to respond */
++				ast_debug(5, "%s must have a to tag. dropping callid: %s from: %s\n", sip_methods[req->method].text , callid, from );
++				transmit_response_using_temp(callid, addr, 1, intended_method,
++						     req, "400 Bad Request");
++				return NULL;
++			}
+ 		}
+ 	}
+ 
+@@ -8502,6 +8514,7 @@
+ 		free_via(via);
+ 	} /* end of pedantic mode Request/Reponse to Dialog matching */
+ 
++
+ 	/* See if the method is capable of creating a dialog */
+ 	if (sip_methods[intended_method].can_create == CAN_CREATE_DIALOG) {
+ 		struct sip_pvt *p = NULL;
+

Propchange: team/oej/teapot-1.8/patches/sensha-handle-unknown-sip-messages-1.8.diff
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/oej/teapot-1.8/patches/sensha-handle-unknown-sip-messages-1.8.diff
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/oej/teapot-1.8/patches/sensha-handle-unknown-sip-messages-1.8.diff
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/oej/teapot-1.8/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/teapot-1.8/res/res_rtp_asterisk.c?view=diff&rev=430759&r1=430758&r2=430759
==============================================================================
--- team/oej/teapot-1.8/res/res_rtp_asterisk.c (original)
+++ team/oej/teapot-1.8/res/res_rtp_asterisk.c Mon Jan 19 08:13:47 2015
@@ -3394,7 +3394,7 @@
 	} else if (rtp_debug_test_addr(&remote_address)) {
 		ast_verbose("Sent Comfort Noise RTP packet to %s (type %-2.2d, seq %-6.6d, ts %-6.6u, len %-6.6d)\n",
 				ast_sockaddr_stringify(&remote_address),
-				AST_RTP_CN, rtp->seqno, rtp->lastdigitts, res - hdrlen);
+				payload, rtp->seqno, rtp->lastdigitts, res - hdrlen);
 	}
 
 	rtp->seqno++;




More information about the svn-commits mailing list