Revision: 20769
Author:   [email protected]
Date:     Wed Oct 12 05:51:16 2011
Log:      Update Issue 2254

Integrating Jonas contributions. Support for ob parameter in a B2BUA use case + non regression test
http://code.google.com/p/mobicents/source/detail?r=20769

Added:
/trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/rfc5626/CallForwardingB2BUAReInviteRFC5626JunitTest.java
Modified:
 /trunk/servers/sip-servlets/sip-servlets-catalina-7/.classpath
/trunk/servers/sip-servlets/sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/session/MobicentsSipSession.java /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/InitialRequestDispatcher.java /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/MessageDispatcher.java /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionImpl.java /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/MobicentsSipSessionFacade.java /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletRequestImpl.java /trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/TestSipListener.java
 /trunk/servers/sip-servlets/tomcat-7/.classpath

=======================================
--- /dev/null
+++ /trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/rfc5626/CallForwardingB2BUAReInviteRFC5626JunitTest.java Wed Oct 12 05:51:16 2011
@@ -0,0 +1,145 @@
+/*
+ * 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.
+ *
+ * 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
+ * the License, or (at your option) any later version.
+ *
+ * This software 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.
+ *
+ * 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.
+ */
+
+package org.mobicents.servlet.sip.testsuite.simple.rfc5626;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.sip.SipProvider;
+import javax.sip.address.SipURI;
+import javax.sip.header.Header;
+import javax.sip.header.MaxForwardsHeader;
+import javax.sip.message.Response;
+
+import org.apache.log4j.Logger;
+import org.mobicents.servlet.sip.SipServletTestCase;
+import org.mobicents.servlet.sip.testsuite.ProtocolObjects;
+import org.mobicents.servlet.sip.testsuite.TestSipListener;
+
+/*
+ *
+ * Added for Issue 1409 http://code.google.com/p/mobicents/issues/detail?id=1409
+ */
+public class CallForwardingB2BUAReInviteRFC5626JunitTest extends SipServletTestCase {
+
+ private static transient Logger logger = Logger.getLogger(CallForwardingB2BUAReInviteRFC5626JunitTest.class);
+
+       private static final String TRANSPORT = "tcp";
+       private static final boolean AUTODIALOG = true;
+       private static final int TIMEOUT = 20000;
+//     private static final int TIMEOUT = 100000000;
+
+       TestSipListener sender;
+       TestSipListener receiver;
+       ProtocolObjects senderProtocolObjects;
+       ProtocolObjects receiverProtocolObjects;
+
+       public CallForwardingB2BUAReInviteRFC5626JunitTest(String name) {
+               super(name);
+               listeningPointTransport = TRANSPORT;
+       }
+
+       @Override
+       public void deployApplication() {
+               assertTrue(tomcat.deployContext(
+ projectHome + "/sip-servlets-test-suite/applications/call-forwarding-b2bua-servlet/src/main/sipapp",
+                               "sip-test-context",
+                               "sip-test"));
+       }
+
+       @Override
+       protected String getDarConfigurationFile() {
+               return "file:///"
+                               + projectHome
+                               + 
"/sip-servlets-test-suite/testsuite/src/test/resources/"
+ + "org/mobicents/servlet/sip/testsuite/callcontroller/call-forwarding-b2bua-servlet-dar.properties";
+       }
+
+       @Override
+       protected void setUp() throws Exception {
+               super.setUp();
+
+               senderProtocolObjects = new ProtocolObjects("forward-sender",
+                               "gov.nist", TRANSPORT, AUTODIALOG, null, null, 
null);
+               receiverProtocolObjects = new ProtocolObjects("receiver",
+                               "gov.nist", TRANSPORT, AUTODIALOG, null, null, 
null);
+       }
+
+       public void testCallForwardingCallerSendBye() throws Exception {
+               sender = new TestSipListener(5080, 5070, senderProtocolObjects, 
false);
+               SipProvider senderProvider = sender.createProvider();
+
+ receiver = new TestSipListener(5090, 5070, receiverProtocolObjects, false);
+               receiver.setSendReinvite(true);
+               SipProvider receiverProvider = receiver.createProvider();
+
+               receiverProvider.addSipListener(receiver);
+               senderProvider.addSipListener(sender);
+
+               senderProtocolObjects.start();
+               receiverProtocolObjects.start();
+
+               String fromName = "forward-tcp-sender";
+               String fromSipAddress = "sip-servlets.com";
+               SipURI fromAddress = 
senderProtocolObjects.addressFactory.createSipURI(
+                               fromName, fromSipAddress);
+
+               String toSipAddress = "sip-servlets.com";
+               String toUser = "receiver";
+               SipURI toAddress = 
senderProtocolObjects.addressFactory.createSipURI(
+                               toUser, toSipAddress);
+
+               sender.setRFC5626Support(true);
+ sender.sendSipRequest("INVITE", fromAddress, toAddress, null, null, false);
+               Thread.sleep(TIMEOUT);
+               assertTrue(sender.isInviteReceived());
+               assertTrue(sender.isAckReceived());
+               assertNotNull(sender.getInviteRequest().getHeader("ReInvite"));
+ MaxForwardsHeader maxForwardsHeader = (MaxForwardsHeader) receiver.getInviteRequest().getHeader(MaxForwardsHeader.NAME);
+               assertNotNull(maxForwardsHeader);
+ // Non Regression test for http://code.google.com/p/mobicents/issues/detail?id=1490
+               // B2buaHelper.createRequest does not decrement Max-forwards
+               assertEquals(69, maxForwardsHeader.getMaxForwards());
+               sender.sendInDialogSipRequest("BYE", null, null, null, null, 
null);
+               Thread.sleep(TIMEOUT);
+               assertTrue(receiver.getByeReceived());
+               assertTrue(sender.getOkToByeReceived());
+ assertEquals(1,sender.bindings); //http://code.google.com/p/mobicents/issues/detail?id=2100 + maxForwardsHeader = (MaxForwardsHeader) receiver.getByeRequestReceived().getHeader(MaxForwardsHeader.NAME);
+               assertNotNull(maxForwardsHeader);
+ // Non Regression test for http://code.google.com/p/mobicents/issues/detail?id=1490
+               // B2buaHelper.createRequest does not decrement Max-forwards
+               assertEquals(69, maxForwardsHeader.getMaxForwards());
+       }
+
+       @Override
+       protected void tearDown() throws Exception {
+               senderProtocolObjects.destroy();
+               receiverProtocolObjects.destroy();
+               logger.info("Test completed");
+               super.tearDown();
+       }
+
+
+}
=======================================
--- /trunk/servers/sip-servlets/sip-servlets-catalina-7/.classpath Thu Oct 6 12:04:00 2011 +++ /trunk/servers/sip-servlets/sip-servlets-catalina-7/.classpath Wed Oct 12 05:51:16 2011
@@ -12,12 +12,12 @@
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/> <classpathentry kind="var" path="M2_REPO/javax/sip/jain-sip-api/1.2/jain-sip-api-1.2.jar" sourcepath="/M2_REPO/javax/sip/jain-sip-ri/1.2.X-SNAPSHOT/jain-sip-ri-1.2.X-SNAPSHOT-sources.jar"/> <classpathentry kind="var" path="M2_REPO/org/mobicents/ha/javax/sip/mobicents-jain-sip-ha-core/1.4.0-SNAPSHOT/mobicents-jain-sip-ha-core-1.4.0-SNAPSHOT.jar"/> - <classpathentry kind="var" path="M2_REPO/org/mobicents/javax/sip/mobicents-jain-sip-ext/1.1-SNAPSHOT/mobicents-jain-sip-ext-1.1-SNAPSHOT.jar"/>
        <classpathentry kind="src" path="/sip-servlets-spec"/>
