[Asterisk-cvs] asterisk/channels chan_sip.c,1.510.2.36,1.510.2.37

russell at lists.digium.com russell at lists.digium.com
Wed Jan 12 20:56:03 CST 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv16552/channels

Modified Files:
      Tag: v1-0
	chan_sip.c 
Log Message:
Send "405 Method Not Allowed" if a message is received outside of a call (bug #3324)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.510.2.36
retrieving revision 1.510.2.37
diff -u -d -r1.510.2.36 -r1.510.2.37
--- chan_sip.c	11 Jan 2005 18:07:42 -0000	1.510.2.36
+++ chan_sip.c	13 Jan 2005 03:00:02 -0000	1.510.2.37
@@ -7510,12 +7510,17 @@
 			p->needdestroy = 1;
 		transmit_response(p, "200 OK", req);
 	} else if (!strcasecmp(cmd, "MESSAGE")) {
-		if (!ignore) {
-			if (debug)
-				ast_verbose("Receiving message!\n");
-			receive_message(p, req);
+		if (p->lastinvite) {
+			if (!ignore) {
+				if (debug)
+					ast_verbose("Receiving message!\n");
+				receive_message(p, req);
+			}
+			transmit_response(p, "200 OK", req);
+		} else {
+			transmit_response(p, "405 Method Not Allowed", req);
+			p->needdestroy = 1;
 		}
-		transmit_response(p, "200 OK", req);
 	} else if (!strcasecmp(cmd, "SUBSCRIBE")) {
 		if (!ignore) {
 			/* Use this as the basis */




More information about the svn-commits mailing list