2 new revisions:

Revision: a77fe8f86be3
Author:   Jean Deruelle <[email protected]>
Date:     Sat Dec  8 11:19:34 2012
Log:      Update Issue 180...
http://code.google.com/p/sipservlets/source/detail?r=a77fe8f86be3

Revision: 2cefaaa55cc0
Author:   Jean Deruelle <[email protected]>
Date:     Sat Dec  8 13:56:44 2012
Log:      Update Issue 180...
http://code.google.com/p/sipservlets/source/detail?r=2cefaaa55cc0

==============================================================================
Revision: a77fe8f86be3
Author:   Jean Deruelle <[email protected]>
Date:     Sat Dec  8 11:19:34 2012
Log:      Update Issue 180

Backport to TelScale : do the parsing once instead of on every request...

(cherry picked from commit 01e17cbcca3b9e0baf162427627231c34edb6736)

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

Modified:
/containers/sip-servlets-as7/src/main/java/org/mobicents/servlet/sip/catalina/SipStandardService.java /containers/sip-servlets-catalina-7/src/main/java/org/mobicents/servlet/sip/catalina/SipStandardService.java /sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/SipService.java /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipFactoryImpl.java

=======================================
--- /containers/sip-servlets-as7/src/main/java/org/mobicents/servlet/sip/catalina/SipStandardService.java Mon Sep 10 13:54:19 2012 +++ /containers/sip-servlets-as7/src/main/java/org/mobicents/servlet/sip/catalina/SipStandardService.java Sat Dec 8 11:19:34 2012
@@ -71,6 +71,7 @@
 import org.mobicents.servlet.sip.core.ExtendedListeningPoint;
 import org.mobicents.servlet.sip.core.MobicentsExtendedListeningPoint;
 import org.mobicents.servlet.sip.core.SipApplicationDispatcher;
+import org.mobicents.servlet.sip.core.message.OutboundProxy;
 import org.mobicents.servlet.sip.message.Servlet3SipServletMessageFactory;
 import org.mobicents.servlet.sip.startup.StaticServiceHolder;

@@ -113,7 +114,7 @@
        private int backToNormalSipMessageQueueSize = 1300;
        protected int memoryThreshold = 95;
        private int backToNormalMemoryThreshold = 90;
-       protected String outboundProxy;
+       protected OutboundProxy outboundProxy;
        protected long congestionControlCheckingInterval = 30000;
        private int canceledTimerTasksPurgePeriod = 0;
        // base timer interval for jain sip tx
@@ -897,13 +898,15 @@
        }