<classpathentry combineaccessrules="false" kind="src" path="/sip-servlets-core-api"/> <classpathentry combineaccessrules="false" kind="src" path="/sip-servlets-annotations"/> <classpathentry combineaccessrules="false" kind="src" path="/sip-servlets-client"/> <classpathentry combineaccessrules="false" kind="src" path="/sip-servlets-impl"/>
        <classpathentry combineaccessrules="false" kind="src" path="/jain-sip"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jain-sip-ext"/>
        <classpathentry kind="output" path="target/classes"/>
 </classpath>
=======================================
--- /trunk/servers/sip-servlets/sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/session/MobicentsSipSession.java Tue Oct 4 20:25:16 2011 +++ /trunk/servers/sip-servlets/sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/session/MobicentsSipSession.java Wed Oct 12 05:51:16 2011
@@ -174,6 +174,17 @@

void setSipSessionSecurity(MobicentsSipSessionSecurity sipSessionSecurity);
        MobicentsSipSessionSecurity getSipSessionSecurity();
+
+       /**
+        * Associate a particular flow (see RFC5626) with this
+        * session.
+        *
+        * @param flow
+        */
+       public void setFlow(final javax.sip.address.SipURI flow);
+
+       public javax.sip.address.SipURI getFlow();
+
        public void setOrphan(boolean orphan);

        public boolean isOrphan();
