diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java index ae5a924fa..a54179032 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java @@ -379,15 +379,6 @@ Request createMessage(Contact to, Message message) try { toAddress = parseAddressStr(to.getAddress()); - - destinationInetAddress = InetAddress.getByName( - ( (SipURI) toAddress.getURI()).getHost()); - } - catch (UnknownHostException ex) - { - throw new IllegalArgumentException( - ( (SipURI) toAddress.getURI()).getHost() - + " is not a valid internet address " + ex.getMessage()); } catch (ParseException exc) { @@ -401,6 +392,33 @@ Request createMessage(Contact to, Message message) , OperationFailedException.INTERNAL_ERROR , exc); } + + try + { + destinationInetAddress = InetAddress.getByName( + ( (SipURI) toAddress.getURI()).getHost()); + } + catch (UnknownHostException ex) + { + //getByName() verifies host existance with an AAAA/A check and the + //destination could only have an SRV record so let's not let this + //bother us and only log it (report by Dan Bogos) + logger.warn( ( (SipURI) toAddress.getURI()).getHost() + + " is not a valid internet address " + ex.getMessage()); + + //replace the destination address with that of the proxy if we + //have it or that of the registrar otherwise. + if(sipProvider.getOutboundProxy() != null) + { + destinationInetAddress + = sipProvider.getOutboundProxy().getAddress(); + } + else + { + destinationInetAddress + = sipProvider.getRegistrarConnection().getRegistrarAddress(); + } + } // Call ID CallIdHeader callIdHeader = this.sipProvider diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java index aae75bb28..7cece577f 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java @@ -1873,6 +1873,31 @@ public Address getOurSipAddress() { return ourSipAddress; } + + /** + * In case we are using an outbound proxy this method returns its address. + * The method returns null otherwise. + * + * @return the address of our outbound proxy if we are using one and + * null otherwise. + */ + public InetSocketAddress getOutboundProxy() + { + return this.outboundProxySocketAddress; + } + + /** + * In case we are using an outbound proxy this method returns the transport + * we are using to connect to it. The method returns null + * otherwise. + * + * @return the transport used to connect to our outbound proxy if we are + * using one and null otherwise. + */ + public String getOutboundProxyTransport() + { + return this.outboundProxyTransport; + } /** * Extracts all properties concerning the usage of an outbound proxy for