-       public String getOutboundProxy() {
+       public OutboundProxy getOutboundProxy() {
                return outboundProxy;
        }


        public void setOutboundProxy(String outboundProxy) {
-               this.outboundProxy = outboundProxy;
+               if(outboundProxy != null) {
+                       this.outboundProxy =  new OutboundProxy(outboundProxy);
+               }
        }

        public int getDispatcherThreadPoolSize() {
=======================================
--- /containers/sip-servlets-catalina-7/src/main/java/org/mobicents/servlet/sip/catalina/SipStandardService.java Tue Sep 11 15:38:28 2012 +++ /containers/sip-servlets-catalina-7/src/main/java/org/mobicents/servlet/sip/catalina/SipStandardService.java Sat Dec 8 11:19:34 2012
@@ -71,6 +71,7 @@
 import org.mobicents.servlet.sip.core.ExtendedListeningPoint;
 import org.mobicents.servlet.sip.core.MobicentsExtendedListeningPoint;
 import org.mobicents.servlet.sip.core.SipApplicationDispatcher;
+import org.mobicents.servlet.sip.core.message.OutboundProxy;
 import org.mobicents.servlet.sip.message.Servlet3SipServletMessageFactory;
 import org.mobicents.servlet.sip.startup.StaticServiceHolder;

@@ -113,7 +114,7 @@
        private int backToNormalSipMessageQueueSize = 1300;
        protected int memoryThreshold = 95;
        private int backToNormalMemoryThreshold = 90;
-       protected String outboundProxy;
+       protected OutboundProxy outboundProxy;
        protected long congestionControlCheckingInterval = 30000;
        private int canceledTimerTasksPurgePeriod = 0;
        // base timer interval for jain sip tx
@@ -893,13 +894,15 @@
        }


-       public String getOutboundProxy() {
+       public OutboundProxy getOutboundProxy() {
                return outboundProxy;
        }


        public void setOutboundProxy(String outboundProxy) {
-               this.outboundProxy = outboundProxy;
+               if(outboundProxy != null) {
+                       this.outboundProxy =  new OutboundProxy(outboundProxy);
+               }
        }

        public int getDispatcherThreadPoolSize() {
=======================================
--- /sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/SipService.java Fri May 25 05:43:04 2012 +++ /sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/SipService.java Sat Dec 8 11:19:34 2012
@@ -26,6 +26,7 @@

 import org.mobicents.ha.javax.sip.ReplicationStrategy;
 import org.mobicents.servlet.sip.SipConnector;
+import org.mobicents.servlet.sip.core.message.OutboundProxy;

 /**
  * This extends the definition of Service from tomcat interface to SIP.
@@ -60,7 +61,7 @@

        public boolean isHttpFollowsSip();
        public String getJvmRoute();
-       public String getOutboundProxy();
+       public OutboundProxy getOutboundProxy();
        public int getDispatcherThreadPoolSize();
        public int getCanceledTimerTasksPurgePeriod();
        public SipConnector[] findSipConnectors();
=======================================
--- /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipFactoryImpl.java Mon Aug 13 12:29:49 2012 +++ /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipFactoryImpl.java Sat Dec 8 11:19:34 2012
@@ -87,6 +87,7 @@
 import org.mobicents.servlet.sip.core.SipContext;
 import org.mobicents.servlet.sip.core.SipNetworkInterfaceManager;
 import org.mobicents.servlet.sip.core.dispatchers.MessageDispatcher;
+import org.mobicents.servlet.sip.core.message.OutboundProxy;
import org.mobicents.servlet.sip.core.session.MobicentsSipApplicationSession; import org.mobicents.servlet.sip.core.session.MobicentsSipApplicationSessionKey;
 import org.mobicents.servlet.sip.core.session.MobicentsSipSession;
@@ -875,16 +876,13 @@
                try {
                        String host = null;
                        int port = -1;
- String proxy = StaticServiceHolder.sipStandardService.getOutboundProxy(); + OutboundProxy proxy = StaticServiceHolder.sipStandardService.getOutboundProxy();
                        if(proxy == null) {
                                host = 
loadBalancerToUse.getAddress().getHostAddress();
                                port = loadBalancerToUse.getSipPort();
-                       } else {
-                               int separatorIndex = proxy.indexOf(":");
-                               if(separatorIndex>0) {
-                                       host = proxy.substring(0, 
separatorIndex);
-                                       port = 
Integer.parseInt(proxy.substring(separatorIndex + 1));
-                               }
+                       } else {
+                               host = proxy.getHost();
+                               port = proxy.getPort();
                        }
javax.sip.address.SipURI sipUri = SipFactoryImpl.addressFactory.createSipURI(null, host);
                        sipUri.setPort(port);
@@ -920,16 +918,13 @@
                try {
                        String host = null;
                        int port = -1;
- String proxy = StaticServiceHolder.sipStandardService.getOutboundProxy(); + OutboundProxy proxy = StaticServiceHolder.sipStandardService.getOutboundProxy();
                        if(proxy == null) {
                                host = lbhost;
                                port = lbport;
                        } else {
-                               int separatorIndex = proxy.indexOf(":");
-                               if(separatorIndex>0) {
-                                       host = proxy.substring(0, 
separatorIndex);
-                                       port = 
Integer.parseInt(proxy.substring(separatorIndex + 1));
-                               }
+                               host = proxy.getHost();
+                               port = proxy.getPort();
                        }
javax.sip.address.SipURI sipUri = SipFactoryImpl.addressFactory.createSipURI(null, host);
                        sipUri.setPort(port);

==============================================================================
Revision: 2cefaaa55cc0
Author:   Jean Deruelle <[email protected]>
Date:     Sat Dec  8 13:56:44 2012
Log:      Update Issue 180

Backport from master

Add logging and committing missing file
(cherry picked from commit 80de4200c35d523deb494bafa84268cd6b8ce4ef)

http://code.google.com/p/sipservlets/source/detail?r=2cefaaa55cc0

Added:
/sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/message/OutboundProxy.java
Modified:
/containers/sip-servlets-as7/src/main/java/org/mobicents/servlet/sip/catalina/SipStandardService.java /containers/sip-servlets-catalina-7/src/main/java/org/mobicents/servlet/sip/catalina/SipStandardService.java

=======================================
--- /dev/null
+++ /sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/message/OutboundProxy.java Sat Dec 8 13:56:44 2012
@@ -0,0 +1,70 @@
+/*
+ * TeleStax, Open Source Cloud Communications
+ * Copyright 2012 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
+ * 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.core.message;
+
+/**
+ * @author [email protected]
+ *
+ */
+public class OutboundProxy {
+
+       private String host = null;
+       private int port = 5060;
+
+       public OutboundProxy(String outboundProxy) {
+               int separatorIndex = outboundProxy.indexOf(":");
+               if(separatorIndex > 0) {
+                       host = outboundProxy.substring(0, separatorIndex);
+                       port = 
Integer.parseInt(outboundProxy.substring(separatorIndex + 1));
+               } else {
+                       host = outboundProxy;
+               }
+       }
+
+       /**
+        * @return the host
+        */
+       public String getHost() {
+               return host;
+       }
+       /**
+        * @param host the host to set
+        */
+       public void setHost(String host) {
+               this.host = host;
+       }
+       /**
+        * @return the port
+        */
+       public int getPort() {
+               return port;
+       }
+       /**
+        * @param port the port to set
+        */
+       public void setPort(int port) {
+               this.port = port;
+       }
+
+       @Override
+       public String toString() {
+               return host + ":" + port;
+       }
+}
=======================================
--- /containers/sip-servlets-as7/src/main/java/org/mobicents/servlet/sip/catalina/SipStandardService.java Sat Dec 8 11:19:34 2012 +++ /containers/sip-servlets-as7/src/main/java/org/mobicents/servlet/sip/catalina/SipStandardService.java Sat Dec 8 13:56:44 2012
@@ -906,6 +906,11 @@
        public void setOutboundProxy(String outboundProxy) {
                if(outboundProxy != null) {
                        this.outboundProxy =  new OutboundProxy(outboundProxy);
+               } else {
+                       this.outboundProxy = null;
+               }
+               if(logger.isDebugEnabled()) {
+                       logger.debug("Outbound Proxy : " + outboundProxy);
                }
        }

=======================================
--- /containers/sip-servlets-catalina-7/src/main/java/org/mobicents/servlet/sip/catalina/SipStandardService.java Sat Dec 8 11:19:34 2012 +++ /containers/sip-servlets-catalina-7/src/main/java/org/mobicents/servlet/sip/catalina/SipStandardService.java Sat Dec 8 13:56:44 2012
@@ -902,6 +902,11 @@
        public void setOutboundProxy(String outboundProxy) {
                if(outboundProxy != null) {
                        this.outboundProxy =  new OutboundProxy(outboundProxy);
+               } else {
+                       this.outboundProxy = null;
+               }
+               if(logger.isDebugEnabled()) {
+                       logger.debug("Outbound Proxy : " + outboundProxy);
                }
        }

Reply via email to