我把它连接到本地内部网很好,但当然这一点在我的路由器之外,我遇到了问题。我不认为我看到列表中的公共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地址?