Permalink
Browse files

Issue number: 135

Obtained from:
Submitted by:  mranga
Reviewed by:  mranga
Add stack config parameter
  • Loading branch information...
1 parent 4d7dddb commit e79c925787cef284d80788019a477fce5822f15d @ranganathanm ranganathanm committed Nov 22, 2007
Binary file not shown.
@@ -0,0 +1 @@
+1895bc16d687801507bc8e64a6c64d86
@@ -0,0 +1 @@
+e562f7560e720493e7b45c7813b7e2ca56aed0b7
@@ -0,0 +1,69 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>javax.sip</groupId>
+ <version>1.2</version>
+ <artifactId>jain-sip</artifactId>
+ </parent>
+
+ <artifactId>jain-sip-ri</artifactId>
+ <packaging>jar</packaging>
+ <name>jain-sip-ri</name>
+ <url>http://jain-sip.dev.java.net</url>
+ <build>
+ <sourceDirectory>../../src/gov/nist</sourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <includes>
+ <include>**/javax/sip/**</include>
+ <include>**/core/**</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ <resources>
+ <resource>
+ <directory>target/gov/</directory>
+ <includes>
+ <include>nist/javax/sip/**</include>
+ <include>nist/core/**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+
+ </build>
+
+
+ <distributionManagement>
+ <repository>
+ <id>local-repository</id>
+ <url>${m2-repo.java.net.url}</url>
+ </repository>
+ </distributionManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.8</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.sip</groupId>
+ <artifactId>jain-sip-api</artifactId>
+ <version>1.2</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
@@ -0,0 +1 @@
+5ab12dc729aa101d5d5d34c376e806ef
@@ -0,0 +1 @@
+ac4a859b0443f98bfce0fbf45c9d60fc8ca25cc2
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?><metadata>
+ <groupId>javax.sip</groupId>
+ <artifactId>jain-sip-ri</artifactId>
+ <version>1.2</version>
+ <versioning>
+ <versions>
+ <version>1.2</version>
+ </versions>
+ <lastUpdated>20071114030833</lastUpdated>
+ </versioning>
+</metadata>
@@ -0,0 +1 @@
+cda7147c90bef080f1d2a992b31b1172
@@ -0,0 +1 @@
+29609a3497d5ed7eda63a6eed8b7b5cd686a10b8
@@ -227,16 +227,27 @@
* information related to the application or environmental conditions
* into the log stream. The log factory must have a default constructor. </li>
*
- * <li><b>gov.nist.javax.sip.COMPUTE_CONTENT_LENGTH_FROM_MESSAGE_BODY = [true|false] <br/>
+ * <li><b>gov.nist.javax.sip.COMPUTE_CONTENT_LENGTH_FROM_MESSAGE_BODY = [true|false] </b> <br/>
* Default is <it>false</it> If set to <it>true</it>, when you are creating
* a message from a <it>String</it>, the MessageFactory will compute
* the content length from the message content and ignore the provided
* content length parameter in the Message. Otherwise, it will use the content
* length supplied and generate a parse exception if the content is
* truncated.
*
+ * <li><b>gov.nist.javax.sip.CANCEL_CLIENT_TRANSACTION_CHECKED = [true|false] </b> <br/>
+ * Default is <it>true</it>.
+ * This flag is added in support of load balancers or failover managers
+ * where you may want to cancel ongoing transactions from a different stack than the original stack.
+ * If set to <it>false</it> then the CANCEL client transaction is not checked
+ * for the existence of the INVITE or the state of INVITE when you send the CANCEL request.
+ * Hence you can CANCEL an INVITE from a different stack than the INVITE. You can also create a CANCEL client
+ * transaction late and send it out after the INVITE server transaction has been
+ * Terminated. Clearly this will result in protocol errors.
+ * Setting the flag to true ( default ) enables you to avoid common
+ * protocol errors.
*
- * @version 1.2 $Revision: 1.69 $ $Date: 2007-11-12 18:31:26 $
+ * @version 1.2 $Revision: 1.70 $ $Date: 2007-11-22 21:18:05 $
*
* @author M. Ranganathan <br/>
*
@@ -661,11 +672,15 @@ public SipStackImpl(Properties configurationProperties)
}
boolean computeContentLength =
- configurationProperties.getProperty("gov.nist.javax.sip.COMPUTE_CONTENT_LENGTH_FROM_MESSAGE_BODY","false").equals("true");
+ configurationProperties.getProperty("gov.nist.javax.sip.COMPUTE_CONTENT_LENGTH_FROM_MESSAGE_BODY","false").equalsIgnoreCase("true");
StringMsgParser.setComputeContentLengthFromMessage(computeContentLength);
super.rfc2543Supported = configurationProperties.getProperty
("gov.nist.javax.sip.RFC_2543_SUPPORT_ENABLED","true").equalsIgnoreCase("true");
+
+ super.cancelClientTransactionChecked =
+ configurationProperties.getProperty("gov.nist.javax.sip.CANCEL_CLIENT_TRANSACTION_CHECKED","true").equalsIgnoreCase("true");
+
}
/*
@@ -155,7 +155,7 @@
*
* @author M. Ranganathan
*
- * @version 1.2 $Revision: 1.83 $ $Date: 2007-11-22 18:09:52 $
+ * @version 1.2 $Revision: 1.84 $ $Date: 2007-11-22 21:18:04 $
*/
public class SIPClientTransaction extends SIPTransaction implements
ServerResponseInterface, javax.sip.ClientTransaction {
@@ -934,25 +934,30 @@ public void sendRequest() throws SipException {
}
try {
/*
- * This check is removed because it causes problems for
- * load balancers ( See issue 136) reported by Raghav Ramesh (
- * BT )
+ * This check is removed because it causes problems for load
+ * balancers ( See issue 136) reported by Raghav Ramesh ( BT )
*
- * if (this.getOriginalRequest().getMethod().equals(Request.CANCEL)) {
- * SIPClientTransaction ct = (SIPClientTransaction) sipStack
- * .findCancelTransaction(this.getOriginalRequest(), false); if (ct ==
- * null) { // If the original // request has generated a final
- * response, the CANCEL SHOULD // NOT be // sent, as it is an
- * effective no-op, since CANCEL has no // effect on // requests
- * that have already generated a final response. throw new
- * SipException( "Could not find original tx to cancel. RFC 3261
- * 9.1"); } else if (ct.getState() == null) { throw new
- * SipException( "State is null no provisional response yet --
- * cannot cancel RFC 3261 9.1"); } else if
- * (!ct.getMethod().equals(Request.INVITE)) { throw new
- * SipException( "Cannot cancel non-invite requests RFC 3261 9.1");
- * } } else
*/
+ if (this.getOriginalRequest().getMethod().equals(Request.CANCEL) && sipStack.isCancelClientTransactionChecked()) {
+ SIPClientTransaction ct = (SIPClientTransaction) sipStack
+ .findCancelTransaction(this.getOriginalRequest(), false);
+ if (ct == null) {
+ /*
+ * If the original request has generated a final
+ * response, the CANCEL SHOULD NOT be sent, as it is
+ * an effective no-op, since CANCEL has no effect on
+ * requests that have already generated a final response.
+ */
+ throw new SipException(
+ "Could not find original tx to cancel. RFC 3261 9.1");
+ } else if (ct.getState() == null) {
+ throw new SipException(
+ "State is null no provisional response yet -- cannot cancel RFC 3261 9.1");
+ } else if (!ct.getMethod().equals(Request.INVITE)) {
+ throw new SipException(
+ "Cannot cancel non-invite requests RFC 3261 9.1");
+ }
+ } else
if (this.getOriginalRequest().getMethod().equals(Request.BYE)
|| this.getOriginalRequest().getMethod().equals(
@@ -65,7 +65,7 @@
*
* @author M. Ranganathan <br/>
*
- * @version 1.2 $Revision: 1.86 $ $Date: 2007-11-14 02:57:19 $
+ * @version 1.2 $Revision: 1.87 $ $Date: 2007-11-22 21:18:04 $
*/
public abstract class SIPTransactionStack implements
SIPTransactionEventListener {
@@ -304,6 +304,10 @@
protected LogRecordFactory logRecordFactory;
+ // Set to true if the client CANCEL transaction should be checked before sending
+ // it out.
+ protected boolean cancelClientTransactionChecked = true;
+
// / Timer to regularly ping the thread auditor (on behalf of the timer
// thread)
class PingTimer extends SIPStackTimerTask {
@@ -2139,4 +2143,8 @@ public boolean isRfc2543Supported() {
return this.rfc2543Supported;
}
+
+ public boolean isCancelClientTransactionChecked() {
+ return this.cancelClientTransactionChecked;
+ }
}
@@ -26,7 +26,7 @@
public static String logFileDirectory = "";
- public static String transport = "tcp";
+ public static String transport = "udp";

0 comments on commit e79c925

Please sign in to comment.