=======================================
--- /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/InitialRequestDispatcher.java Tue Sep 13 13:23:18 2011 +++ /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/InitialRequestDispatcher.java Wed Oct 12 05:51:16 2011
@@ -48,6 +48,7 @@
 import javax.sip.SipException;
 import javax.sip.SipProvider;
 import javax.sip.address.Address;
+import javax.sip.header.ContactHeader;
 import javax.sip.address.URI;
 import javax.sip.header.CSeqHeader;
 import javax.sip.header.Header;
@@ -438,6 +439,8 @@
                ViaHeader via = (ViaHeader) request.getHeader(ViaHeader.NAME);
                sipSessionImpl.setTransport(via.getTransport());

+               handleSipOutbound(sipServletRequest);
+
// if the flag is set we bypass the executor. This flag should be made deprecated if(sipApplicationDispatcher.isBypassRequestExecutor() || ConcurrencyControlMode.Transaction.equals((sipContext.getConcurrencyControlMode()))) {
                        dispatchTask.dispatchAndHandleExceptions();
@@ -446,6 +449,59 @@
                }

        }
+
+
+       /**
+        * NOTE! This is only a partial implementation and will only work
+ * when we are acting as a UAS as per RFC 5626 Section 4.3. Sending Non-REGISTER Requests. + * Need to add some more logic for proxy scenarios. See RFC 5626 for exact details.
+        *
+        * The purpose of this method is to examine the request in an effort
+        * to determine if the logic of RFC 5626 should be applied. I.e., should
+ * we create and store a "flow" for this request so that subsequent requests
+        * will use the same connection as they "arrived" on.
+        *
+        * @param request
+        */
+ private void handleSipOutbound(final SipServletRequestImpl sipServletRequest) {
+
+               // if this is not a dialog creating request, then bail out 
right away
+ if (!JainSipUtils.DIALOG_CREATING_METHODS.contains(sipServletRequest.getMethod())) {
+                       return;
+               }
+
+               final Request request = (Request) 
sipServletRequest.getMessage();
+ final ContactHeader contact = (ContactHeader) request.getHeader(ContactHeader.NAME);
+
+               final URI requestUri = request.getRequestURI();
+
+               //
+ if ((contact != null && contact.getAddress().getURI() instanceof Parameters && ((Parameters)contact.getAddress().getURI()).getParameter(SIP_OUTBOUND_PARAM_OB) != null)) {
+                       final String remoteHost = 
sipServletRequest.getRemoteAddr();
+                       final int remotePort = 
sipServletRequest.getRemotePort();
+                       final String transport = 
sipServletRequest.getTransport();
+ final MobicentsSipSession sipSessionImpl = sipServletRequest.getSipSession();
+
+                       try {
+ final javax.sip.address.SipURI flowURI = SipFactoryImpl.addressFactory.createSipURI(null, remoteHost);
+                               flowURI.setPort(remotePort);
+                               flowURI.setTransportParam(transport);
+
+                               sipSessionImpl.setFlow(flowURI);
+                       } catch (final ParseException e) {
+                               logger.warn("Unable to create new flow URI from " + 
remoteHost + ":"
+ + remotePort + ";transport=" + transport + " due to a parse exception");
+                       }
+ } else if(sipServletRequest.getPoppedRouteHeader() != null && (requestUri instanceof javax.sip.address.SipURI && ((javax.sip.address.SipURI)requestUri).getParameter(SIP_OUTBOUND_PARAM_OB) != null)) {
+                       // If there is a route on the request, then we are 
acting as a proxy
+ final javax.sip.address.SipURI poppedURI = (javax.sip.address.SipURI) sipServletRequest.getPoppedRouteHeader().getAddress().getURI();
+                       String flowToken = poppedURI.getUser();
+ //TODO validate flow token and information and check it against session flow token
+                       // See Section 5.3
+                       return;
+               }
+       }
+

        /**
         * Dispatch a request outside the container
=======================================
--- /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/MessageDispatcher.java Tue Oct 4 20:25:16 2011 +++ /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/dispatchers/MessageDispatcher.java Wed Oct 12 05:51:16 2011
@@ -99,6 +99,18 @@


        protected SipApplicationDispatcher sipApplicationDispatcher = null;
+
+       /**
+        * From RFC 5626:
+        *
+        * "The "ob" parameter is a SIP URI parameter that has a different 
meaning
+        * depending on context. In a Path header field value, it is used by the
+ * first edge proxy to indicate that a flow token was added to the URI. In a + * Contact or Route header field value, it indicates that the UA would like
+        * other requests in the same dialog to be routed over the same flow."
+        *
+        */
+       public static final String SIP_OUTBOUND_PARAM_OB = "ob";

        public MessageDispatcher() {}

