mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 14:02:06 +01:00
[SMACK-212] Added capability to try another way to establish the session. If just one side has Relay Server.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7987 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
60e0222c14
commit
b47038b82f
2 changed files with 36 additions and 1 deletions
|
@ -367,7 +367,7 @@ public class AudioChannel {
|
||||||
catch (InvalidSessionAddressException e) {
|
catch (InvalidSessionAddressException e) {
|
||||||
// In case the local address is not allowed to read, we user another local address
|
// In case the local address is not allowed to read, we user another local address
|
||||||
SessionAddress sessAddr = new SessionAddress();
|
SessionAddress sessAddr = new SessionAddress();
|
||||||
localAddr = new SessionAddress(InetAddress.getByName(sessAddr.getDataHostAddress()),
|
localAddr = new SessionAddress(sessAddr.getDataAddress(),
|
||||||
localPort);
|
localPort);
|
||||||
rtpMgrs[i].initialize(localAddr);
|
rtpMgrs[i].initialize(localAddr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,16 +321,51 @@ public abstract class TransportNegotiator extends JingleNegotiator {
|
||||||
TransportCandidate bestRemote = getBestRemoteCandidate();
|
TransportCandidate bestRemote = getBestRemoteCandidate();
|
||||||
|
|
||||||
if (bestRemote == null) {
|
if (bestRemote == null) {
|
||||||
|
boolean foundRemoteRelay = false;
|
||||||
for (TransportCandidate candidate : remoteCandidates) {
|
for (TransportCandidate candidate : remoteCandidates) {
|
||||||
if (candidate instanceof ICECandidate) {
|
if (candidate instanceof ICECandidate) {
|
||||||
ICECandidate iceCandidate = (ICECandidate) candidate;
|
ICECandidate iceCandidate = (ICECandidate) candidate;
|
||||||
if (iceCandidate.getType().equals("relay")) {
|
if (iceCandidate.getType().equals("relay")) {
|
||||||
//TODO Check if the relay is reacheable
|
//TODO Check if the relay is reacheable
|
||||||
addValidRemoteCandidate(iceCandidate);
|
addValidRemoteCandidate(iceCandidate);
|
||||||
|
foundRemoteRelay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If not found, check if we offered a relay. If yes, we should accept any remote candidate.
|
||||||
|
// We should accept the Public One if we received it, otherwise, accepts any.
|
||||||
|
if (!foundRemoteRelay) {
|
||||||
|
boolean foundLocalRelay = false;
|
||||||
|
for (TransportCandidate candidate : offeredCandidates) {
|
||||||
|
if (candidate instanceof ICECandidate) {
|
||||||
|
ICECandidate iceCandidate = (ICECandidate) candidate;
|
||||||
|
if (iceCandidate.getType().equals("relay")) {
|
||||||
|
foundLocalRelay = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (foundLocalRelay) {
|
||||||
|
boolean foundRemotePublic = false;
|
||||||
|
for (TransportCandidate candidate : remoteCandidates) {
|
||||||
|
if (candidate instanceof ICECandidate) {
|
||||||
|
ICECandidate iceCandidate = (ICECandidate) candidate;
|
||||||
|
if (iceCandidate.getType().equals("srflx")) {
|
||||||
|
addValidRemoteCandidate(iceCandidate);
|
||||||
|
foundRemotePublic = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!foundRemotePublic) {
|
||||||
|
for (TransportCandidate candidate : remoteCandidates) {
|
||||||
|
if (candidate instanceof ICECandidate) {
|
||||||
|
ICECandidate iceCandidate = (ICECandidate) candidate;
|
||||||
|
addValidRemoteCandidate(iceCandidate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
|
|
Loading…
Reference in a new issue