diff --git a/jingle/extension/build/merge/jstun.jar b/jingle/extension/build/merge/jstun.jar index f76af9cdd..80c237b63 100644 Binary files a/jingle/extension/build/merge/jstun.jar and b/jingle/extension/build/merge/jstun.jar differ diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/IncomingJingleSession.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/IncomingJingleSession.java index b6dd0293b..b7b15cbaf 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/IncomingJingleSession.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/IncomingJingleSession.java @@ -310,6 +310,7 @@ public class IncomingJingleSession extends JingleSession { .getBestCommonAudioPt(); TransportCandidate bestRemoteCandidate = getTransportNeg() .getBestRemoteCandidate(); + TransportCandidate acceptedLocalCandidate = getTransportNeg() .getAcceptedLocalCandidate(); diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSession.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSession.java index a64d07011..f3d9a73e8 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSession.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/JingleSession.java @@ -1072,6 +1072,10 @@ public abstract class JingleSession extends JingleNegotiator { jingleMediaSession.startTrasmit(); jingleMediaSession.startReceive(); + + for (TransportCandidate candidate : this.getTransportNeg().getOfferedCandidates()) + candidate.removeCandidateEcho(); + } } diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/ICECandidate.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/ICECandidate.java index eb6c25252..051f1f5e5 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/ICECandidate.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/ICECandidate.java @@ -257,6 +257,12 @@ public class ICECandidate extends TransportCandidate implements Comparable { // Media Proxy donīt have Echo features. // If its a relayed candidate we assumpt that is Checked. if (getType().equals("relay")) { + try { + Thread.sleep(TransportNegotiator.CANDIDATES_ACCEPT_PERIOD*2); + } + catch (InterruptedException e) { + // Do Nothing + } triggerCandidateChecked(true); return; } diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportCandidate.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportCandidate.java index a26aad856..b064c4dd2 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportCandidate.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportCandidate.java @@ -668,7 +668,7 @@ public abstract class TransportCandidate { socket.receive(packet); - System.out.println("ECHO Packet Received in: " + socket.getLocalAddress().getHostAddress() + ":" + socket.getLocalPort() + " From: " + packet.getAddress().getHostAddress() + ":" + packet.getPort()); + //System.out.println("ECHO Packet Received in: " + socket.getLocalAddress().getHostAddress() + ":" + socket.getLocalPort() + " From: " + packet.getAddress().getHostAddress() + ":" + packet.getPort()); for (DatagramListener listener : listeners) { listener.datagramReceived(packet); diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportNegotiator.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportNegotiator.java index 688c0d9fa..50b980910 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportNegotiator.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportNegotiator.java @@ -52,7 +52,7 @@ public abstract class TransportNegotiator extends JingleNegotiator { // The time we give to the candidates check before we accept or decline the // transport (in milliseconds) - private final static int CANDIDATES_ACCEPT_PERIOD = 3000; + public final static int CANDIDATES_ACCEPT_PERIOD = 3000; // The session this nenotiator belongs to private final JingleSession session; @@ -171,6 +171,10 @@ public abstract class TransportNegotiator extends JingleNegotiator { } + public List getOfferedCandidates() { + return offeredCandidates; + } + /** * Obtain the best common transport candidate obtained in the negotiation. * @@ -559,7 +563,7 @@ public abstract class TransportNegotiator extends JingleNegotiator { JingleListener li = (JingleListener) listener; if (li instanceof JingleTransportListener) { JingleTransportListener mli = (JingleTransportListener) li; - System.out.println("triggerTransportEstablished " + local.getLocalIp()); + System.out.println("triggerTransportEstablished " + local.getLocalIp() + ":" + local.getPort() + "|" + remote.getIp() + ":" + remote.getPort()); mli.transportEstablished(local, remote); } } @@ -748,11 +752,6 @@ public abstract class TransportNegotiator extends JingleNegotiator { */ public void eventEnter() { System.out.println("Transport stabilished"); - - for (TransportCandidate transportCandidate : offeredCandidates) - if (transportCandidate.getCandidateEcho() != null) - transportCandidate.removeCandidateEcho(); - triggerTransportEstablished(getAcceptedLocalCandidate(), getBestRemoteCandidate()); super.eventEnter(); @@ -807,6 +806,7 @@ public abstract class TransportNegotiator extends JingleNegotiator { // Hopefully, we only have one validRemoteCandidate ArrayList cands = getValidRemoteCandidatesList(); if (!cands.isEmpty()) { + System.out.println("RAW CAND"); return (TransportCandidate) cands.get(0); } else { @@ -872,6 +872,9 @@ public abstract class TransportNegotiator extends JingleNegotiator { result = chose; } + if (result != null && result.getType().equals("relay")) + System.out.println("Relay Type"); + return result; } diff --git a/jingle/extension/test/org/jivesoftware/smackx/jingle/JingleMediaTest.java b/jingle/extension/test/org/jivesoftware/smackx/jingle/JingleMediaTest.java index bf84d9e43..70f7d414b 100644 --- a/jingle/extension/test/org/jivesoftware/smackx/jingle/JingleMediaTest.java +++ b/jingle/extension/test/org/jivesoftware/smackx/jingle/JingleMediaTest.java @@ -96,7 +96,7 @@ public class JingleMediaTest extends SmackTestCase { js0.start(); - Thread.sleep(10000); + Thread.sleep(50000); js0.terminate(); jm1.removeJingleSessionRequestListener(jingleSessionRequestListener);