Revision: 04f086a88d08
Author: Jean Deruelle <[email protected]>
Date: Fri Apr 18 21:29:45 2014 UTC
Log: Update Issue 2
Fix (different than the ones proposed) + non regression tests
avoid throwing exception as it has impact on performance and also make sure
the exception is still thrown if the branch has no child branches as
specified by the javadoc
(cherry picked from commit 2962771cda5c0799a9e29668c2b87aace7ddf85c)
(cherry picked from commit 73fc360d4d4f3239faebec54c8cf5a9c705675f3)
http://code.google.com/p/sipservlets/source/detail?r=04f086a88d08
Modified:
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java
/sip-servlets-test-suite/applications/proxy-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ProxySipServlet.java
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/TestSipListener.java
=======================================
---
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java
Fri Apr 18 21:47:52 2014 UTC
+++
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java
Fri Apr 18 21:29:45 2014 UTC
@@ -80,6 +80,8 @@
import org.mobicents.servlet.sip.rfc5626.RFC5626Helper;
import org.mobicents.servlet.sip.startup.StaticServiceHolder;
+import com.sun.mail.iap.Response;
+
/**
* @author root
*
@@ -191,7 +193,14 @@
outgoingRequest.getMethod().equalsIgnoreCase(Request.UPDATE))) {
if(lastResponse != null) { /* According to SIP RFC we should send
cancel only if we receive any response first*/
if(logger.isDebugEnabled()) {
- logger.debug("Trying to cancel PorxyBranch for outgoing request " +
outgoingRequest);
+ logger.debug("Trying to cancel ProxyBranch for outgoing request " +
outgoingRequest);
+ }
+ if(lastResponse.getStatus() > Response.OK
&& !recursedBranches.isEmpty()) {
+ // Javadoc says it should throw an java.lang.IllegalStateException
if the transaction has already been completed and it has no child branches
+ if(logger.isDebugEnabled()) {
+ logger.debug("lastResponse status for this branch is " +
lastResponse.getStatus() + " and it has " + recursedBranches.size() + " to
cancel");
+ }
+ return;
}
SipServletRequest cancelRequest = null;
if(outgoingRequest.getMethod().equalsIgnoreCase(Request.PRACK) ||
outgoingRequest.getMethod().equalsIgnoreCase(Request.UPDATE)) {
=======================================
---
/sip-servlets-test-suite/applications/proxy-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ProxySipServlet.java
Fri Apr 18 16:48:28 2014 UTC
+++
/sip-servlets-test-suite/applications/proxy-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ProxySipServlet.java
Fri Apr 18 21:29:45 2014 UTC
@@ -348,7 +348,7 @@
logger.info("doInvite: uri = " + uri);
proxy.setParallel(false);
}
- if (from.contains("update") || from.contains("prack")){
+ if (from.contains("update") || from.contains("prack") ||
from.contains("redirect") ){
proxy.setProxyTimeout(40);
} else {
proxy.setProxyTimeout(4);
=======================================
---
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/TestSipListener.java
Fri Apr 18 16:48:28 2014 UTC
+++
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/TestSipListener.java
Fri Apr 18 21:29:45 2014 UTC
@@ -1359,10 +1359,14 @@
}
if(!waitForCancel) {
- Address address = protocolObjects.addressFactory
- .createAddress("Shootme <sip:" +
System.getProperty("org.mobicents.testsuite.testhostaddr") + ":" + myPort
-
+";transport="+protocolObjects.transport
- + ">");
+ Address address =
protocolObjects.addressFactory.createAddress("Shootme <sip:" +
System.getProperty("org.mobicents.testsuite.testhostaddr") + ":" + myPort
+
+";transport="+protocolObjects.transport
+ + ">");
+ if(finalResponseToSend ==
Response.MOVED_TEMPORARILY) {
+ address = protocolObjects.addressFactory.createAddress("Shootme
<sip:" + System.getProperty("org.mobicents.testsuite.testhostaddr")
+ ":5058"
+
+";transport="+protocolObjects.transport
+ + ">");
+ }
contactHeader =
protocolObjects.headerFactory.createContactHeader(address);
setFinalResponse(protocolObjects.messageFactory
.createResponse(finalResponseToSend, request));
--
---
You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.