Revision: 6f1185356a13
Author:   Jean Deruelle <[email protected]>
Date:     Tue Apr 29 16:48:24 2014 UTC
Log:      Update Issue 170

Fix + non regression test

http://code.google.com/p/sipservlets/source/detail?r=6f1185356a13

Modified:
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/address/TelURLImpl.java /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletMessageImpl.java /sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ShootistSipServlet.java /sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/ShootistTelURLSipServletTest.java

=======================================
--- /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/address/TelURLImpl.java Tue Sep 13 20:23:18 2011 UTC +++ /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/address/TelURLImpl.java Tue Apr 29 16:48:24 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.address;
@@ -135,7 +132,8 @@
                String escapedValue = RFC2396UrlDecoder.encode(value);
                super.setParameter(name, value);
                try {
-                       telUrl.setParameter(name, escapedValue);
+                   // 
https://code.google.com/p/sipservlets/issues/detail?id=170
+ telUrl.setParameter(name, "".equals(escapedValue) ? null : escapedValue);
                } catch (ParseException e) {
                        throw new IllegalArgumentException("Problem setting 
parameter", e);
                }
=======================================
--- /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletMessageImpl.java Fri Apr 25 19:13:03 2014 UTC +++ /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipServletMessageImpl.java Tue Apr 29 16:48:24 2014 UTC
@@ -30,7 +30,6 @@
 import java.io.ObjectOutput;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
-import java.net.InetAddress;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Enumeration;
=======================================
--- /sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ShootistSipServlet.java Fri Apr 25 19:15:17 2014 UTC +++ /sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/java/org/mobicents/servlet/sip/testsuite/ShootistSipServlet.java Tue Apr 29 16:48:24 2014 UTC
@@ -325,6 +325,9 @@
                                        } catch (ServletParseException e) {
                                                logger.error("Impossible to create 
the tel URL", e);
                                        }
+                                       
if(ce.getServletContext().getInitParameter("flag") != null) {
+ toURI.setParameter(ce.getServletContext().getInitParameter("flag"), "");
+                                       }
                                        
if(ce.getServletContext().getInitParameter("enum") != null) {
DNSResolver dnsResolver = (DNSResolver) getServletContext().getAttribute("org.mobicents.servlet.sip.DNS_RESOLVER");
                                                toURI = 
dnsResolver.getSipURI(toURI);
=======================================
--- /sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/ShootistTelURLSipServletTest.java Thu Mar 22 15:13:18 2012 UTC +++ /sip-servlets-test-suite/testsuite/src/test/java/org/mobicents/servlet/sip/testsuite/simple/ShootistTelURLSipServletTest.java Tue Apr 29 16:48:24 2014 UTC
@@ -1,31 +1,34 @@
 /*
- * 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.testsuite.simple;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
 import javax.sip.SipProvider;
+import javax.sip.header.ToHeader;

 import org.apache.catalina.deploy.ApplicationParameter;
 import org.apache.log4j.Logger;
 import org.mobicents.servlet.sip.SipServletTestCase;
+import org.mobicents.servlet.sip.annotation.ConcurrencyControlMode;
 import org.mobicents.servlet.sip.catalina.SipStandardManager;
 import org.mobicents.servlet.sip.startup.SipContextConfig;
 import org.mobicents.servlet.sip.startup.SipStandardContext;
@@ -68,6 +71,40 @@
                context.addApplicationParameter(applicationParameter);
                assertTrue(tomcat.deployContext(context));
        }
+
+       public SipStandardContext deployApplication(String name, String value) {
+        SipStandardContext context = new SipStandardContext();
+ context.setDocBase(projectHome + "/sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/sipapp");
+        context.setName("sip-test-context");
+        context.setPath("/sip-test");
+        context.addLifecycleListener(new SipContextConfig());
+        context.setManager(new SipStandardManager());
+ context.setConcurrencyControlMode(ConcurrencyControlMode.SipApplicationSession); + ApplicationParameter applicationParameter = new ApplicationParameter();
+        applicationParameter.setName(name);
+        applicationParameter.setValue(value);
+        context.addApplicationParameter(applicationParameter);
+        assertTrue(tomcat.deployContext(context));
+        return context;
+    }
+
+ public SipStandardContext deployApplication(Map<String, String> params) {
+        SipStandardContext context = new SipStandardContext();
+ context.setDocBase(projectHome + "/sip-servlets-test-suite/applications/shootist-sip-servlet/src/main/sipapp");
+        context.setName("sip-test-context");
+        context.setPath("/sip-test");
+        context.addLifecycleListener(new SipContextConfig());
+ context.setConcurrencyControlMode(ConcurrencyControlMode.SipApplicationSession);
+        context.setManager(new SipStandardManager());
+        for (Entry<String, String> param : params.entrySet()) {
+ ApplicationParameter applicationParameter = new ApplicationParameter();
+            applicationParameter.setName(param.getKey());
+            applicationParameter.setValue(param.getValue());
+            context.addApplicationParameter(applicationParameter);
+        }
+        assertTrue(tomcat.deployContext(context));
+        return context;
+    }

        @Override
        protected String getDarConfigurationFile() {
@@ -97,6 +134,21 @@
                Thread.sleep(TIMEOUT);
                assertTrue(receiver.getByeReceived());
        }
+
+       /*
+        * https://code.google.com/p/sipservlets/issues/detail?id=170
+        */
+       public void testShootistTelURLFlagParameter() throws Exception {
+//      receiver.sendInvite();
+        tomcat.startTomcat();
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("urlType", "tel");
+        params.put("flag", "ndpi");
+        deployApplication(params);
+        Thread.sleep(TIMEOUT);
+ assertEquals("tel:+358-555-1234567;ndpi", ((ToHeader)receiver.getInviteRequest().getHeader(ToHeader.NAME)).getAddress().getURI().toString());
+        assertTrue(receiver.getByeReceived());
+    }

        public void testShootistTelURLAsSIP() throws Exception {
 //             receiver.sendInvite();

--

--- 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.

Reply via email to