Revision: 113690ba2012
Author:   Vladimir Ralev <[email protected]>
Date:     Fri May 25 13:40:13 2012
Log:      Update Issue 107

Backporting to TelScale branch

Fix for master(cherry picked from commit ce4239a31a04d9f99a3f6c614ee6550ab35e7f78)

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

Modified:
/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyUtils.java

=======================================
--- /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java Thu May 17 19:47:15 2012 +++ /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java Fri May 25 13:40:13 2012
@@ -800,7 +800,7 @@
                }

                if(logger.isDebugEnabled()) {
-                       logger.debug("Getting new Client Tx for request " + 
clonedRequest);
+ logger.debug("Getting new Client Tx for request " + clonedRequest + "\n transport = " + transport);
                }
                // we mark them as accessed so that HA replication can occur
                sipSession.access();
=======================================
--- /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyUtils.java Fri May 25 08:58:30 2012 +++ /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyUtils.java Fri May 25 13:40:13 2012
@@ -80,19 +80,25 @@

RouteHeader rHeader = (RouteHeader) clonedRequest.getHeader(RouteHeader.NAME);
                        if(rHeader != null) {
- outboundTransport = ((javax.sip.address.SipURI)rHeader.getAddress().getURI()).getTransportParam(); String nextApp = ((javax.sip.address.SipURI)rHeader.getAddress().getURI()).getParameter(MessageDispatcher.RR_PARAM_APPLICATION_NAME);
                                if(nextApp != null) {
final MobicentsSipApplicationSessionKey sipAppKey = originalRequest.getSipSession().getSipApplicationSession().getKey(); - final String thisApp = sipFactoryImpl.getSipApplicationDispatcher().getHashFromApplicationName(sipAppKey.getApplicationName());
-                                       if(outboundTransport == null) {
-                                               outboundTransport = 
ListeningPoint.UDP;
-                                       }
+ final String thisApp = sipFactoryImpl.getSipApplicationDispatcher().getHashFromApplicationName(sipAppKey.getApplicationName());
+
                                        if(nextApp.equals(thisApp)) {
                                                
clonedRequest.removeHeader(RouteHeader.NAME);
                                        }
-                               }
-                       } else {
+                                       rHeader = (RouteHeader) 
clonedRequest.getHeader(RouteHeader.NAME);
+                               }
+                               if(rHeader != null) {
+ outboundTransport = ((javax.sip.address.SipURI)rHeader.getAddress().getURI()).getTransportParam();
+                                       if(outboundTransport == null) {
+                                               outboundTransport = 
ListeningPoint.UDP;
+                                       }
+                               }
+
+                       }
+                       if(outboundTransport == null) {
                                // Fix for Issue 2783 : Proxying to non-UDP 
transport is broken
                                if(clonedRequest.getRequestURI().isSipURI()) {
outboundTransport = ((javax.sip.address.SipURI)clonedRequest.getRequestURI()).getTransportParam();
@@ -108,9 +114,16 @@
                        }

                        if(outboundTransport == null) outboundTransport = 
ListeningPoint.UDP;
-
- String inboundTransport = ((ViaHeader)clonedRequest.getHeader(Via.NAME)).getTransport();
+
+                       
((MessageExt)clonedRequest).setApplicationData(outboundTransport);
+
+                       Via via = ((Via)clonedRequest.getHeader(Via.NAME));
+                       String inboundTransport = via.getTransport();
                        if(inboundTransport == null) inboundTransport = 
ListeningPoint.UDP;
+
+                       if(logger.isDebugEnabled()) {
+ logger.debug("Outbound transport = " + outboundTransport + " inbountTransport = " + inboundTransport);
+                       }

                        /*
                         * The outbound transport has nothing to do with 
outbound interface
@@ -211,11 +224,8 @@
final MobicentsSipApplicationSessionKey sipAppKey = originalRequest.getSipSession().getSipApplicationSession().getKey(); final String appName = sipFactoryImpl.getSipApplicationDispatcher().getHashFromApplicationName(sipAppKey.getApplicationName()); final SipServletRequestImpl proxyBranchMatchingRequest = (SipServletRequestImpl) proxyBranch.getMatchingRequest(originalRequest);
-                       //Add via header
-                       if(outboundTransport == null && destination != null) {
-                               outboundTransport = 
destination.getParameter("transport");
-                       }
-
+
+                       //Add via header
                        if(proxy.getOutboundInterface() == null) {
                                String branchId = null;

@@ -259,10 +269,6 @@

                        clonedRequest.addHeader(proxyBranch.viaHeader);

-                       if(outboundTransport == null) outboundTransport = 
ListeningPoint.UDP;
-
-                       
((MessageExt)clonedRequest).setApplicationData(outboundTransport);
-
                        // Correction for misbehaving clients and unit testing
                        if(clonedRequest.getHeader(RouteHeader.NAME) == null) {
                                if(clonedRequest.getRequestURI().isSipURI()) {
@@ -298,9 +304,9 @@
                                        inboundRURI.setLrParam();

                                        final Address rraddress = 
SipFactoryImpl.addressFactory
-                                               .createAddress(null, 
inboundRURI);
+                                       .createAddress(null, inboundRURI);
final RecordRouteHeader recordRouteHeader = SipFactoryImpl.headerFactory
-                                               
.createRecordRouteHeader(rraddress);
+                                       .createRecordRouteHeader(rraddress);

                                        
clonedRequest.addFirst(recordRouteHeader);
                                }

Reply via email to