0

我可以通过本地 Intranet 很好地连接它,但问题当然不在我的路由器之外,我遇到了问题。我不认为我在列表中看到公共 IP 地址是问题所在。

https://github.com/opentelecoms-org/ice4j/blob/master/test/test/SdpUtils.java生成的 SDP信息我的SDP信息如下(本地10.0.0.2):

v=0
o=ice4j.org 0 0 IN IP4 10.0.0.2
s=-
t=0 0
a=ice-options:trickle
a=ice-ufrag:p73m19hsdn0p1
a=ice-pwd:7ncie1rvhplre9k0glhfkdqh8i
m=video 6032 RTP/AVP 0
c=IN 10.0.0.2 IP4
a=mid:video
a=candidate:1 1 udp 2130706431 fe80::fa8f:caff:fe12:da20 6032 typ host
a=candidate:2 1 udp 2130706431 10.0.0.2 6032 typ host
a=candidate:1 2 udp 2130706430 fe80::fa8f:caff:fe12:da20 6033 typ host
a=candidate:2 2 udp 2130706430 10.0.0.2 6033 typ host
m=audio 6034 RTP/AVP 0
c=IN 10.0.0.2 IP4
a=mid:audio
a=candidate:1 1 udp 2130706431 fe80::fa8f:caff:fe12:da20 6034 typ host
a=candidate:2 1 udp 2130706431 10.0.0.2 6034 typ host
a=candidate:1 2 udp 2130706430 fe80::fa8f:caff:fe12:da20 6035 typ host
a=candidate:2 2 udp 2130706430 10.0.0.2 6035 typ host

我的代码每个流我都添加了一个收割机(不确定这是否正确):

public void createStream( String name ) throws BindException, IllegalArgumentException, IOException {
        IceMediaStream stream = agent.createMediaStream(name);
        int rtpPort = getStreamPort();
        Thread t = new Thread(){
            @Override
            public void run(){
                StunCandidateHarvester stunHarv = new StunCandidateHarvester(
                        new TransportAddress("sip-communicator.net",
                                rtpPort, Transport.UDP));
                StunCandidateHarvester stun6Harv = new StunCandidateHarvester(
                        new TransportAddress("ipv6.sip-communicator.net",
                                rtpPort, Transport.UDP));
                agent.addCandidateHarvester(stunHarv);
                agent.addCandidateHarvester(stun6Harv);
                String[] hostnames = new String[] { 
                        "jitsi.org",
                        "numb.viagenie.ca",
                        "stun01.sipphone.com",
                        "stun.ekiga.net",
                        "stun.fwdnet.net",
                        "stun.ideasip.com",
                        "stun.iptel.org",
                        "stun.rixtelecom.se",
                        "stun.schlund.de",
                        "stun.l.google.com:19302",
                        "stun1.l.google.com:19302",
                        "stun2.l.google.com:19302",
                        "stun3.l.google.com:19302",
                        "stun4.l.google.com:19302",
                        "stunserver.org",
                        "stun.softjoys.com",
                        "stun.voiparound.com",
                        "stun.voipbuster.com",
                        "stun.voipstunt.com",
                        "stun.voxgratia.org",
                        "stun.xten.com",};

                LongTermCredential longTermCredential = new LongTermCredential("guest", "anon");

                for (String hostname : hostnames)
                    agent.addCandidateHarvester(new TurnCandidateHarvester(new TransportAddress(hostname, rtpPort, Transport.UDP), longTermCredential));
            }
        };
        t.start();
        agent.createComponent(stream, Transport.UDP, rtpPort, rtpPort, rtpPort+100);
        agent.createComponent(stream, Transport.UDP, rtpPort+1, rtpPort+1, rtpPort+101);

    }

有什么想法吗?为什么我只能获得本地 IP 地址?

4

0 回答 0