Revision: 46743ce134dc
Author: Jean Deruelle <[email protected]>
Date: Fri Apr 25 10:23:54 2014 UTC
Log: Update Issue 21
Fix (a bit different than the one proposed - we check not only if the
response has been created but sent as well) + non regression test
http://code.google.com/p/sipservlets/source/detail?r=46743ce134dc
Modified:
/sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/message/MobicentsSipServletMessage.java
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletMessageImpl.java
/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/proxy/ProxyRecordRouteReInviteTest.java
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/proxy/ProxyRecordRoutingTest.java
=======================================
---
/sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/message/MobicentsSipServletMessage.java
Tue Sep 20 15:23:24 2011 UTC
+++
/sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/message/MobicentsSipServletMessage.java
Fri Apr 25 10:23:54 2014 UTC
@@ -1,23 +1,20 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * TeleStax, Open Source Cloud Communications
+ * Copyright 2011-2014, Telestax Inc and individual contributors
+ * by the @authors tag.
*
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
+ * This program is free software: you can redistribute it and/or modify
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
- * This software is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package org.mobicents.servlet.sip.core.message;
@@ -44,4 +41,6 @@
MobicentsTransactionApplicationData getTransactionApplicationData();
Message getMessage();
+ // https://code.google.com/p/sipservlets/issues/detail?id=21
+ boolean isMessageSent();
}
=======================================
---
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletMessageImpl.java
Thu Apr 17 20:06:02 2014 UTC
+++
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletMessageImpl.java
Fri Apr 25 10:23:54 2014 UTC
@@ -159,7 +159,8 @@
protected transient SipPrincipal userPrincipal;
protected boolean isMessageSent;
- // Made it transient for Issue 1523 :
http://code.google.com/p/mobicents/issues/detail?id=1523
+
+ // Made it transient for Issue 1523 :
http://code.google.com/p/mobicents/issues/detail?id=1523
// NotSerializableException happens if a message is stored in the sip
session during HA
protected transient Dialog dialog;
@@ -2172,4 +2173,8 @@
public void setAppSessionId(String appSessionId) {
this.appSessionId = appSessionId;
}
+
+ public boolean isMessageSent() {
+ return isMessageSent;
+ }
}
=======================================
---
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java
Fri Apr 18 21:29:45 2014 UTC
+++
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java
Fri Apr 25 10:23:54 2014 UTC
@@ -1,23 +1,20 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2011, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * TeleStax, Open Source Cloud Communications
+ * Copyright 2011-2014, Telestax Inc and individual contributors
+ * by the @authors tag.
*
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
+ * This program is free software: you can redistribute it and/or modify
+ * under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation; either version 3 of
* the License, or (at your option) any later version.
*
- * This software is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package org.mobicents.servlet.sip.proxy;
@@ -83,7 +80,8 @@
import com.sun.mail.iap.Response;
/**
- * @author root
+ * @author [email protected]
+ * @author [email protected]
*
*/
public class ProxyBranchImpl implements MobicentsProxyBranch,
Externalizable {
@@ -690,8 +688,17 @@
*/
public void proxySubsequentRequest(MobicentsSipServletRequest
sipServletRequest) {
SipServletRequestImpl request = (SipServletRequestImpl)
sipServletRequest;
+ MobicentsSipServletResponse lastFinalResponse =
(MobicentsSipServletResponse) request.getLastFinalResponse();
+ if(lastFinalResponse != null &&
lastFinalResponse.isMessageSent()) {
+ // https://code.google.com/p/sipservlets/issues/detail?id=21
+ if(logger.isDebugEnabled()) {
+ logger.debug("Not proxying request as final response has already
been sent for " + request);
+ }
+ return;
+ }
+
addTransaction(request);
- // A re-INVITE needs special handling without goind through the
dialog-stateful methods
+ // A re-INVITE needs special handling without going through the
dialog-stateful methods
if(request.getMethod().equalsIgnoreCase("INVITE")) {
if(logger.isDebugEnabled()) {
logger.debug("Proxying reinvite request " +
request);
=======================================
---
/sip-servlets-test-suite/applications/proxy-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ProxySipServlet.java
Fri Apr 25 07:55:03 2014 UTC
+++
/sip-servlets-test-suite/applications/proxy-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ProxySipServlet.java
Fri Apr 25 10:23:54 2014 UTC
@@ -108,7 +108,7 @@
logger.info("Got request:\n" + request.getMethod());
SipServletRequestExt req = (SipServletRequestExt)request;
if(req.isOrphan() && !req.isInitial()) {
- req.getSession().setAttribute("h", "hhh");
+ req.getSession().setAttribute("h", "hhh");
return;
}
if(request.getFrom().toString().contains("proxy-orphan")) {
@@ -178,6 +178,10 @@
request.getApplicationSession().setAttribute(SIP_APPLICATION_SESSION_TIMEOUT, "true");
}
if(!request.isInitial()){
+
if(request.getFrom().toString().contains("final-response-subsequent")) {
+ //
https://code.google.com/p/sipservlets/issues/detail?id=21
+ request.createResponse(491).send();
+ }
return;
}
=======================================
---
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/proxy/ProxyRecordRouteReInviteTest.java
Fri Mar 7 15:17:08 2014 UTC
+++
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/proxy/ProxyRecordRouteReInviteTest.java
Fri Apr 25 10:23:54 2014 UTC
@@ -100,6 +100,45 @@
assertTrue(receiver.getByeReceived());
assertTrue(sender.getOkToByeReceived());
}
+
+ /*
+ * https://code.google.com/p/sipservlets/issues/detail?id=21
+ */
+ public void testProxyCallerFinalResponseOnSubsequentRequest() throws
Exception {
+ setupPhones(ListeningPoint.UDP);
+ String fromName = "unique-location-final-response-subsequent";
+ 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);
+
+ sender.sendSipRequest("INVITE", fromAddress, toAddress, null,
null, false);
+ Thread.sleep(TIMEOUT);
+ assertTrue(sender.isAckSent());
+ assertTrue(receiver.isAckReceived());
+ // non regression test for Issue
http://code.google.com/p/mobicents/issues/detail?id=2359
+ String inviteBranch =
((MessageExt)receiver.getInviteRequest()).getTopmostViaHeader().getBranch();
+ String ackBranch =
((MessageExt)receiver.getAckRequest()).getTopmostViaHeader().getBranch();
+ assertFalse(inviteBranch.equals(ackBranch));
+ receiver.setAckReceived(false);
+ sender.setAckSent(false);
+ sender.sendInDialogSipRequest("INVITE", null, null, null, null,
null);
+ Thread.sleep(TIMEOUT);
+ assertEquals(491, sender.getFinalResponseStatus());
+ assertFalse(receiver.isAckReceived());
+ receiver.setAckReceived(false);
+ receiver.setAckSent(false);
+ sender.setAckSent(false);
+ sender.setAckReceived(false);
+ sender.sendBye();
+ Thread.sleep(TIMEOUT);
+ assertTrue(receiver.getByeReceived());
+ assertTrue(sender.getOkToByeReceived());
+ }
// Test for http://code.google.com/p/sipservlets/issues/detail?id=44
public void testProxyReinviteAckSeenByApp() throws Exception {
=======================================
---
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/proxy/ProxyRecordRoutingTest.java
Fri Apr 25 07:55:03 2014 UTC
+++
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/proxy/ProxyRecordRoutingTest.java
Fri Apr 25 10:23:54 2014 UTC
@@ -19,9 +19,13 @@
package org.mobicents.servlet.sip.testsuite.proxy;
+import java.util.ListIterator;
+
import javax.sip.ListeningPoint;
import javax.sip.SipProvider;
import javax.sip.address.SipURI;
+import javax.sip.header.Header;
+import javax.sip.header.RecordRouteHeader;
import org.apache.log4j.Logger;
import org.mobicents.servlet.sip.SipServletTestCase;
@@ -161,7 +165,7 @@
assertEquals(480,sender.getFinalResponseStatus());
assertTrue(neutral.isCancelReceived());
}
-
+
@Override
public void tearDown() throws Exception {
senderProtocolObjects.destroy();
--
---
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.