=======================================
--- /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionImpl.java Tue Oct 4 20:25:16 2011 +++ /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionImpl.java Wed Oct 12 05:51:16 2011
@@ -283,6 +283,23 @@
// Added for Issue 2173 http://code.google.com/p/mobicents/issues/detail?id=2173 // Handle Header [Authentication-Info: nextnonce="xyz"] in sip authorization responses
        protected transient MobicentsSipSessionSecurity sipSessionSecurity;
+
+       /**
+        * This is the flow for this session, i.e., this uri represents the
+        * remote destination from where the request actually was received on.
+        * We will use this this "flow" whenever we send out a subsequent
+        * request to this destination. See RFC5626 for details.
+        *
+        * TODO: in a fail-over scenario, should we keep this uri? If e.g. this
+        * flow is a TCP connection, that connection will of course not be
+ * failed over to the other server, which then would cause us to not (depending + * on the NAT) be able to connect to the remote client anyway. On the other hand + * if this is a nice NAT we will be able to get through so at least we have + * a chance of reconnecting as opposed to having the complete wrong address.
+        * So for now, I'll keep the flow around.
+        */
+       private javax.sip.address.SipURI flow;
+

protected SipSessionImpl (SipSessionKey key, SipFactoryImpl sipFactoryImpl, MobicentsSipApplicationSession mobicentsSipApplicationSession) {
                this.key = key;
@@ -2329,6 +2346,22 @@
                }
        }

+       /*
+        * (non-Javadoc)
+ * @see org.mobicents.servlet.sip.core.session.MobicentsSipSession#setFlow(javax.sip.address.SipURI)
+        */
+       public void setFlow(final javax.sip.address.SipURI flow) {
+               this.flow = flow;
+       }
+
+       /*
+        * (non-Javadoc)
+ * @see org.mobicents.servlet.sip.core.session.MobicentsSipSession#getFlow()
+        */
+       public javax.sip.address.SipURI getFlow() {
+               return flow;
+       }
+
        protected boolean orphan = false;

        public boolean isOrphan() {
=======================================
--- /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/MobicentsSipSessionFacade.java Tue Oct 4 20:25:16 2011 +++ /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/MobicentsSipSessionFacade.java Wed Oct 12 05:51:16 2011
@@ -510,6 +510,15 @@
        public void release() {
                sipSession.release();
        }
+
+       public void setFlow(final javax.sip.address.SipURI flow) {
+               this.sipSession.setFlow(flow);
+       }
+
+       public javax.sip.address.SipURI getFlow() {
+               return this.sipSession.getFlow();
+       }
+
        protected boolean orphan = false;

        public boolean isOrphan() {
@@ -519,5 +528,4 @@
        public void setOrphan(boolean orphan) {
                sipSession.setOrphan(orphan);
        }
-
-}
+}
=======================================
--- /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletRequestImpl.java Tue Oct 11 02:25:16 2011 +++ /trunk/servers/sip-servlets/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletRequestImpl.java Wed Oct 12 05:51:16 2011
@@ -49,7 +49,6 @@
 import java.util.Set;
 import java.util.Vector;

-import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletInputStream;
 import javax.servlet.sip.Address;
 import javax.servlet.sip.AuthInfo;
