aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIngo Bauersachs <ingo@jitsi.org>2017-01-07 13:26:23 +0100
committerIngo Bauersachs <ingo@jitsi.org>2017-01-07 13:26:23 +0100
commitf8811b82ed6aa4d9f96fd3f93fcf126b13b38a72 (patch)
tree4787ddf64d9a1ec81740cb5522e94dfc917210e7 /src
parent9bc6e3dd88084753480fa7f4700d0fd47f04e0d2 (diff)
downloadjitsi-f8811b82ed6aa4d9f96fd3f93fcf126b13b38a72.zip
jitsi-f8811b82ed6aa4d9f96fd3f93fcf126b13b38a72.tar.gz
jitsi-f8811b82ed6aa4d9f96fd3f93fcf126b13b38a72.tar.bz2
Ignore any routes in the SIP header when an outbound proxy is used
If this isn't done, the next Hop will be DNS resolved to - a foreign address - another address than to which the account is currently connected - not resolved at all (e.g. an internal name behind the proxy)
Diffstat (limited to 'src')
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/ProxyRouter.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProxyRouter.java b/src/net/java/sip/communicator/impl/protocol/sip/ProxyRouter.java
index 5d60612..b6bf997 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/ProxyRouter.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/ProxyRouter.java
@@ -19,6 +19,7 @@ package net.java.sip.communicator.impl.protocol.sip;
import gov.nist.javax.sip.stack.*;
+import java.net.*;
import java.util.*;
import javax.sip.*;
@@ -26,6 +27,7 @@ import javax.sip.address.*;
import javax.sip.header.*;
import javax.sip.message.*;
+import net.java.sip.communicator.impl.protocol.sip.net.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
@@ -137,7 +139,9 @@ public class ProxyRouter
ProtocolProviderServiceSipImpl sipProvider
= ((ProtocolProviderServiceSipImpl) service);
- String proxy = sipProvider.getConnection().getOutboundProxyString();
+ final ProxyConnection connection = sipProvider.getConnection();
+ final String proxy = connection.getOutboundProxyString();
+ logger.trace("Router for proxy: " + proxy);
boolean forceLooseRouting
= sipProvider.getAccountID()
@@ -146,13 +150,30 @@ public class ProxyRouter
// P2P case
if (proxy == null || forceLooseRouting )
+ {
+ logger.info("Returning default SIP router, P2P/loose routing");
return this.getDefaultRouter();
+ }
// outbound proxy case
Router router = routerCache.get(proxy);
if (router == null)
{
- router = new DefaultRouter(stack, proxy);
+ router = new DefaultRouter(stack, proxy)
+ {
+ @Override
+ public Hop getNextHop(Request request) throws SipException
+ {
+ logger.info("Outbound proxy mode, using proxy " +
+ proxy + " as hop instead of an address resolved" +
+ " by the SIP router");
+ InetSocketAddress sa = connection.getAddress();
+ return new HopImpl(
+ sa.getAddress().getHostAddress(),
+ sa.getPort(),
+ connection.getTransport());
+ }
+ };
routerCache.put(proxy, router);
}
return router;
@@ -164,6 +185,7 @@ public class ProxyRouter
logger.error("unable to identify the service which created this "
+ "out-of-dialog request");
+ logger.info("Returning default router");
return this.getDefaultRouter();
}