Revision: 04c8423e74bc
Author: Jean Deruelle <[email protected]>
Date: Fri Apr 25 18:40:55 2014 UTC
Log: Update Issue 154
Non regression test
(cherry picked from commit f1d5edcc45bd28f9a928d3d928ee0be9f28618b0)
http://code.google.com/p/sipservlets/source/detail?r=04c8423e74bc
Modified:
/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/proxy/ProxyRecordRoutingTest.java
=======================================
---
/sip-servlets-test-suite/applications/proxy-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ProxySipServlet.java
Fri Apr 25 10:47:43 2014 UTC
+++
/sip-servlets-test-suite/applications/proxy-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ProxySipServlet.java
Fri Apr 25 18:40:55 2014 UTC
@@ -554,6 +554,14 @@
// This URi completes and need to be canceled before
answering
uris.add(sipFactory.createAddress("sip:neutral@" + host
+ ":5058").getURI());
List<ProxyBranch> branches =
response.getProxy().createProxyBranches(uris);
+ for (ProxyBranch proxyBranch : branches) {
+
if(response.getFrom().getURI().toString().contains("change-to-user")) {
+ //
https://code.google.com/p/sipservlets/issues/detail?id=154
+ Address toHeader =
proxyBranch.getRequest().getAddressHeader("To");
+ SipURI toSipURI = (SipURI) toHeader.getURI();
+ toSipURI.setUser("newuser");
+ }
+ }
response.getProxy().startProxy();
}
}
=======================================
---
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/proxy/ProxyRecordRoutingTest.java
Fri Apr 25 13:46:46 2014 UTC
+++
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/proxy/ProxyRecordRoutingTest.java
Fri Apr 25 18:40:55 2014 UTC
@@ -29,6 +29,7 @@
import javax.sip.address.SipURI;
import javax.sip.header.Header;
import javax.sip.header.RecordRouteHeader;
+import javax.sip.header.ToHeader;
import org.apache.log4j.Logger;
import org.mobicents.servlet.sip.SipServletTestCase;
@@ -218,6 +219,36 @@
assertEquals(480,sender.getFinalResponseStatus());
assertTrue(neutral.isCancelReceived());
}
+
+ /*
+ * Non Regression test for
https://code.google.com/p/sipservlets/issues/detail?id=154
+ */
+ public void testCancel480ChangeToUserProxying() throws Exception {
+ deployApplication();
+ String fromName
= "cancel-480-sequential-2-locations-change-to-user";
+ String fromSipAddress = "sip-servlets.com";
+ SipURI fromAddress =
senderProtocolObjects.addressFactory.createSipURI(
+ fromName, fromSipAddress);
+
+ String toSipAddress = "sip-servlets.com";
+ String toUser = "proxy-receiver";
+ SipURI toAddress =
senderProtocolObjects.addressFactory.createSipURI(
+ toUser, toSipAddress);
+
+ receiver.setFinalResponseToSend(480);
+ sender.sendSipRequest("INVITE", fromAddress, toAddress, null,
null, false);
+ Thread.sleep(TIMEOUT);
+ assertEquals("newuser",
((SipURI)((ToHeader)neutral.getInviteRequest().getHeader(ToHeader.NAME)).getAddress().getURI()).getUser());
+ sender.sendBye();
+ Thread.sleep(TIMEOUT);
+ // We receive 480 and not 487 because of JSR 289 Section 10.2.6
+ // When receiving a CANCEL for a transaction for which a Proxy
object exists the server responds
+ // to the CANCEL with a 200 and if the original request has not
been proxied yet the container responds to it with a 487 final
+ // response. otherwise, all branches are cancelled, and response
processing continues as usual
+ assertEquals(200,sender.getFinalResponseStatus());
+ assertTrue(neutral.getByeReceived());
+ assertTrue(sender.getOkToByeReceived());
+ }
/*
* https://code.google.com/p/sipservlets/issues/detail?id=22
--
---
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.