@@ -901,8 +900,8 @@
        /**
         * {@inheritDoc}
         */
-       public RequestDispatcher getRequestDispatcher(String handler) {
-               MobicentsSipServlet sipServletImpl = (MobicentsSipServlet)
+ public javax.servlet.RequestDispatcher getRequestDispatcher(String handler) {
+               MobicentsSipServlet sipServletImpl = (MobicentsSipServlet)
getSipSession().getSipApplicationSession().getSipContext().findSipServletByName(handler);
                if(sipServletImpl == null) {
throw new IllegalArgumentException(handler + " is not a valid servlet name");
@@ -961,7 +960,16 @@
RouteHeader routeHeader = (RouteHeader) request.getHeader(RouteHeader.NAME);
                                if(routeHeader != null) {
                                        uriToResolve = 
routeHeader.getAddress().getURI();
-                               }
+                               } else {
+                                       // RFC5626 - see if we are to find a 
flow for this request.
+                                       // Note: we should do this even if the 
"uriToResolve" is coming
+                                       // from a route header but since we 
currently have not implemented
+                                       // the correct things for a proxy 
scenario, only do it for UAS
+                                       // scenarios. At least this will 
minimize the potential for messing
+                                       // up right now...
+                                       uriToResolve = 
resolveSipOutbound(uriToResolve);
+                               }
+
if(session.getTransport() != null && uriToResolve.isSipURI() && ((javax.sip.address.SipURI)uriToResolve).getTransportParam() == null && // no need to modify the Request URI for UDP which is the default transport
                                                
!session.getTransport().equalsIgnoreCase(ListeningPoint.UDP)) {
@@ -981,6 +989,39 @@
                }
                send(hop);
        }
+
+
+       /**
+ * Check to see if the uri to resolve contains a "ob" parameter and if so, try
+        * and locate a "flow" for this uri.
+        *
+        * This is part of the RFC5626 implementation
+        *
+        * @param uriToResolve
+        * @return the flow uri or if no flow was found, the same uri
+        * that was passed into the method
+        */
+ private javax.sip.address.URI resolveSipOutbound(final javax.sip.address.URI uriToResolve) {
+               if (!uriToResolve.isSipURI()) {
+                       return uriToResolve;
+               }
+
+ final javax.sip.address.SipURI sipURI = (javax.sip.address.SipURI) uriToResolve; + if (sipURI.getParameter(MessageDispatcher.SIP_OUTBOUND_PARAM_OB) == null) {
+                       // no ob parameter, return
+                       return uriToResolve;
+               }
+               final MobicentsSipSession session = getSipSession();
+               final javax.sip.address.SipURI flow = session.getFlow();
+               if (flow != null) {
+                       if (logger.isDebugEnabled()) {
+ logger.debug("Found a flow \"" + flow + "\" for the original uri \"" + uriToResolve + "\"");
+                       }
+                       return flow;
+               }
+
+               return uriToResolve;
+       }

        public void send(Hop hop) throws IOException {
                final Request request = (Request) super.message;
@@ -1032,7 +1073,7 @@
logger.debug("The found transport for sending request is '" + transport + "'");
                        }

- SipConnector sipConnector = StaticServiceHolder.sipStandardService.findSipConnector(transport); + SipConnector sipConnector = StaticServiceHolder.sipStandardService.findSipConnector(transport); MobicentsExtendedListeningPoint matchingListeningPoint = sipNetworkInterfaceManager.findMatchingListeningPoint(
                                        transport, false);
                        final SipProvider sipProvider = 
matchingListeningPoint.getSipProvider();
=======================================
--- /trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/TestSipListener.java Thu Sep 8 02:20:56 2011 +++ /trunk/servers/sip-servlets/sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/TestSipListener.java Wed Oct 12 05:51:16 2011
@@ -336,6 +336,8 @@
        private Request infoRequest;

        private boolean addRecordRouteForResponses;
+
+       private boolean isRFC5626Support;

        class MyEventSource implements Runnable {
                private TestSipListener notifier;
@@ -1527,7 +1529,11 @@
                                List<Header> headers = new ArrayList<Header>();
Header reinviteHeader = protocolObjects.headerFactory.createHeader("ReInvite", "true");
                                headers.add(reinviteHeader);
-                               sendInDialogSipRequest("INVITE", null, null, 
null, headers, null);
+                               String transport = null;
+                               if(ackRequest.getRequestURI() instanceof 
SipURI) {
+                                       transport = 
((SipURI)ackRequest.getRequestURI()).getTransportParam();
+                               }
+                               sendInDialogSipRequest("INVITE", null, null, 
null, headers, transport);
                                reinviteSent = true;
                                return;
                        }
@@ -2098,7 +2104,13 @@
.createViaHeader("" + System.getProperty("org.mobicents.testsuite.testhostaddr") + "", sipProvider .getListeningPoint(protocolObjects.transport).getPort(), listeningPoint.getTransport(),
                                                null);
-
+               if(isRFC5626Support) {
+                       //try to bind to non existing IP
+                        viaHeader = protocolObjects.headerFactory
+                               .createViaHeader("192.192.192.192", sipProvider
+ .getListeningPoint(protocolObjects.transport).getPort(), listeningPoint.getTransport(),
+                                               null);
+               }
                // add via headers
                viaHeaders.add(viaHeader);

@@ -2123,6 +2135,10 @@
                                fromHeader, toHeader, viaHeaders, maxForwards);
                // Create contact headers
