[jitsi-dev] SIP Via/Contact headers have wrong IP address on multhomed Mac

:That's exactly what we do. Apparently it is failing in the new Jitsi
:stable. This could be due to Java 7 or something else. We should have
:a look in the following days since many people are seeing the issue.

FWIW, Jitsi 2.4-latest works. I'd be glad to try out the theory that
it's an embedded JRE issue, but it's unclear to me how to point Jitsi
at a different JRE (I have Apple Java6 and Oracle Java7 installed). I
would be glad to do some bisectional testing if there were much-older
2014 builds of Jitsi available.

We introduced the builds with an included JRE only very recently, and the
SIP code in this area hasn't changed at all. The major change here is that
Java is now directly provided by Oracle and no longer by Apple, so the
networking code in the JVM might have changed quite a bit.

I started looking at the code a bit, but I'm no Java or OO programmer.
About the only thing I concluded is that getListeningPoint() (which is
invoked quite early on in the ContactHeader/ViaHeader routines) would
appear to be obsolete with current JAIN SIP, that getListeningPoints()
should be used. I have no idea of how (ir)relevant that is, here.

Would you be able to compile and run this the following snippet/application
on your multihomed machine on Java 6 and Java 8 and post us the output? I
could create a jar tomorrow if you cannot compile it yourself.

If you try to connect to your SIP server, the output should be your expected
source IP on both Java versions.

import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Random;

public class SocketBindExample {
    public static void main(String[] args) throws SocketException,
UnknownHostException {
        if (args.length != 1) {
            System.out.println("Specify an IP address or hostname to connect

        Random portNumberGenerator = new Random();
        int port = portNumberGenerator.nextInt(0xffff - 1024) + 1024;
        DatagramSocket resultSocket = new DatagramSocket(port);
        resultSocket.connect(InetAddress.getByName(args[0]), 55721);
        InetAddress localhost = resultSocket.getLocalAddress();