Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ public class ProtocolProviderServiceSipImpl
= "net.java.sip.communicator.impl.protocol.sip."
+ "USE_SESSION_LEVEL_DIRECTION_IN_SDP";

/**
* A public IP that should be distributed to peers as a contact address
* instead of the locally determined one; required in case of a 1:1 NAT
*/
private static final String PUBLIC_NAT_IP_PROPERTY_NAME
= "net.java.sip.communicator.impl.protocol.PUBLIC_NAT_IP";

/**
* Default number of times that our requests can be forwarded.
*/
Expand Down Expand Up @@ -248,7 +255,7 @@ public AccountID getAccountID()
/**
* Validates the contact identifier and returns an error message if
* applicable and a suggested correction
*
*
* @param contactId the contact identifier to validate
* @param result Must be supplied as an empty a list. Implementors add
* items:
Expand Down Expand Up @@ -1446,9 +1453,29 @@ public ContactHeader getContactHeader(SipURI intendedDestination)
try
{
//find the address to use with the target
InetAddress localAddress = SipActivator
.getNetworkAddressManagerService()
.getLocalHost(targetAddress.getAddress());
InetAddress localAddress = null;

// handle public IP
String publicNATIPStr
= SipActivator.getConfigurationService().getString(
PUBLIC_NAT_IP_PROPERTY_NAME);

if (publicNATIPStr != null)
{
try {
localAddress = InetAddress.getByName(publicNATIPStr);
}
catch(UnknownHostException e)
{
logger.warn("Failed to create InetAddress");
}
}

if (localAddress == null) {
localAddress = SipActivator
.getNetworkAddressManagerService()
.getLocalHost(targetAddress.getAddress());
}

SipURI contactURI = addressFactory.createSipURI(
getAccountID().getUserID()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ public abstract class TransportManager<U extends MediaAwareCallPeer<?, ?, ?>>
private static final String HOLE_PUNCH_PKT_COUNT_PROPERTY =
"net.java.sip.communicator.impl.protocol.HOLE_PUNCH_PKT_COUNT";

/**
* A public IP that should be distributed to peers as a contact address
* instead of the locally determined one; required in case of a 1:1 NAT
*/
private static final String PUBLIC_NAT_IP_PROPERTY_NAME =
"net.java.sip.communicator.impl.protocol.PUBLIC_NAT_IP";

/**
* Number of empty UDP packets to send for NAT hole punching.
*/
Expand Down Expand Up @@ -490,6 +497,21 @@ protected synchronized static void initializePortNumbers()
*/
public InetAddress getLastUsedLocalHost()
{
String publicNATIPStr
= ProtocolMediaActivator.getConfigurationService().getString(
PUBLIC_NAT_IP_PROPERTY_NAME);

if (publicNATIPStr != null)
{
try {
return InetAddress.getByName(publicNATIPStr);
}
catch(UnknownHostException e)
{
logger.warn("Failed to create InetAddress");
}
}

for (MediaType mediaType : MediaType.values())
{
StreamConnector streamConnector
Expand Down