Revision: 5168de1351d9
Author: Jean Deruelle <[email protected]>
Date: Tue Apr 29 20:37:41 2014 UTC
Log: Update Issue 194
Fix + non regression test
(cherry picked from commit 74661503fa6882790092b945b5e6acd44089386a)
http://code.google.com/p/sipservlets/source/detail?r=5168de1351d9
Modified:
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionImpl.java
/sip-servlets-test-suite/applications/simple-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/SimpleSipServlet.java
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/TestSipListener.java
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/ShootmeSipServletTest.java
=======================================
---
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionImpl.java
Fri Apr 25 14:45:43 2014 UTC
+++
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionImpl.java
Tue Apr 29 20:37:41 2014 UTC
@@ -1590,7 +1590,9 @@
}
}
}
- if(((State.CONFIRMED.equals(state) || State.TERMINATED.equals(state)) &&
response.getStatus() >= 200 && Request.BYE.equals(method))
+ if(((State.CONFIRMED.equals(state) || State.TERMINATED.equals(state)) &&
response.getStatus() >= 200 && Request.BYE.equals(method)
+ //
https://code.google.com/p/sipservlets/issues/detail?id=194
+ && response.getStatus() != 407 && response.getStatus()
!= 401)
//
http://code.google.com/p/mobicents/issues/detail?id=1438
// Sip Session become TERMINATED after receiving 487 response to
subsequent request => !confirmed clause added
|| (!State.CONFIRMED.equals(state) &&
response.getStatus() == 487)) {
=======================================
---
/sip-servlets-test-suite/applications/simple-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/SimpleSipServlet.java
Fri Apr 25 16:34:22 2014 UTC
+++
/sip-servlets-test-suite/applications/simple-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/SimpleSipServlet.java
Tue Apr 29 20:37:41 2014 UTC
@@ -669,6 +669,11 @@
if(response.getStatus() == SipServletResponse.SC_UNAUTHORIZED ||
response.getStatus() ==
SipServletResponse.SC_PROXY_AUTHENTICATION_REQUIRED) {
+ if(response.getMethod().equalsIgnoreCase("BYE")) {
+ //
https://code.google.com/p/sipservlets/issues/detail?id=194
+ sendMessage(sipFactory.createApplicationSession(), sipFactory,
response.getSession().getState().toString(), null);
+ return;
+ }
// Avoid re-sending if the auth repeatedly fails.
if(!"true".equals(getServletContext().getAttribute("FirstResponseRecieved")))
{
=======================================
---
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/TestSipListener.java
Fri Apr 25 13:46:46 2014 UTC
+++
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/TestSipListener.java
Tue Apr 29 20:37:41 2014 UTC
@@ -1,23 +1,20 @@
/*
- * TeleStax, Open Source Cloud Communications Copyright 2012.
- * 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.testsuite;
@@ -119,6 +116,7 @@
private static final String APPLICATION_CONTENT_TYPE = "application";
private boolean sendBye;
+ private int byeResponse = 200;
public int bindings;
@@ -1542,10 +1540,10 @@
Dialog dialog = serverTransactionId.getDialog();
logger.info("Dialog State = " + dialog.getState());
Response response =
protocolObjects.messageFactory.createResponse(
- 200, request);
+ byeResponse, request);
serverTransactionId.sendResponse(response);
this.transactionCount++;
- logger.info("shootist: Sending OK.");
+ logger.info("shootist: Sending " + byeResponse + " to
BYE.");
logger.info("Dialog State = " + dialog.getState());
} catch (Exception ex) {
@@ -3459,4 +3457,12 @@
public void setToTag(String toTag) {
this.toTag = toTag;
}
+
+ public int getByeResponse() {
+ return byeResponse;
+ }
+
+ public void setByeResponse(int byeResponse) {
+ this.byeResponse = byeResponse;
+ }
}
=======================================
---
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/ShootmeSipServletTest.java
Fri Apr 25 16:34:22 2014 UTC
+++
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/ShootmeSipServletTest.java
Tue Apr 29 20:37:41 2014 UTC
@@ -803,6 +803,32 @@
assertTrue(sender.isAckSent());
assertTrue(sender.getByeReceived());
}
+
+ /*
+ * https://code.google.com/p/sipservlets/issues/detail?id=194
+ */
+ public void testShootmeSendBye407Terminated() throws
InterruptedException, SipException, ParseException,
InvalidArgumentException {
+ String fromName = "SSsendBye";
+ String fromSipAddress = "sip-servlets.com";
+ SipURI fromAddress =
senderProtocolObjects.addressFactory.createSipURI(
+ fromName, fromSipAddress);
+
+ String toUser = "receiver";
+ String toSipAddress = "sip-servlets.com";
+ SipURI toAddress =
senderProtocolObjects.addressFactory.createSipURI(
+ toUser, toSipAddress);
+
+ sender.setByeResponse(407);
+ sender.setSendBye(false);
+ sender.sendSipRequest("INVITE", fromAddress, toAddress, null,
null, false);
+ Thread.sleep(TIMEOUT * 2);
+ assertTrue(sender.isAckSent());
+ assertTrue(sender.getByeReceived());
+ Thread.sleep(TIMEOUT);
+ List<String> allMessagesContent = sender.getAllMessagesContent();
+ assertEquals(1,allMessagesContent.size());
+ assertEquals("CONFIRMED", allMessagesContent.get(0));
+ }
@Override
@After
--
---
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.