[sip-comm-dev] Re: svn commit: r7710 - trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java


#1

Hi,
since that commit I have thise exception that happens at every start :
     [java] java.lang.NullPointerException
     [java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.initOutboundProxy(ProtocolProviderServiceSipImpl.java:1949)
     [java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.initialize(ProtocolProviderServiceSipImpl.java:499)
     [java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderFactorySipImpl.createService(ProtocolProviderFactorySipImpl.java:297)
     [java] at
net.java.sip.communicator.service.protocol.ProtocolProviderFactory.loadAccount(ProtocolProviderFactory.java:673)
     [java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderFactorySipImpl.loadAccount(ProtocolProviderFactorySipImpl.java:43)
     [java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl.doLoadStoredAccounts(AccountManagerImpl.java:190)
     [java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl.loadStoredAccounts(AccountManagerImpl.java:340)
     [java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl.runInLoadStoredAccountsThread(AccountManagerImpl.java:453)
     [java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl.access$100(AccountManagerImpl.java:26)
     [java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl$2.run(AccountManagerImpl.java:380)

It seems that resolveAddresses(
                        proxyAddressStr,
                        addresses,
                        Boolean.getBoolean("java.net.preferIPv6Addresses"),
                        proxyPort);

doesn't find any address for my proxy.
The fact is that it seems to try some DNS name or something like that,
but my proxy is only an ip address.

Matthieu

···

On Fri, Sep 17, 2010 at 2:04 PM, <damencho@dev.java.net> wrote:

Author: damencho
Date: 2010-09-17 12:04:14+0000
New Revision: 7710

Modified:
trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java

Log:
Fix SRV resolving for udp services (a problem where services with only udp SRV cannot connect).
Fix sending unregister on shutting down, unregister is now not run in separate thread.

Modified: trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java?view=diff&rev=7710&p1=trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java&r1=7709&r2=7710

--- trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java 2010-09-17 12:04:14+0000
@@ -987,13 +987,9 @@
return;
}

- // launch the shutdown process in a thread to free the GUI as soon
- // as possible even if the SIP un-registration process may take time
- // especially for ending SIMPLE
- Thread t = new Thread(new ShutdownThread());
- t.setDaemon(false);
- t.start();
-
+ // don't run in Thread cause shutting down may finish before
+ // we were able to unregister
+ new ShutdownThread().run();
}

/\*\*

@@ -1031,7 +1027,7 @@

                //leave ourselves time to complete un\-registration \(may include
                //2 REGISTER requests in case notification is needed\.\)

- listener.waitForEvent(5000L);
+ listener.waitForEvent(3000L);
}
catch (OperationFailedException ex)
{
@@ -1555,21 +1551,54 @@
//from this point on we are certain to have a registrar.
InetSocketAddress[] registrarSocketAddresses = null;

+ //registrar transport
+ String registrarTransport = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.PREFERRED_TRANSPORT);
+
+ if(registrarTransport != null && registrarTransport.length() > 0)
+ {
+ if( ! registrarTransport.equals(ListeningPoint.UDP)
+ && !registrarTransport.equals(ListeningPoint.TCP)
+ && !registrarTransport.equals(ListeningPoint.TLS))
+ {
+ throw new IllegalArgumentException(registrarTransport
+ + " is not a valid transport protocol. Transport must be "
+ +"left blanc or set to TCP, UDP or TLS.");
+ }
+ }
+ else
+ {
+ registrarTransport = getDefaultTransport();
+ }
+
//init registrar port
int registrarPort = ListeningPoint.PORT_5060;

    try
    \{

- // first check for srv records exists
- String registrarTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
-
- if(registrarTransport == null)
- registrarTransport = getDefaultTransport();
-
- registrarSocketAddresses =
- resolveSipAddress(registrarAddressStr, registrarTransport);
+ // if port is set we must use the explicitly set settings and
+ // skip SRV queries
+ if(accountID.getAccountProperty(
+ ProtocolProviderFactory.SERVER_PORT) != null)
+ {
+ ArrayList<InetSocketAddress> registrarSocketAddressesList =
+ new ArrayList<InetSocketAddress>();
+
+ // get only AAAA and A records
+ resolveAddresses(
+ registrarAddressStr,
+ registrarSocketAddressesList,
+ Boolean.getBoolean("java.net.preferIPv6Addresses"),
+ registrarPort
+ );
+ registrarSocketAddresses = registrarSocketAddressesList
+ .toArray(new InetSocketAddress[0]);
+ }
+ else
+ {
+ registrarSocketAddresses =
+ resolveSipAddress(registrarAddressStr, registrarTransport);
+ }

        // We should set here the property to indicate that the server
        // address is validated\. When we load stored accounts we check

@@ -1577,10 +1606,11 @@
// address. And this is needed because in the case we don't have
// network while loading the application we still want to have our
// accounts loaded.
- accountID.putAccountProperty(
- ProtocolProviderFactory.SERVER_ADDRESS_VALIDATED,
- Boolean.toString(true));
-
+ if(registrarSocketAddresses != null
+ && registrarSocketAddresses.length > 0)
+ accountID.putAccountProperty(
+ ProtocolProviderFactory.SERVER_ADDRESS_VALIDATED,
+ Boolean.toString(true));
}
catch (UnknownHostException ex)
{
@@ -1639,27 +1669,6 @@
+ " and does not therefore represent a valid port number.");
}

- //registrar transport
- String registrarTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
-
- if(registrarTransport != null && registrarTransport.length() > 0)
- {
- if( ! registrarTransport.equals(ListeningPoint.UDP)
- && !registrarTransport.equals(ListeningPoint.TCP)
- && !registrarTransport.equals(ListeningPoint.TLS))
- {
- throw new IllegalArgumentException(registrarTransport
- + " is not a valid transport protocol. Transport must be "
- +"left blanc or set to TCP, UDP or TLS.");
- }
- }
- else
- {
- registrarTransport = ListeningPoint.UDP;
- }
-
//init expiration timeout
int expires =
SipActivator.getConfigurationService().getInt(
@@ -1852,6 +1861,7 @@
accountID
.getAccountPropertyString(ProtocolProviderFactory.
PROXY_ADDRESS);
+ boolean proxyAddressAndPortEntered = false;

    if\(proxyAddressStr == null || proxyAddressStr\.trim\(\)\.length\(\) == 0\)
    \{

@@ -1865,24 +1875,76 @@
return;
}
}
+ else
+ {
+ if(accountID.getAccountProperty(ProtocolProviderFactory.PROXY_PORT)
+ != null)
+ {
+ proxyAddressAndPortEntered = true;
+ }
+ }

    InetAddress proxyAddress = null;

    //init proxy port
    int proxyPort = ListeningPoint\.PORT\_5060;

- try
- {
- // first check for srv records exists
- String proxyTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
+ //proxy transport
+ String proxyTransport = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.PREFERRED_TRANSPORT);

- if(proxyTransport == null)
- proxyTransport = getDefaultTransport();
+ if (proxyTransport != null && proxyTransport.length() > 0)
+ {
+ if (!proxyTransport.equals(ListeningPoint.UDP)
+ && !proxyTransport.equals(ListeningPoint.TCP)
+ && !proxyTransport.equals(ListeningPoint.TLS))
+ {
+ throw new IllegalArgumentException(proxyTransport
+ + " is not a valid transport protocol. Transport must be "
+ + "left blank or set to TCP, UDP or TLS.");
+ }
+ }
+ else
+ {
+ proxyTransport = getDefaultTransport();
+ }

- InetSocketAddress proxySocketAddress = resolveSipAddress(
- proxyAddressStr, proxyTransport)[ix];
+ try
+ {
+ //check if user has overridden proxy port.
+ proxyPort = accountID.getAccountPropertyInt(
+ ProtocolProviderFactory.PROXY_PORT,
+ proxyPort);
+ if (proxyPort > NetworkUtils.MAX_PORT_NUMBER)
+ {
+ throw new IllegalArgumentException(proxyPort + " is larger than "
+ + NetworkUtils.MAX_PORT_NUMBER
+ + " and does not therefore represent a valid port number.");
+ }
+
+ InetSocketAddress proxySocketAddress = null;
+
+ // according rfc3263 if proxy address is explicitly entered
+ // don't make SRV queries
+ if(proxyAddressAndPortEntered)
+ {
+ ArrayList<InetSocketAddress> addresses
+ = new ArrayList<InetSocketAddress>();
+
+ resolveAddresses(
+ proxyAddressStr,
+ addresses,
+ Boolean.getBoolean("java.net.preferIPv6Addresses"),
+ proxyPort);
+ // only set if enough results found
+ if(addresses.size() > ix)
+ proxySocketAddress = addresses.get(ix);
+ }
+ else
+ {
+ proxySocketAddress = resolveSipAddress(
+ proxyAddressStr, proxyTransport)[ix];
+ }

        proxyAddress = proxySocketAddress\.getAddress\(\);
        proxyPort = proxySocketAddress\.getPort\(\);

@@ -1936,38 +1998,6 @@
return;
}

- //check if user has overridden proxy port.
- proxyPort =
- accountID.getAccountPropertyInt(ProtocolProviderFactory.PROXY_PORT,
- proxyPort);
- if (proxyPort > NetworkUtils.MAX_PORT_NUMBER)
- {
- throw new IllegalArgumentException(proxyPort + " is larger than "
- + NetworkUtils.MAX_PORT_NUMBER
- + " and does not therefore represent a valid port number.");
- }
-
- //proxy transport
- String proxyTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
-
- if (proxyTransport != null && proxyTransport.length() > 0)
- {
- if (!proxyTransport.equals(ListeningPoint.UDP)
- && !proxyTransport.equals(ListeningPoint.TCP)
- && !proxyTransport.equals(ListeningPoint.TLS))
- {
- throw new IllegalArgumentException(proxyTransport
- + " is not a valid transport protocol. Transport must be "
- + "left blanc or set to TCP, UDP or TLS.");
- }
- }
- else
- {
- proxyTransport = ListeningPoint.UDP;
- }
-
StringBuilder proxyStringBuffer
= new StringBuilder(proxyAddress.getHostAddress());

@@ -2566,7 +2596,10 @@
NetworkUtils.getSRVRecords(
transport.equalsIgnoreCase(ListeningPoint.TLS) ?
"sips" : "sip",
- ListeningPoint.TCP, address);
+ transport.equalsIgnoreCase(ListeningPoint.UDP) ?
+ ListeningPoint.UDP : ListeningPoint.TCP,
+ address);
+
if(sockAddrs != null)
{
for(InetSocketAddress s : sockAddrs)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: commits-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#2

Hi,

thanks for reporting it. Can you give me some more details about your
account, cause I'm unable to reproduce it. How did you created your
account? Its just username@ip-address with password. Or its a
username@domain and you have set your proxy address in the connection
tab in advance properties for account or something else?

Thanks
damencho

···

On Mon, Sep 20, 2010 at 12:46 PM, Matthieu Casanova <chocolat.mou@gmail.com> wrote:

Hi,
since that commit I have thise exception that happens at every start :
[java] java.lang.NullPointerException
[java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.initOutboundProxy(ProtocolProviderServiceSipImpl.java:1949)
[java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.initialize(ProtocolProviderServiceSipImpl.java:499)
[java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderFactorySipImpl.createService(ProtocolProviderFactorySipImpl.java:297)
[java] at
net.java.sip.communicator.service.protocol.ProtocolProviderFactory.loadAccount(ProtocolProviderFactory.java:673)
[java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderFactorySipImpl.loadAccount(ProtocolProviderFactorySipImpl.java:43)
[java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl.doLoadStoredAccounts(AccountManagerImpl.java:190)
[java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl.loadStoredAccounts(AccountManagerImpl.java:340)
[java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl.runInLoadStoredAccountsThread(AccountManagerImpl.java:453)
[java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl.access$100(AccountManagerImpl.java:26)
[java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl$2.run(AccountManagerImpl.java:380)

It seems that resolveAddresses(
proxyAddressStr,
addresses,
Boolean.getBoolean("java.net.preferIPv6Addresses"),
proxyPort);

doesn't find any address for my proxy.
The fact is that it seems to try some DNS name or something like that,
but my proxy is only an ip address.

Matthieu

On Fri, Sep 17, 2010 at 2:04 PM, <damencho@dev.java.net> wrote:

Author: damencho
Date: 2010-09-17 12:04:14+0000
New Revision: 7710

Modified:
trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java

Log:
Fix SRV resolving for udp services (a problem where services with only udp SRV cannot connect).
Fix sending unregister on shutting down, unregister is now not run in separate thread.

Modified: trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java?view=diff&rev=7710&p1=trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java&r1=7709&r2=7710

--- trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java 2010-09-17 12:04:14+0000
@@ -987,13 +987,9 @@
return;
}

- // launch the shutdown process in a thread to free the GUI as soon
- // as possible even if the SIP un-registration process may take time
- // especially for ending SIMPLE
- Thread t = new Thread(new ShutdownThread());
- t.setDaemon(false);
- t.start();
-
+ // don't run in Thread cause shutting down may finish before
+ // we were able to unregister
+ new ShutdownThread().run();
}

/\*\*

@@ -1031,7 +1027,7 @@

                //leave ourselves time to complete un\-registration \(may include
                //2 REGISTER requests in case notification is needed\.\)

- listener.waitForEvent(5000L);
+ listener.waitForEvent(3000L);
}
catch (OperationFailedException ex)
{
@@ -1555,21 +1551,54 @@
//from this point on we are certain to have a registrar.
InetSocketAddress[] registrarSocketAddresses = null;

+ //registrar transport
+ String registrarTransport = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.PREFERRED_TRANSPORT);
+
+ if(registrarTransport != null && registrarTransport.length() > 0)
+ {
+ if( ! registrarTransport.equals(ListeningPoint.UDP)
+ && !registrarTransport.equals(ListeningPoint.TCP)
+ && !registrarTransport.equals(ListeningPoint.TLS))
+ {
+ throw new IllegalArgumentException(registrarTransport
+ + " is not a valid transport protocol. Transport must be "
+ +"left blanc or set to TCP, UDP or TLS.");
+ }
+ }
+ else
+ {
+ registrarTransport = getDefaultTransport();
+ }
+
//init registrar port
int registrarPort = ListeningPoint.PORT_5060;

    try
    \{

- // first check for srv records exists
- String registrarTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
-
- if(registrarTransport == null)
- registrarTransport = getDefaultTransport();
-
- registrarSocketAddresses =
- resolveSipAddress(registrarAddressStr, registrarTransport);
+ // if port is set we must use the explicitly set settings and
+ // skip SRV queries
+ if(accountID.getAccountProperty(
+ ProtocolProviderFactory.SERVER_PORT) != null)
+ {
+ ArrayList<InetSocketAddress> registrarSocketAddressesList =
+ new ArrayList<InetSocketAddress>();
+
+ // get only AAAA and A records
+ resolveAddresses(
+ registrarAddressStr,
+ registrarSocketAddressesList,
+ Boolean.getBoolean("java.net.preferIPv6Addresses"),
+ registrarPort
+ );
+ registrarSocketAddresses = registrarSocketAddressesList
+ .toArray(new InetSocketAddress[0]);
+ }
+ else
+ {
+ registrarSocketAddresses =
+ resolveSipAddress(registrarAddressStr, registrarTransport);
+ }

        // We should set here the property to indicate that the server
        // address is validated\. When we load stored accounts we check

@@ -1577,10 +1606,11 @@
// address. And this is needed because in the case we don't have
// network while loading the application we still want to have our
// accounts loaded.
- accountID.putAccountProperty(
- ProtocolProviderFactory.SERVER_ADDRESS_VALIDATED,
- Boolean.toString(true));
-
+ if(registrarSocketAddresses != null
+ && registrarSocketAddresses.length > 0)
+ accountID.putAccountProperty(
+ ProtocolProviderFactory.SERVER_ADDRESS_VALIDATED,
+ Boolean.toString(true));
}
catch (UnknownHostException ex)
{
@@ -1639,27 +1669,6 @@
+ " and does not therefore represent a valid port number.");
}

- //registrar transport
- String registrarTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
-
- if(registrarTransport != null && registrarTransport.length() > 0)
- {
- if( ! registrarTransport.equals(ListeningPoint.UDP)
- && !registrarTransport.equals(ListeningPoint.TCP)
- && !registrarTransport.equals(ListeningPoint.TLS))
- {
- throw new IllegalArgumentException(registrarTransport
- + " is not a valid transport protocol. Transport must be "
- +"left blanc or set to TCP, UDP or TLS.");
- }
- }
- else
- {
- registrarTransport = ListeningPoint.UDP;
- }
-
//init expiration timeout
int expires =
SipActivator.getConfigurationService().getInt(
@@ -1852,6 +1861,7 @@
accountID
.getAccountPropertyString(ProtocolProviderFactory.
PROXY_ADDRESS);
+ boolean proxyAddressAndPortEntered = false;

    if\(proxyAddressStr == null || proxyAddressStr\.trim\(\)\.length\(\) == 0\)
    \{

@@ -1865,24 +1875,76 @@
return;
}
}
+ else
+ {
+ if(accountID.getAccountProperty(ProtocolProviderFactory.PROXY_PORT)
+ != null)
+ {
+ proxyAddressAndPortEntered = true;
+ }
+ }

    InetAddress proxyAddress = null;

    //init proxy port
    int proxyPort = ListeningPoint\.PORT\_5060;

- try
- {
- // first check for srv records exists
- String proxyTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
+ //proxy transport
+ String proxyTransport = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.PREFERRED_TRANSPORT);

- if(proxyTransport == null)
- proxyTransport = getDefaultTransport();
+ if (proxyTransport != null && proxyTransport.length() > 0)
+ {
+ if (!proxyTransport.equals(ListeningPoint.UDP)
+ && !proxyTransport.equals(ListeningPoint.TCP)
+ && !proxyTransport.equals(ListeningPoint.TLS))
+ {
+ throw new IllegalArgumentException(proxyTransport
+ + " is not a valid transport protocol. Transport must be "
+ + "left blank or set to TCP, UDP or TLS.");
+ }
+ }
+ else
+ {
+ proxyTransport = getDefaultTransport();
+ }

- InetSocketAddress proxySocketAddress = resolveSipAddress(
- proxyAddressStr, proxyTransport)[ix];
+ try
+ {
+ //check if user has overridden proxy port.
+ proxyPort = accountID.getAccountPropertyInt(
+ ProtocolProviderFactory.PROXY_PORT,
+ proxyPort);
+ if (proxyPort > NetworkUtils.MAX_PORT_NUMBER)
+ {
+ throw new IllegalArgumentException(proxyPort + " is larger than "
+ + NetworkUtils.MAX_PORT_NUMBER
+ + " and does not therefore represent a valid port number.");
+ }
+
+ InetSocketAddress proxySocketAddress = null;
+
+ // according rfc3263 if proxy address is explicitly entered
+ // don't make SRV queries
+ if(proxyAddressAndPortEntered)
+ {
+ ArrayList<InetSocketAddress> addresses
+ = new ArrayList<InetSocketAddress>();
+
+ resolveAddresses(
+ proxyAddressStr,
+ addresses,
+ Boolean.getBoolean("java.net.preferIPv6Addresses"),
+ proxyPort);
+ // only set if enough results found
+ if(addresses.size() > ix)
+ proxySocketAddress = addresses.get(ix);
+ }
+ else
+ {
+ proxySocketAddress = resolveSipAddress(
+ proxyAddressStr, proxyTransport)[ix];
+ }

        proxyAddress = proxySocketAddress\.getAddress\(\);
        proxyPort = proxySocketAddress\.getPort\(\);

@@ -1936,38 +1998,6 @@
return;
}

- //check if user has overridden proxy port.
- proxyPort =
- accountID.getAccountPropertyInt(ProtocolProviderFactory.PROXY_PORT,
- proxyPort);
- if (proxyPort > NetworkUtils.MAX_PORT_NUMBER)
- {
- throw new IllegalArgumentException(proxyPort + " is larger than "
- + NetworkUtils.MAX_PORT_NUMBER
- + " and does not therefore represent a valid port number.");
- }
-
- //proxy transport
- String proxyTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
-
- if (proxyTransport != null && proxyTransport.length() > 0)
- {
- if (!proxyTransport.equals(ListeningPoint.UDP)
- && !proxyTransport.equals(ListeningPoint.TCP)
- && !proxyTransport.equals(ListeningPoint.TLS))
- {
- throw new IllegalArgumentException(proxyTransport
- + " is not a valid transport protocol. Transport must be "
- + "left blanc or set to TCP, UDP or TLS.");
- }
- }
- else
- {
- proxyTransport = ListeningPoint.UDP;
- }
-
StringBuilder proxyStringBuffer
= new StringBuilder(proxyAddress.getHostAddress());

@@ -2566,7 +2596,10 @@
NetworkUtils.getSRVRecords(
transport.equalsIgnoreCase(ListeningPoint.TLS) ?
"sips" : "sip",
- ListeningPoint.TCP, address);
+ transport.equalsIgnoreCase(ListeningPoint.UDP) ?
+ ListeningPoint.UDP : ListeningPoint.TCP,
+ address);
+
if(sockAddrs != null)
{
for(InetSocketAddress s : sockAddrs)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: commits-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#3

Hi, it was created using the wizard, if I remember well it was
name@ip-address

When I watch the properties of my account in
sip-communicator.properties I have this :

net.java.sip.communicator.impl.gui.accounts.acc1279610455394=SIP\:1000623354@10.165.247.3
net.java.sip.communicator.impl.gui.accounts.acc1279610455394.accountIndex=0
net.java.sip.communicator.impl.gui.accounts.acc1279610455394.wizard=net_java_sip_communicator_plugin_sipaccregwizz_SIPAccountRegistrationWizard

Matthieu

···

On Mon, Sep 20, 2010 at 12:05 PM, Damian Minkov <damencho@sip-communicator.org> wrote:

Hi,

thanks for reporting it. Can you give me some more details about your
account, cause I'm unable to reproduce it. How did you created your
account? Its just username@ip-address with password. Or its a
username@domain and you have set your proxy address in the connection
tab in advance properties for account or something else?

Thanks
damencho

On Mon, Sep 20, 2010 at 12:46 PM, Matthieu Casanova > <chocolat.mou@gmail.com> wrote:

Hi,
since that commit I have thise exception that happens at every start :
[java] java.lang.NullPointerException
[java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.initOutboundProxy(ProtocolProviderServiceSipImpl.java:1949)
[java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.initialize(ProtocolProviderServiceSipImpl.java:499)
[java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderFactorySipImpl.createService(ProtocolProviderFactorySipImpl.java:297)
[java] at
net.java.sip.communicator.service.protocol.ProtocolProviderFactory.loadAccount(ProtocolProviderFactory.java:673)
[java] at
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderFactorySipImpl.loadAccount(ProtocolProviderFactorySipImpl.java:43)
[java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl.doLoadStoredAccounts(AccountManagerImpl.java:190)
[java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl.loadStoredAccounts(AccountManagerImpl.java:340)
[java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl.runInLoadStoredAccountsThread(AccountManagerImpl.java:453)
[java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl.access$100(AccountManagerImpl.java:26)
[java] at
net.java.sip.communicator.impl.protocol.AccountManagerImpl$2.run(AccountManagerImpl.java:380)

It seems that resolveAddresses(
proxyAddressStr,
addresses,
Boolean.getBoolean("java.net.preferIPv6Addresses"),
proxyPort);

doesn't find any address for my proxy.
The fact is that it seems to try some DNS name or something like that,
but my proxy is only an ip address.

Matthieu

On Fri, Sep 17, 2010 at 2:04 PM, <damencho@dev.java.net> wrote:

Author: damencho
Date: 2010-09-17 12:04:14+0000
New Revision: 7710

Modified:
trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java

Log:
Fix SRV resolving for udp services (a problem where services with only udp SRV cannot connect).
Fix sending unregister on shutting down, unregister is now not run in separate thread.

Modified: trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java?view=diff&rev=7710&p1=trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java&r1=7709&r2=7710

--- trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java (original)
+++ trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java 2010-09-17 12:04:14+0000
@@ -987,13 +987,9 @@
return;
}

- // launch the shutdown process in a thread to free the GUI as soon
- // as possible even if the SIP un-registration process may take time
- // especially for ending SIMPLE
- Thread t = new Thread(new ShutdownThread());
- t.setDaemon(false);
- t.start();
-
+ // don't run in Thread cause shutting down may finish before
+ // we were able to unregister
+ new ShutdownThread().run();
}

/\*\*

@@ -1031,7 +1027,7 @@

                //leave ourselves time to complete un\-registration \(may include
                //2 REGISTER requests in case notification is needed\.\)

- listener.waitForEvent(5000L);
+ listener.waitForEvent(3000L);
}
catch (OperationFailedException ex)
{
@@ -1555,21 +1551,54 @@
//from this point on we are certain to have a registrar.
InetSocketAddress[] registrarSocketAddresses = null;

+ //registrar transport
+ String registrarTransport = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.PREFERRED_TRANSPORT);
+
+ if(registrarTransport != null && registrarTransport.length() > 0)
+ {
+ if( ! registrarTransport.equals(ListeningPoint.UDP)
+ && !registrarTransport.equals(ListeningPoint.TCP)
+ && !registrarTransport.equals(ListeningPoint.TLS))
+ {
+ throw new IllegalArgumentException(registrarTransport
+ + " is not a valid transport protocol. Transport must be "
+ +"left blanc or set to TCP, UDP or TLS.");
+ }
+ }
+ else
+ {
+ registrarTransport = getDefaultTransport();
+ }
+
//init registrar port
int registrarPort = ListeningPoint.PORT_5060;

    try
    \{

- // first check for srv records exists
- String registrarTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
-
- if(registrarTransport == null)
- registrarTransport = getDefaultTransport();
-
- registrarSocketAddresses =
- resolveSipAddress(registrarAddressStr, registrarTransport);
+ // if port is set we must use the explicitly set settings and
+ // skip SRV queries
+ if(accountID.getAccountProperty(
+ ProtocolProviderFactory.SERVER_PORT) != null)
+ {
+ ArrayList<InetSocketAddress> registrarSocketAddressesList =
+ new ArrayList<InetSocketAddress>();
+
+ // get only AAAA and A records
+ resolveAddresses(
+ registrarAddressStr,
+ registrarSocketAddressesList,
+ Boolean.getBoolean("java.net.preferIPv6Addresses"),
+ registrarPort
+ );
+ registrarSocketAddresses = registrarSocketAddressesList
+ .toArray(new InetSocketAddress[0]);
+ }
+ else
+ {
+ registrarSocketAddresses =
+ resolveSipAddress(registrarAddressStr, registrarTransport);
+ }

        // We should set here the property to indicate that the server
        // address is validated\. When we load stored accounts we check

@@ -1577,10 +1606,11 @@
// address. And this is needed because in the case we don't have
// network while loading the application we still want to have our
// accounts loaded.
- accountID.putAccountProperty(
- ProtocolProviderFactory.SERVER_ADDRESS_VALIDATED,
- Boolean.toString(true));
-
+ if(registrarSocketAddresses != null
+ && registrarSocketAddresses.length > 0)
+ accountID.putAccountProperty(
+ ProtocolProviderFactory.SERVER_ADDRESS_VALIDATED,
+ Boolean.toString(true));
}
catch (UnknownHostException ex)
{
@@ -1639,27 +1669,6 @@
+ " and does not therefore represent a valid port number.");
}

- //registrar transport
- String registrarTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
-
- if(registrarTransport != null && registrarTransport.length() > 0)
- {
- if( ! registrarTransport.equals(ListeningPoint.UDP)
- && !registrarTransport.equals(ListeningPoint.TCP)
- && !registrarTransport.equals(ListeningPoint.TLS))
- {
- throw new IllegalArgumentException(registrarTransport
- + " is not a valid transport protocol. Transport must be "
- +"left blanc or set to TCP, UDP or TLS.");
- }
- }
- else
- {
- registrarTransport = ListeningPoint.UDP;
- }
-
//init expiration timeout
int expires =
SipActivator.getConfigurationService().getInt(
@@ -1852,6 +1861,7 @@
accountID
.getAccountPropertyString(ProtocolProviderFactory.
PROXY_ADDRESS);
+ boolean proxyAddressAndPortEntered = false;

    if\(proxyAddressStr == null || proxyAddressStr\.trim\(\)\.length\(\) == 0\)
    \{

@@ -1865,24 +1875,76 @@
return;
}
}
+ else
+ {
+ if(accountID.getAccountProperty(ProtocolProviderFactory.PROXY_PORT)
+ != null)
+ {
+ proxyAddressAndPortEntered = true;
+ }
+ }

    InetAddress proxyAddress = null;

    //init proxy port
    int proxyPort = ListeningPoint\.PORT\_5060;

- try
- {
- // first check for srv records exists
- String proxyTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
+ //proxy transport
+ String proxyTransport = accountID.getAccountPropertyString(
+ ProtocolProviderFactory.PREFERRED_TRANSPORT);

- if(proxyTransport == null)
- proxyTransport = getDefaultTransport();
+ if (proxyTransport != null && proxyTransport.length() > 0)
+ {
+ if (!proxyTransport.equals(ListeningPoint.UDP)
+ && !proxyTransport.equals(ListeningPoint.TCP)
+ && !proxyTransport.equals(ListeningPoint.TLS))
+ {
+ throw new IllegalArgumentException(proxyTransport
+ + " is not a valid transport protocol. Transport must be "
+ + "left blank or set to TCP, UDP or TLS.");
+ }
+ }
+ else
+ {
+ proxyTransport = getDefaultTransport();
+ }

- InetSocketAddress proxySocketAddress = resolveSipAddress(
- proxyAddressStr, proxyTransport)[ix];
+ try
+ {
+ //check if user has overridden proxy port.
+ proxyPort = accountID.getAccountPropertyInt(
+ ProtocolProviderFactory.PROXY_PORT,
+ proxyPort);
+ if (proxyPort > NetworkUtils.MAX_PORT_NUMBER)
+ {
+ throw new IllegalArgumentException(proxyPort + " is larger than "
+ + NetworkUtils.MAX_PORT_NUMBER
+ + " and does not therefore represent a valid port number.");
+ }
+
+ InetSocketAddress proxySocketAddress = null;
+
+ // according rfc3263 if proxy address is explicitly entered
+ // don't make SRV queries
+ if(proxyAddressAndPortEntered)
+ {
+ ArrayList<InetSocketAddress> addresses
+ = new ArrayList<InetSocketAddress>();
+
+ resolveAddresses(
+ proxyAddressStr,
+ addresses,
+ Boolean.getBoolean("java.net.preferIPv6Addresses"),
+ proxyPort);
+ // only set if enough results found
+ if(addresses.size() > ix)
+ proxySocketAddress = addresses.get(ix);
+ }
+ else
+ {
+ proxySocketAddress = resolveSipAddress(
+ proxyAddressStr, proxyTransport)[ix];
+ }

        proxyAddress = proxySocketAddress\.getAddress\(\);
        proxyPort = proxySocketAddress\.getPort\(\);

@@ -1936,38 +1998,6 @@
return;
}

- //check if user has overridden proxy port.
- proxyPort =
- accountID.getAccountPropertyInt(ProtocolProviderFactory.PROXY_PORT,
- proxyPort);
- if (proxyPort > NetworkUtils.MAX_PORT_NUMBER)
- {
- throw new IllegalArgumentException(proxyPort + " is larger than "
- + NetworkUtils.MAX_PORT_NUMBER
- + " and does not therefore represent a valid port number.");
- }
-
- //proxy transport
- String proxyTransport =
- accountID
- .getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
-
- if (proxyTransport != null && proxyTransport.length() > 0)
- {
- if (!proxyTransport.equals(ListeningPoint.UDP)
- && !proxyTransport.equals(ListeningPoint.TCP)
- && !proxyTransport.equals(ListeningPoint.TLS))
- {
- throw new IllegalArgumentException(proxyTransport
- + " is not a valid transport protocol. Transport must be "
- + "left blanc or set to TCP, UDP or TLS.");
- }
- }
- else
- {
- proxyTransport = ListeningPoint.UDP;
- }
-
StringBuilder proxyStringBuffer
= new StringBuilder(proxyAddress.getHostAddress());

@@ -2566,7 +2596,10 @@
NetworkUtils.getSRVRecords(
transport.equalsIgnoreCase(ListeningPoint.TLS) ?
"sips" : "sip",
- ListeningPoint.TCP, address);
+ transport.equalsIgnoreCase(ListeningPoint.UDP) ?
+ ListeningPoint.UDP : ListeningPoint.TCP,
+ address);
+
if(sockAddrs != null)
{
for(InetSocketAddress s : sockAddrs)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: commits-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#4

Hi can i change the name of protocol (like 'SIP') to the name i wish...? If
can please explain how to do that..I also want to change the logo..can
anybody help me..?

···

On Mon, Sep 20, 2010 at 3:35 PM, Damian Minkov < damencho@sip-communicator.org> wrote:

Hi,

thanks for reporting it. Can you give me some more details about your
account, cause I'm unable to reproduce it. How did you created your
account? Its just username@ip-address with password. Or its a
username@domain and you have set your proxy address in the connection
tab in advance properties for account or something else?

Thanks
damencho

On Mon, Sep 20, 2010 at 12:46 PM, Matthieu Casanova > <chocolat.mou@gmail.com> wrote:
> Hi,
> since that commit I have thise exception that happens at every start :
> [java] java.lang.NullPointerException
> [java] at
>
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.initOutboundProxy(ProtocolProviderServiceSipImpl.java:1949)
> [java] at
>
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderServiceSipImpl.initialize(ProtocolProviderServiceSipImpl.java:499)
> [java] at
>
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderFactorySipImpl.createService(ProtocolProviderFactorySipImpl.java:297)
> [java] at
>
net.java.sip.communicator.service.protocol.ProtocolProviderFactory.loadAccount(ProtocolProviderFactory.java:673)
> [java] at
>
net.java.sip.communicator.impl.protocol.sip.ProtocolProviderFactorySipImpl.loadAccount(ProtocolProviderFactorySipImpl.java:43)
> [java] at
>
net.java.sip.communicator.impl.protocol.AccountManagerImpl.doLoadStoredAccounts(AccountManagerImpl.java:190)
> [java] at
>
net.java.sip.communicator.impl.protocol.AccountManagerImpl.loadStoredAccounts(AccountManagerImpl.java:340)
> [java] at
>
net.java.sip.communicator.impl.protocol.AccountManagerImpl.runInLoadStoredAccountsThread(AccountManagerImpl.java:453)
> [java] at
>
net.java.sip.communicator.impl.protocol.AccountManagerImpl.access$100(AccountManagerImpl.java:26)
> [java] at
>
net.java.sip.communicator.impl.protocol.AccountManagerImpl$2.run(AccountManagerImpl.java:380)
>
> It seems that resolveAddresses(
> proxyAddressStr,
> addresses,
>
Boolean.getBoolean("java.net.preferIPv6Addresses"),
> proxyPort);
>
> doesn't find any address for my proxy.
> The fact is that it seems to try some DNS name or something like that,
> but my proxy is only an ip address.
>
> Matthieu
>
>
> On Fri, Sep 17, 2010 at 2:04 PM, <damencho@dev.java.net> wrote:
>> Author: damencho
>> Date: 2010-09-17 12:04:14+0000
>> New Revision: 7710
>>
>> Modified:
>>
trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
>>
>> Log:
>> Fix SRV resolving for udp services (a problem where services with only
udp SRV cannot connect).
>> Fix sending unregister on shutting down, unregister is now not run in
separate thread.
>>
>> Modified:
trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
>> Url:
https://sip-communicator.dev.java.net/source/browse/sip-communicator/trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java?view=diff&rev=7710&p1=trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java&p2=trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java&r1=7709&r2=7710
>>

>> ---
trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
  (original)
>> +++
trunk/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java
  2010-09-17 12:04:14+0000
>> @@ -987,13 +987,9 @@
>> return;
>> }
>>
>> - // launch the shutdown process in a thread to free the GUI as
soon
>> - // as possible even if the SIP un-registration process may take
time
>> - // especially for ending SIMPLE
>> - Thread t = new Thread(new ShutdownThread());
>> - t.setDaemon(false);
>> - t.start();
>> -
>> + // don't run in Thread cause shutting down may finish before
>> + // we were able to unregister
>> + new ShutdownThread().run();
>> }
>>
>> /**
>> @@ -1031,7 +1027,7 @@
>>
>> //leave ourselves time to complete un-registration
(may include
>> //2 REGISTER requests in case notification is
needed.)
>> - listener.waitForEvent(5000L);
>> + listener.waitForEvent(3000L);
>> }
>> catch (OperationFailedException ex)
>> {
>> @@ -1555,21 +1551,54 @@
>> //from this point on we are certain to have a registrar.
>> InetSocketAddress[] registrarSocketAddresses = null;
>>
>> + //registrar transport
>> + String registrarTransport = accountID.getAccountPropertyString(
>> + ProtocolProviderFactory.PREFERRED_TRANSPORT);
>> +
>> + if(registrarTransport != null && registrarTransport.length() >
0)
>> + {
>> + if( ! registrarTransport.equals(ListeningPoint.UDP)
>> + && !registrarTransport.equals(ListeningPoint.TCP)
>> + && !registrarTransport.equals(ListeningPoint.TLS))
>> + {
>> + throw new IllegalArgumentException(registrarTransport
>> + + " is not a valid transport protocol. Transport
must be "
>> + +"left blanc or set to TCP, UDP or TLS.");
>> + }
>> + }
>> + else
>> + {
>> + registrarTransport = getDefaultTransport();
>> + }
>> +
>> //init registrar port
>> int registrarPort = ListeningPoint.PORT_5060;
>>
>> try
>> {
>> - // first check for srv records exists
>> - String registrarTransport =
>> - accountID
>> -
.getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
>> -
>> - if(registrarTransport == null)
>> - registrarTransport = getDefaultTransport();
>> -
>> - registrarSocketAddresses =
>> - resolveSipAddress(registrarAddressStr,
registrarTransport);
>> + // if port is set we must use the explicitly set settings
and
>> + // skip SRV queries
>> + if(accountID.getAccountProperty(
>> + ProtocolProviderFactory.SERVER_PORT) != null)
>> + {
>> + ArrayList<InetSocketAddress>
registrarSocketAddressesList =
>> + new ArrayList<InetSocketAddress>();
>> +
>> + // get only AAAA and A records
>> + resolveAddresses(
>> + registrarAddressStr,
>> + registrarSocketAddressesList,
>> +
Boolean.getBoolean("java.net.preferIPv6Addresses"),
>> + registrarPort
>> + );
>> + registrarSocketAddresses = registrarSocketAddressesList
>> + .toArray(new InetSocketAddress[0]);
>> + }
>> + else
>> + {
>> + registrarSocketAddresses =
>> + resolveSipAddress(registrarAddressStr,
registrarTransport);
>> + }
>>
>> // We should set here the property to indicate that the
server
>> // address is validated. When we load stored accounts we
check
>> @@ -1577,10 +1606,11 @@
>> // address. And this is needed because in the case we don't
have
>> // network while loading the application we still want to
have our
>> // accounts loaded.
>> - accountID.putAccountProperty(
>> - ProtocolProviderFactory.SERVER_ADDRESS_VALIDATED,
>> - Boolean.toString(true));
>> -
>> + if(registrarSocketAddresses != null
>> + && registrarSocketAddresses.length > 0)
>> + accountID.putAccountProperty(
>> + ProtocolProviderFactory.SERVER_ADDRESS_VALIDATED,
>> + Boolean.toString(true));
>> }
>> catch (UnknownHostException ex)
>> {
>> @@ -1639,27 +1669,6 @@
>> + " and does not therefore represent a valid port
number.");
>> }
>>
>> - //registrar transport
>> - String registrarTransport =
>> - accountID
>> -
.getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
>> -
>> - if(registrarTransport != null && registrarTransport.length() >
0)
>> - {
>> - if( ! registrarTransport.equals(ListeningPoint.UDP)
>> - && !registrarTransport.equals(ListeningPoint.TCP)
>> - && !registrarTransport.equals(ListeningPoint.TLS))
>> - {
>> - throw new IllegalArgumentException(registrarTransport
>> - + " is not a valid transport protocol. Transport
must be "
>> - +"left blanc or set to TCP, UDP or TLS.");
>> - }
>> - }
>> - else
>> - {
>> - registrarTransport = ListeningPoint.UDP;
>> - }
>> -
>> //init expiration timeout
>> int expires =
>> SipActivator.getConfigurationService().getInt(
>> @@ -1852,6 +1861,7 @@
>> accountID
>> .getAccountPropertyString(ProtocolProviderFactory.
>> PROXY_ADDRESS);
>> + boolean proxyAddressAndPortEntered = false;
>>
>> if(proxyAddressStr == null || proxyAddressStr.trim().length() ==
0)
>> {
>> @@ -1865,24 +1875,76 @@
>> return;
>> }
>> }
>> + else
>> + {
>> +
if(accountID.getAccountProperty(ProtocolProviderFactory.PROXY_PORT)
>> + != null)
>> + {
>> + proxyAddressAndPortEntered = true;
>> + }
>> + }
>>
>> InetAddress proxyAddress = null;
>>
>> //init proxy port
>> int proxyPort = ListeningPoint.PORT_5060;
>>
>> - try
>> - {
>> - // first check for srv records exists
>> - String proxyTransport =
>> - accountID
>> -
.getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
>> + //proxy transport
>> + String proxyTransport = accountID.getAccountPropertyString(
>> + ProtocolProviderFactory.PREFERRED_TRANSPORT);
>>
>> - if(proxyTransport == null)
>> - proxyTransport = getDefaultTransport();
>> + if (proxyTransport != null && proxyTransport.length() > 0)
>> + {
>> + if (!proxyTransport.equals(ListeningPoint.UDP)
>> + && !proxyTransport.equals(ListeningPoint.TCP)
>> + && !proxyTransport.equals(ListeningPoint.TLS))
>> + {
>> + throw new IllegalArgumentException(proxyTransport
>> + + " is not a valid transport protocol. Transport
must be "
>> + + "left blank or set to TCP, UDP or TLS.");
>> + }
>> + }
>> + else
>> + {
>> + proxyTransport = getDefaultTransport();
>> + }
>>
>> - InetSocketAddress proxySocketAddress = resolveSipAddress(
>> - proxyAddressStr, proxyTransport)[ix];
>> + try
>> + {
>> + //check if user has overridden proxy port.
>> + proxyPort = accountID.getAccountPropertyInt(
>> + ProtocolProviderFactory.PROXY_PORT,
>> + proxyPort);
>> + if (proxyPort > NetworkUtils.MAX_PORT_NUMBER)
>> + {
>> + throw new IllegalArgumentException(proxyPort + " is
larger than "
>> + + NetworkUtils.MAX_PORT_NUMBER
>> + + " and does not therefore represent a valid port
number.");
>> + }
>> +
>> + InetSocketAddress proxySocketAddress = null;
>> +
>> + // according rfc3263 if proxy address is explicitly entered
>> + // don't make SRV queries
>> + if(proxyAddressAndPortEntered)
>> + {
>> + ArrayList<InetSocketAddress> addresses
>> + = new ArrayList<InetSocketAddress>();
>> +
>> + resolveAddresses(
>> + proxyAddressStr,
>> + addresses,
>> +
Boolean.getBoolean("java.net.preferIPv6Addresses"),
>> + proxyPort);
>> + // only set if enough results found
>> + if(addresses.size() > ix)
>> + proxySocketAddress = addresses.get(ix);
>> + }
>> + else
>> + {
>> + proxySocketAddress = resolveSipAddress(
>> + proxyAddressStr, proxyTransport)[ix];
>> + }
>>
>> proxyAddress = proxySocketAddress.getAddress();
>> proxyPort = proxySocketAddress.getPort();
>> @@ -1936,38 +1998,6 @@
>> return;
>> }
>>
>> - //check if user has overridden proxy port.
>> - proxyPort =
>> -
accountID.getAccountPropertyInt(ProtocolProviderFactory.PROXY_PORT,
>> - proxyPort);
>> - if (proxyPort > NetworkUtils.MAX_PORT_NUMBER)
>> - {
>> - throw new IllegalArgumentException(proxyPort + " is larger
than "
>> - + NetworkUtils.MAX_PORT_NUMBER
>> - + " and does not therefore represent a valid port
number.");
>> - }
>> -
>> - //proxy transport
>> - String proxyTransport =
>> - accountID
>> -
.getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
>> -
>> - if (proxyTransport != null && proxyTransport.length() > 0)
>> - {
>> - if (!proxyTransport.equals(ListeningPoint.UDP)
>> - && !proxyTransport.equals(ListeningPoint.TCP)
>> - && !proxyTransport.equals(ListeningPoint.TLS))
>> - {
>> - throw new IllegalArgumentException(proxyTransport
>> - + " is not a valid transport protocol. Transport
must be "
>> - + "left blanc or set to TCP, UDP or TLS.");
>> - }
>> - }
>> - else
>> - {
>> - proxyTransport = ListeningPoint.UDP;
>> - }
>> -
>> StringBuilder proxyStringBuffer
>> = new StringBuilder(proxyAddress.getHostAddress());
>>
>> @@ -2566,7 +2596,10 @@
>> NetworkUtils.getSRVRecords(
>>
transport.equalsIgnoreCase(ListeningPoint.TLS) ?
>> "sips" : "sip",
>> - ListeningPoint.TCP, address);
>> +
transport.equalsIgnoreCase(ListeningPoint.UDP) ?
>> + ListeningPoint.UDP :
ListeningPoint.TCP,
>> + address);
>> +
>> if(sockAddrs != null)
>> {
>> for(InetSocketAddress s : sockAddrs)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
commits-unsubscribe@sip-communicator.dev.java.net
>> For additional commands, e-mail:
commits-help@sip-communicator.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
> For additional commands, e-mail: dev-help@sip-communicator.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net