r3416 - in trunk/libmsip/source: . messages

erik at minisip.org erik at minisip.org
Tue Sep 4 23:23:44 CEST 2007


Author: erik
Date: 2007-09-04 23:23:43 +0200 (Tue, 04 Sep 2007)
New Revision: 3416

Modified:
   trunk/libmsip/source/SipLayerTransport.cxx
   trunk/libmsip/source/messages/SipRequest.cxx
Log:

 * CANCEL requests was not handled properly.

   When the transaction layer created a transaction it asked
   the CANCEL packet what branch should be cancelled. The
   problem is that nowdays a packet only knows it's branch
   after it has been set by the transport layer, and that is 
   done after the transaction layer.

   This fix assigns a branch to a CANCEL packet when it is
   created by adding the Via header. The transport layer
   has to do a check to not add it a second time.
   



Modified: trunk/libmsip/source/SipLayerTransport.cxx
===================================================================
--- trunk/libmsip/source/SipLayerTransport.cxx	2007-09-04 18:23:32 UTC (rev 3415)
+++ trunk/libmsip/source/SipLayerTransport.cxx	2007-09-04 21:23:43 UTC (rev 3416)
@@ -488,6 +488,11 @@
 	if( !socket )
 		return;
 
+	//The Via header for CANCEL requests
+	//is added when the packet is created
+	if (pack->getType()=="CANCEL")
+		return;
+
 	transport = getSocketTransport( socket );
 
 	getIpPort( server, socket, ip, port );

Modified: trunk/libmsip/source/messages/SipRequest.cxx
===================================================================
--- trunk/libmsip/source/messages/SipRequest.cxx	2007-09-04 18:23:32 UTC (rev 3415)
+++ trunk/libmsip/source/messages/SipRequest.cxx	2007-09-04 21:23:43 UTC (rev 3416)
@@ -121,7 +121,16 @@
 			case SIP_HEADER_TYPE_CALLID:
 				add=true;
 				break;
-			case SIP_HEADER_TYPE_ROUTE:
+
+			// CANCEL requests must have the same branch
+			// parameter as the transaction it cancels.
+			// If CANCEL packets are treated as any other
+			// request, then they would be assigned a random
+			// branch. When we create the CANCEL request (how)
+			// we therefore copy the Via header to indicate
+			// which transaction it cancels. The
+			// transport layer must make sure to not add it again.
+			case SIP_HEADER_TYPE_VIA:
 			case SIP_HEADER_TYPE_AUTHORIZATION:
 			case SIP_HEADER_TYPE_PROXYAUTHORIZATION:
 				add=true;



More information about the Minisip-devel mailing list