[asterisk-commits] oej: branch oej/sensha-handle-unknown-sip-messages-1.8 r430757 - /team/oej/se...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 19 08:06:09 CST 2015


Author: oej
Date: Mon Jan 19 08:06:05 2015
New Revision: 430757

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=430757
Log:
Success

SIP/2.0 501 Method Not Implemented
Via: SIP/2.0/UDP 127.0.0.1:37689;branch=z9hG4bK.61cdaeb0;alias;received=192.168.40.27;rport=37689
Via: SIP/2.0/UDP 192.168.0.1:8383
From: <mailto:pizzastore at huntsvillepizza.com>;tag=lasdkfjalsdfkj33333
To: <sip:mattjordan at digium.com>;tag=as0351a55b
Call-ID: BestPizzaInTownCappricciosa12389nj1h23k123kjh123kjh123kjh123
CSeq: 123 PIZZADELIVERY
Server: Asterisk PBX SVN-oej-sensha-handle-unknown-sip-messages-1.8-r430754M-/branches/
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0



Modified:
    team/oej/sensha-handle-unknown-sip-messages-1.8/channels/chan_sip.c

Modified: team/oej/sensha-handle-unknown-sip-messages-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/sensha-handle-unknown-sip-messages-1.8/channels/chan_sip.c?view=diff&rev=430757&r1=430756&r2=430757
==============================================================================
--- team/oej/sensha-handle-unknown-sip-messages-1.8/channels/chan_sip.c (original)
+++ team/oej/sensha-handle-unknown-sip-messages-1.8/channels/chan_sip.c Mon Jan 19 08:06:05 2015
@@ -8402,6 +8402,7 @@
 		}
 		return NULL;	/* Invalid packet */
 	}
+	ast_debug(2, " ===> Not invalid, all headers there \n");
 
 	if (sip_cfg.pedanticsipchecking) {
 		/* In principle Call-ID's uniquely identify a call, but with a forking SIP proxy
@@ -8419,14 +8420,27 @@
 		/* 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;
+			}
+		}
+	}
+	ast_debug(2, " ===> Not invalid, all tags there \n");
 
 	if (!sip_cfg.pedanticsipchecking) {
 		struct sip_pvt tmp_dialog = {
@@ -8502,8 +8516,11 @@
 		free_via(via);
 	} /* end of pedantic mode Request/Reponse to Dialog matching */
 
+	ast_debug(2, " ===> Not in current dialog.\n");
+
 	/* See if the method is capable of creating a dialog */
 	if (sip_methods[intended_method].can_create == CAN_CREATE_DIALOG) {
+		ast_debug(2, " ===> Able to create dialog.\n");
 		struct sip_pvt *p = NULL;
 
 		if (intended_method == SIP_REFER) {
@@ -8525,10 +8542,12 @@
 		}
 		return p; /* can be NULL */
 	} else if( sip_methods[intended_method].can_create == CAN_CREATE_DIALOG_UNSUPPORTED_METHOD) {
+		ast_debug(2, " ===> Not supported message.\n");
 		/* A method we do not support, let's take it on the volley */
 		transmit_response_using_temp(callid, addr, 1, intended_method, req, "501 Method Not Implemented");
 		ast_debug(2, "Got a request with unsupported SIP method.\n");
 	} else if (intended_method != SIP_RESPONSE && intended_method != SIP_ACK) {
+		ast_debug(2, " ===> Request unknown .\n");
 		/* This is a request outside of a dialog that we don't know about */
 		transmit_response_using_temp(callid, addr, 1, intended_method, req, "481 Call leg/transaction does not exist");
 		ast_debug(2, "That's odd...  Got a request in unknown dialog. Callid %s\n", callid ? callid : "<unknown>");
@@ -8538,6 +8557,7 @@
 	if (intended_method == SIP_RESPONSE)
 		ast_debug(2, "That's odd...  Got a response on a call we don't know about. Callid %s\n", callid ? callid : "<unknown>");
 
+	ast_debug(2, " ===> We have no idea.  Returning NULL.\n");
 	return NULL;
 }
 




More information about the asterisk-commits mailing list