String host = "" + System.getProperty("org.mobicents.testsuite.testhostaddr") + "";
+               if(isRFC5626Support) {
+                       //try to bind to non existing IP
+                        host = "192.192.192.192";
+               }
request.setHeader(protocolObjects.headerFactory.createHeader("REM", "RRRREM"));
                URI contactUrl = null;
                if(fromURI instanceof SipURI) {
@@ -2136,6 +2152,9 @@
                                
((SipURI)contactUrl).setTransportParam(listeningPoint.getTransport());
                                ((SipURI)contactUrl).setLrParam();
                        }
+                       if(isRFC5626Support) {
+                               ((SipURI)contactUrl).setParameter("ob", null);
+                       }
                } else {
                        contactUrl = fromURI;
                }
@@ -2529,6 +2548,8 @@

                addSpecificHeaders(method, message);
                message.removeHeader(ViaHeader.NAME);
+               logger.info("in dialog message = " + message);
+
ClientTransaction clientTransaction = sipProvider.getNewClientTransaction(message);
                if(method.equals("INVITE")) {
                        inviteClientTid = clientTransaction;
@@ -3236,4 +3257,8 @@
        public boolean isAddRecordRouteForResponses() {
                return addRecordRouteForResponses;
        }
-}
+
+       public void setRFC5626Support(boolean isRFC5626Support) {
+               this.isRFC5626Support = isRFC5626Support;
+       }
+}
=======================================
--- /trunk/servers/sip-servlets/tomcat-7/.classpath     Thu Oct  6 12:04:00 2011
+++ /trunk/servers/sip-servlets/tomcat-7/.classpath     Wed Oct 12 05:51:16 2011
@@ -16,7 +16,6 @@
<classpathentry kind="var" path="M2_REPO/org/apache/tomcat/tomcat-util/7.0.14/tomcat-util-7.0.14.jar"/> <classpathentry kind="var" path="M2_REPO/javax/sip/jain-sip-api/1.2/jain-sip-api-1.2.jar"/> <classpathentry kind="var" path="M2_REPO/javax/sip/jain-sip-ri/1.2.X-SNAPSHOT/jain-sip-ri-1.2.X-SNAPSHOT.jar"/> - <classpathentry kind="var" path="M2_REPO/org/mobicents/javax/sip/mobicents-jain-sip-ext/1.1-SNAPSHOT/mobicents-jain-sip-ext-1.1-SNAPSHOT.jar"/> <classpathentry combineaccessrules="false" kind="src" path="/sip-servlets-impl"/> <classpathentry combineaccessrules="false" kind="src" path="/sip-servlets-spec"/> <classpathentry combineaccessrules="false" kind="src" path="/sip-servlets-annotations"/>
@@ -25,5 +24,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry combineaccessrules="false" kind="src" path="/sip-servlets-core-api"/> <classpathentry combineaccessrules="false" kind="src" path="/sip-servlets-catalina-7"/> + <classpathentry combineaccessrules="false" kind="src" path="/jain-sip-ext"/>
        <classpathentry kind="output" path="target/classes"/>
 </classpath>

Reply via email to