Revision: f8fe7e1b1ee4
Author: Jean Deruelle <[email protected]>
Date: Fri Apr 18 10:10:51 2014 UTC
Log: Update Issue 264
Fix + Non regression test
http://code.google.com/p/sipservlets/source/detail?r=f8fe7e1b1ee4
Modified:
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SessionManagerUtil.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/SessionManagerUtil.java
Wed Apr 17 13:38:36 2013 UTC
+++
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SessionManagerUtil.java
Fri Apr 18 10:10:51 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.core.session;
@@ -50,7 +47,8 @@
private static final Logger logger =
Logger.getLogger(SessionManagerUtil.class);
public final static String TAG_PARAMETER_NAME = "tag";
- public final static String SESSION_KEY_SEPARATOR = ":";
+ // https://code.google.com/p/sipservlets/issues/detail?id=264 replaced
colon by semicolon as semicolon is not allowed in CallID
+ public final static String SESSION_KEY_SEPARATOR = ";";
/**
* Computes the sip session key from the input parameters. The sip
session
=======================================
---
/sip-servlets-test-suite/applications/simple-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/SimpleSipServlet.java
Thu Apr 17 20:06:02 2014 UTC
+++
/sip-servlets-test-suite/applications/simple-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/SimpleSipServlet.java
Fri Apr 18 10:10:51 2014 UTC
@@ -148,7 +148,12 @@
request.createResponse(SipServletResponse.SC_OK).send();
return;
}
-
+ String sipSessionId = request.getSession().getId();
+ SipSession sipSession =
request.getApplicationSession().getSipSession(sipSessionId);
+ if(sipSession == null ||
!sipSession.equals(request.getSession())) {
+ throw new RuntimeException("original sip session is " +
request.getSession() + " and retrieved sip session is " + sipSession);
+ }
+
logger.info("from : " + fromString);
logger.info("Got request: "
+ request.getMethod());
=======================================
---
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/TestSipListener.java
Fri Dec 14 17:38:28 2012 UTC
+++
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/TestSipListener.java
Fri Apr 18 10:10:51 2014 UTC
@@ -214,7 +214,7 @@
public int notifyCount = 0;
- public int numberOf491s = 0;
+ public int numberOf491s = 0;
private List<Integer> provisionalResponsesToSend;
@@ -2011,100 +2011,6 @@
}
return requestauth;
}
-
- public Request createInvite(String callId, long cseq) throws
ParseException,
- InvalidArgumentException {
- String fromName = "BigGuy";
- String fromSipAddress = "here.com";
- String fromDisplayName = "The Master Blaster";
-
- String toSipAddress = "there.com";
- String toUser = "LittleGuy";
- String toDisplayName = "The Little Blister";
-
- // create >From Header
- SipURI fromAddress =
protocolObjects.addressFactory.createSipURI(fromName,
- fromSipAddress);
-
- Address fromNameAddress =
protocolObjects.addressFactory.createAddress(fromAddress);
- fromNameAddress.setDisplayName(fromDisplayName);
- FromHeader fromHeader =
protocolObjects.headerFactory.createFromHeader(fromNameAddress,
- "12345");
-
- // create To Header
- SipURI toAddress = protocolObjects.addressFactory.createSipURI(toUser,
toSipAddress);
- Address toNameAddress =
protocolObjects.addressFactory.createAddress(toAddress);
- toNameAddress.setDisplayName(toDisplayName);
- ToHeader toHeader =
protocolObjects.headerFactory.createToHeader(toNameAddress, null);
-
- // create Request URI
- SipURI requestURI = protocolObjects.addressFactory.createSipURI(toUser,
peerHostPort);
-
- // Create ViaHeaders
- ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
- ViaHeader viaHeader = protocolObjects.headerFactory.createViaHeader("" +
System.getProperty("org.mobicents.testsuite.testhostaddr") + "",
- listeningPoint.getPort(),
listeningPoint.getTransport(),
- null);
- // add via headers
- viaHeaders.add(viaHeader);
-
- // Create ContentTypeHeader
- ContentTypeHeader contentTypeHeader =
protocolObjects.headerFactory
- .createContentTypeHeader("application", "sdp");
-
- // Create a new CallId header
- CallIdHeader callIdHeader;
- callIdHeader = sipProvider.getNewCallId();
- if (callId.trim().length() > 0)
- callIdHeader.setCallId(callId);
-
- // Create a new Cseq header
- CSeqHeader cSeqHeader =
protocolObjects.headerFactory.createCSeqHeader(cseq,
- Request.INVITE);
-
- // Create a new MaxForwardsHeader
- MaxForwardsHeader maxForwards = protocolObjects.headerFactory
- .createMaxForwardsHeader(70);
-
- // Create the request.
- Request request =
protocolObjects.messageFactory.createRequest(requestURI,
- Request.INVITE, callIdHeader, cSeqHeader,
fromHeader, toHeader,
- viaHeaders, maxForwards);
- // Create contact headers
- String host = "" +
System.getProperty("org.mobicents.testsuite.testhostaddr") + "";
-
- SipURI contactUrl =
protocolObjects.addressFactory.createSipURI(fromName, host);
- contactUrl.setPort(listeningPoint.getPort());
-
- // Create the contact name address.
- SipURI contactURI =
protocolObjects.addressFactory.createSipURI(fromName, host);
- contactURI.setPort(listeningPoint.getPort());
-
- Address contactAddress =
protocolObjects.addressFactory.createAddress(contactURI);
-
- // Add the contact address.
- contactAddress.setDisplayName(fromName);
-
- contactHeader =
protocolObjects.headerFactory.createContactHeader(contactAddress);
- request.addHeader(contactHeader);
-
- String sdpData = "v=0\r\n"
- + "o=4855 13760799956958020 13760799956958020"
- + " IN IP4 129.6.55.78\r\n" + "s=mysession
session\r\n"
- + "p=+46 8 52018010\r\n" + "c=IN IP4
129.6.55.78\r\n"
- + "t=0 0\r\n" + "m=audio 6022 RTP/AVP 0 4
18\r\n"
- + "a=rtpmap:0 PCMU/8000\r\n" + "a=rtpmap:4
G723/8000\r\n"
- + "a=rtpmap:18 G729A/8000\r\n" +
"a=ptime:20\r\n";
- byte[] contents = sdpData.getBytes();
-
- request.setContent(contents, contentTypeHeader);
-
- Header callInfoHeader =
protocolObjects.headerFactory.createHeader("Call-Info",
- "<http://www.antd.nist.gov>");
- request.addHeader(callInfoHeader);
-
- return request;
- }
/**
* @throws SipException
@@ -2322,6 +2228,9 @@
Header h = null;
if(headerNames[q].equalsIgnoreCase(AllowHeader.NAME)) {
h =
protocolObjects.headerFactory.createAllowHeader(headerContents[q]);
+ } else
if(headerNames[q].equalsIgnoreCase(CallIdHeader.NAME)) {
+
callIdHeader.setCallId(headerContents[q]);
+ h = callIdHeader;
} else {
h = protocolObjects.headerFactory.createHeader(headerNames[q],
headerContents[q]);
}
@@ -2333,6 +2242,7 @@
}
}
addSpecificHeaders(method, request);
+ logger.debug("getting new client tx for request = " + request);
// Create the client transaction.
inviteClientTid = sipProvider.getNewClientTransaction(request);
// send the request out.
=======================================
---
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/ShootmeSipServletTest.java
Thu Apr 17 20:06:02 2014 UTC
+++
/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/ShootmeSipServletTest.java
Fri Apr 18 10:10:51 2014 UTC
@@ -27,6 +27,7 @@
import java.util.List;
import java.util.ListIterator;
import java.util.Properties;
+import java.util.UUID;
import javax.sip.InvalidArgumentException;
import javax.sip.SipException;
@@ -134,6 +135,30 @@
Response response = sender.getFinalResponse();
assertNull(response.getHeader(ContactHeader.NAME));
}
+
+ /*
+ * https://code.google.com/p/sipservlets/issues/detail?id=264
+ */
+ public void testShootmeColumnInCallIdHeader() throws
InterruptedException, SipException, ParseException,
InvalidArgumentException {
+ String fromName = "sender";
+ 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.sendSipRequest("INVITE", fromAddress, toAddress, null, null,
false, new String[] {"Call-ID"}, new String[] {"jean:telestax:random:" +
UUID.randomUUID() + "@localhost"}, true);
+ Thread.sleep(TIMEOUT);
+ assertTrue(sender.isAckSent());
+ assertTrue(sender.getOkToByeReceived());
+ // test non regression for Issue 1687 : Contact Header is present in SIP
Message where it shouldn't
+ Response response = sender.getFinalResponse();
+ assertNull(response.getHeader(ContactHeader.NAME));
+ }
+
/*
* Non regression test for Issue 2115
http://code.google.com/p/mobicents/issues/detail?id=2115
* MSS unable to handle GenericURI URIs
--
---
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.