From 01abc3a79700a501691fd5ffc3ab084e8cd26ce5 Mon Sep 17 00:00:00 2001 From: Thiago Camargo Date: Mon, 29 Jan 2007 23:45:13 +0000 Subject: [PATCH] ICE Transport now uses Wildfire Media Proxy as a last resort git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6869 b35dd754-fafc-0310-a699-88a17e54d16e --- jingle/extension/build/merge/jstun-0.6.1.jar | Bin 73886 -> 74676 bytes .../smackx/jingle/nat/ICEResolver.java | 83 +++++++++++++++-- .../jingle/nat/ICETransportManager.java | 48 ++++++++-- .../smackx/jingle/nat/TransportCandidate.java | 22 ++++- .../jingle/nat/TransportNegotiator.java | 73 +++++++++------ .../smackx/packet/JingleTransport.java | 1 + .../provider/JingleTransportProvider.java | 32 +++++-- .../smackx/jingle/nat/STUNResolverTest.java | 45 +++++---- .../jingle/nat/TransportCandidateTest.java | 87 +++++++++--------- .../jingleaudio/jmf/JmfMediaManager.java | 8 +- .../jingleaudio/jspeex/SpeexMediaManager.java | 12 +-- jingle/media/test/JingleMediaTest.java | 59 ++++++++---- 12 files changed, 322 insertions(+), 148 deletions(-) diff --git a/jingle/extension/build/merge/jstun-0.6.1.jar b/jingle/extension/build/merge/jstun-0.6.1.jar index f2a5f1faacf53d4e90ab8cdd52839c789910f62d..f65b8adab9781d70a01a0eddeb5fe1fda0cbfe78 100644 GIT binary patch delta 13849 zcmZX5Wk6iZvMz%&xVyW%LkR8`+}+)s2^Jhe1{hp|ySsaE2oRj$9z0kAd4#>+yXV|D z^JBjLx~jTYb+1|7y{dBhU>iqZQPmV-U~!-jU%onpqDiQJuv-2?d`U5+|NK_aU}_hN z@?IEu z1Pud#)R0LngZQd#!YK@?MF*fau(8MiV6 zD^2|)I;+a{DpguZ2^KZNfqcXPz&D7iDI@=786~75*=Y22mvhpo6lt9W=0QaDw^pq0MNcbYMAgt0-YV zGi=l{Y_rD1z}x08((3I{VAQzrX473%dotP&)X_>l__41#}tR0** zFC)L&m=>JA?mXzs?D_MsgZV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bbU$cI}TssI(vl*^x!jW4texhGCxx!_D-BsBx@GrL07> zAL4<`w{F*P9JZI6Pf_~M7|tdj7RIzi&sxrV=lA(ibNcpVs9BfF6I*tw*=wu&`p-j{ zVKr=`HNEjU3z7P@zWzsxzKYg;9@f1-4%z*%5|%aAI<43GZ!daR8-qM023Nr59qPlq zRole#`zrSG(y*&-rbDUi0Zf~M1+Y01Gjp(bhX(&wFb*qMB(%PHh6455ZQ?Srlc6*k7Vht#xd}8an-l@#&TGw9i^f!G&?+d!Cq7Aj*ST`H*hh(x1 zDnu9gv2$2WO06A)Y@dSsE5M4qv^p283 zoi*SQQHc3QN&Ty;h{1-at7bw8c2;oQ7)a4!L%w7K=un`wCUkx8FF}gB+##euyCC=_ zdeb7U@Bwa=-7jX`|5vHxMjVlVkYCsVnx+;k;1#+o)^sh-`3FT3126#Vy6TC7@HZFN*u0_`t08?D|EBRRBj8ASlcN8-PDV;F0lK$txPPDZ{xeT7>YgJ2C==pV9HZbpZ2*%B z<4^Va+BEpz^Hl8LlM5p<^{)~(;xHBTAH^GQ1~Gl9IK&tjPgpQ8RR5#M_3}pXW*!qF zW0(N}bZ~xrnF&ic7#Q-`D*XQu&#wGmaVG4WxsD`b0T?hRUn7(oS&?^H0Dep|)HPN> zHnRc5$PN~O1v9S+G1dx3heU|+XO;ZFwecSxU)~@nI=PSztN<@2OUE_lK;QW8BX6b%=K47@84I8# z`}ZJS=NkForj!2SrjrGk&HmSS?G0;#fn?(VXpyB@0LA|sqk?*C< sortedCandidates = cc.getSortedCandidates(); for (Candidate candidate : cc.getSortedCandidates()) try { - TransportCandidate transportCandidate = new TransportCandidate.Ice(candidate.getAddress().getInetAddress().getHostAddress(), 1, candidate.getNetwork(), "1", candidate.getPort(), "1", candidate.getPriority()); + Candidate.CandidateType type = candidate.getCandidateType(); + String typeString = "local"; + if (type.equals(Candidate.CandidateType.ServerReflexive)) + typeString = "srflx"; + else if (type.equals(Candidate.CandidateType.PeerReflexive)) + typeString = "prflx"; + else if (type.equals(Candidate.CandidateType.Relayed)) + typeString = "relay"; + else + typeString = "host"; + + TransportCandidate transportCandidate = new TransportCandidate.Ice(candidate.getAddress().getInetAddress().getHostAddress(), 1, candidate.getNetwork(), "1", candidate.getPort(), "1", candidate.getPriority(), typeString); transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress()); + transportCandidate.setPort(getFreePort()); this.addCandidate(transportCandidate); System.out.println("C: " + candidate.getAddress().getInetAddress() + "|" + candidate.getBase().getAddress().getInetAddress() + " p:" + candidate.getPriority()); - } catch (UtilityException e) { - e.printStackTrace(); - } catch (UnknownHostException e) { + + } + catch (UtilityException e) { e.printStackTrace(); } + catch (UnknownHostException e) { + e.printStackTrace(); + } + + if (RTPBridge.serviceAvailable(connection)) { + try { + String localIp = cc.getPublicCandidate().getBase().getAddress().getInetAddress().getHostAddress(); + + sid = Math.abs(random.nextLong()); + + RTPBridge rtpBridge = RTPBridge.getRTPBridge(connection, String.valueOf(sid)); + + TransportCandidate localCandidate = new TransportCandidate.Ice( + rtpBridge.getIp(), 1, cc.getPublicCandidate().getNetwork(), "1", rtpBridge.getPortA(), "1", 0, "relay"); + localCandidate.setLocalIp(localIp); + + TransportCandidate remoteCandidate = new TransportCandidate.Ice( + rtpBridge.getIp(), 1, cc.getPublicCandidate().getNetwork(), "1", rtpBridge.getPortB(), "1", 0, "relay"); + remoteCandidate.setLocalIp(localIp); + + localCandidate.setSymmetric(remoteCandidate); + remoteCandidate.setSymmetric(localCandidate); + + localCandidate.setPassword(rtpBridge.getPass()); + remoteCandidate.setPassword(rtpBridge.getPass()); + + localCandidate.setSessionId(rtpBridge.getSid()); + remoteCandidate.setSessionId(rtpBridge.getSid()); + + localCandidate.setConnection(this.connection); + remoteCandidate.setConnection(this.connection); + + addCandidate(localCandidate); + + } + catch (UtilityException e) { + e.printStackTrace(); + } + catch (UnknownHostException e) { + e.printStackTrace(); + } + + } + } this.setInitialized(); } diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/ICETransportManager.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/ICETransportManager.java index b21e54f54..45331ac40 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/ICETransportManager.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/ICETransportManager.java @@ -1,35 +1,41 @@ package org.jivesoftware.smackx.jingle.nat; import org.jivesoftware.smack.XMPPException; +import org.jivesoftware.smack.XMPPConnection; +import org.jivesoftware.smackx.jingle.media.PayloadType; +import org.jivesoftware.smackx.jingle.JingleSession; +import org.jivesoftware.smackx.jingle.listeners.JingleSessionListener; +import org.jivesoftware.smackx.jingle.listeners.CreatedJingleSessionListener; /** * $RCSfile$ * $Revision: $ * $Date: 02/01/2007 - * + *

* Copyright 2003-2006 Jive Software. - * + *

* All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + *

* http://www.apache.org/licenses/LICENSE-2.0 - * + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ -public class ICETransportManager extends JingleTransportManager { +public class ICETransportManager extends JingleTransportManager implements JingleSessionListener, CreatedJingleSessionListener { ICEResolver iceResolver = null; - public ICETransportManager() { - iceResolver = new ICEResolver(); + public ICETransportManager(XMPPConnection xmppConnection, String server, int port) { + iceResolver = new ICEResolver(xmppConnection, server, port); try { iceResolver.initializeAndWait(); - } catch (XMPPException e) { + } + catch (XMPPException e) { e.printStackTrace(); } } @@ -37,10 +43,34 @@ public class ICETransportManager extends JingleTransportManager { protected TransportResolver createResolver() { try { iceResolver.resolve(); - } catch (XMPPException e) { + } + catch (XMPPException e) { e.printStackTrace(); } return iceResolver; } + // Implement a Session Listener to relay candidates after establishment + + public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) { + RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc); + } + + public void sessionDeclined(String reason, JingleSession jingleSession) { + } + + public void sessionRedirected(String redirection, JingleSession jingleSession) { + } + + public void sessionClosed(String reason, JingleSession jingleSession) { + } + + public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) { + } + + // Session Created + + public void sessionCreated(JingleSession jingleSession) { + jingleSession.addListener(this); + } } 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 849fb25c6..1a660a7c5 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportCandidate.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportCandidate.java @@ -452,6 +452,8 @@ public abstract class TransportCandidate { private int network; + private String type; + public Ice() { super(); } @@ -468,10 +470,11 @@ public abstract class TransportCandidate { * @param username user name, as it is used in ICE * @param preference preference for this transportElement, as it is used * in ICE + * @param type type as defined in ICE-12 */ public Ice(String ip, int generation, int network, String password, int port, String username, - int preference) { + int preference, String type) { super(ip, port, generation); proto = Protocol.UDP; @@ -481,6 +484,7 @@ public abstract class TransportCandidate { this.password = password; this.username = username; this.preference = preference; + this.type = type; } /** @@ -592,6 +596,22 @@ public abstract class TransportCandidate { this.preference = preference; } + /** + * Get the Candidate Type + * @return candidate Type + */ + public String getType() { + return type; + } + + /** + * Set the Candidate Type + * @param type candidate type. + */ + public void setType(String type) { + this.type = type; + } + /* * (non-Javadoc) * 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 a76d0c3ad..46b3ce534 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportNegotiator.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/nat/TransportNegotiator.java @@ -21,8 +21,8 @@ import java.util.List; /** * Transport negotiator. - * - * + *

+ *

* This class is responsible for managing the transport negotiation process, * handling all the packet interchange and the stage control. * @@ -74,7 +74,7 @@ public abstract class TransportNegotiator extends JingleNegotiator { * @param transResolver The JingleTransportManager to use */ public TransportNegotiator(JingleSession js, - TransportResolver transResolver) { + TransportResolver transResolver) { super(js.getConnection()); session = js; @@ -201,7 +201,7 @@ public abstract class TransportNegotiator extends JingleNegotiator { System.out.println("CHECK"); offeredCandidate.addListener(new TransportResolverListener.Checker() { public void candidateChecked(TransportCandidate cand, - final boolean validCandidate) { + final boolean validCandidate) { if (validCandidate) { addValidRemoteCandidate(offeredCandidate); } @@ -252,7 +252,8 @@ public abstract class TransportNegotiator extends JingleNegotiator { try { Thread.sleep(CANDIDATES_ACCEPT_PERIOD + TransportResolver.CHECK_TIMEOUT); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { e.printStackTrace(); } @@ -439,31 +440,37 @@ public abstract class TransportNegotiator extends JingleNegotiator { setState(inviting); jout = getState().eventInvite(); - } else { + } + else { if (iq instanceof Jingle) { // If there is no specific jmf action associated, then we // are being invited to a new session... setState(accepting); jout = getState().eventInitiate((Jingle) iq); - } else { + } + else { throw new IllegalStateException( "Invitation IQ received is not a Jingle packet in Transport negotiator."); } } - } else { + } + else { if (iq == null) { return null; - } else { + } + else { if (iq.getType().equals(IQ.Type.ERROR)) { // Process errors getState().eventError(iq); - } else if (iq.getType().equals(IQ.Type.RESULT)) { + } + else if (iq.getType().equals(IQ.Type.RESULT)) { // Process ACKs if (isExpectedId(iq.getPacketID())) { jout = getState().eventAck(iq); removeExpectedId(iq.getPacketID()); } - } else if (iq instanceof Jingle) { + } + else if (iq instanceof Jingle) { // Get the action from the Jingle packet Jingle jin = (Jingle) iq; Jingle.Action action = jin.getAction(); @@ -471,11 +478,14 @@ public abstract class TransportNegotiator extends JingleNegotiator { if (action != null) { if (action.equals(Jingle.Action.TRANSPORTACCEPT)) { jout = getState().eventAccept(jin); - } else if (action.equals(Jingle.Action.TRANSPORTDECLINE)) { + } + else if (action.equals(Jingle.Action.TRANSPORTDECLINE)) { jout = getState().eventDecline(jin); - } else if (action.equals(Jingle.Action.TRANSPORTINFO)) { + } + else if (action.equals(Jingle.Action.TRANSPORTINFO)) { jout = getState().eventInfo(jin); - } else if (action.equals(Jingle.Action.TRANSPORTMODIFY)) { + } + else if (action.equals(Jingle.Action.TRANSPORTMODIFY)) { jout = getState().eventModify(jin); } } @@ -486,7 +496,8 @@ public abstract class TransportNegotiator extends JingleNegotiator { // Save the Id for any ACK if (id != null) { addExpectedId(id); - } else { + } + else { if (jout != null) { addExpectedId(jout.getPacketID()); } @@ -502,7 +513,7 @@ public abstract class TransportNegotiator extends JingleNegotiator { * @param remote TransportCandidate that has been agreed. */ private void triggerTransportEstablished(TransportCandidate local, - TransportCandidate remote) { + TransportCandidate remote) { ArrayList listeners = getListenersList(); for (Object listener : listeners) { JingleListener li = (JingleListener) listener; @@ -584,6 +595,7 @@ public abstract class TransportNegotiator extends JingleNegotiator { * connection... */ public final class Accepting extends JingleNegotiator.State { + public Accepting(TransportNegotiator neg) { super(neg); } @@ -751,7 +763,8 @@ public abstract class TransportNegotiator extends JingleNegotiator { ArrayList cands = getValidRemoteCandidatesList(); if (!cands.isEmpty()) { return (TransportCandidate) cands.get(0); - } else { + } + else { System.out.println("No Remote Candidate"); return null; } @@ -803,13 +816,13 @@ public abstract class TransportNegotiator extends JingleNegotiator { ArrayList cands = getValidRemoteCandidatesList(); if (!cands.isEmpty()) { - int lowest = 65560; + int highest = -1; TransportCandidate.Ice chose = null; for (TransportCandidate.Ice transportCandidate : cands) { System.out.println("Pref: " + transportCandidate.getPreference() + " :" + transportCandidate.getIp()); - if (transportCandidate.getPreference() < lowest) { + if (transportCandidate.getPreference() > highest) { chose = transportCandidate; - lowest = transportCandidate.getPreference(); + highest = transportCandidate.getPreference(); } } result = chose; @@ -822,20 +835,24 @@ public abstract class TransportNegotiator extends JingleNegotiator { * Return true for ICE candidates. */ public boolean acceptableTransportCandidate(TransportCandidate tc) { - try { + TransportCandidate.Ice ice = (TransportCandidate.Ice) tc; + if (ice.getType().equals("relay")) return true; + if(true) return false; InetAddress.getByName(tc.getIp()).isReachable(3000); - DatagramSocket socket = new DatagramSocket(0); + DatagramSocket socket = new DatagramSocket(0); socket.connect(InetAddress.getByName(tc.getIp()), tc.getPort()); return true; - } catch (SocketException e) { - e.printStackTrace(); - } catch (UnknownHostException e) { - e.printStackTrace(); - } catch (IOException e) { + } + catch (SocketException e) { + e.printStackTrace(); + } + catch (UnknownHostException e) { + e.printStackTrace(); + } + catch (IOException e) { e.printStackTrace(); } - return false; } } diff --git a/jingle/extension/source/org/jivesoftware/smackx/packet/JingleTransport.java b/jingle/extension/source/org/jivesoftware/smackx/packet/JingleTransport.java index 6e0c6c520..cd09caf79 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/packet/JingleTransport.java +++ b/jingle/extension/source/org/jivesoftware/smackx/packet/JingleTransport.java @@ -314,6 +314,7 @@ public class JingleTransport implements PacketExtension { buf.append(" username=\"").append(tci.getUsername()).append("\""); buf.append(" password=\"").append(tci.getPassword()).append("\""); buf.append(" preference=\"").append(tci.getPreference()).append("\""); + buf.append(" type=\"").append(tci.getType()).append("\""); // Optional elements if (transportCandidate.getName() != null) { diff --git a/jingle/extension/source/org/jivesoftware/smackx/provider/JingleTransportProvider.java b/jingle/extension/source/org/jivesoftware/smackx/provider/JingleTransportProvider.java index f87d73969..9f53af795 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/provider/JingleTransportProvider.java +++ b/jingle/extension/source/org/jivesoftware/smackx/provider/JingleTransportProvider.java @@ -50,10 +50,12 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider if (name.equals(JingleTransportCandidate.NODENAME)) { JingleTransportCandidate jtc = parseCandidate(parser); if (jtc != null) trans.addCandidate(jtc); - } else { + } + else { throw new Exception("Unknown tag \"" + name + "\" in transport element."); } - } else if (eventType == XmlPullParser.END_TAG) { + } + else if (eventType == XmlPullParser.END_TAG) { if (name.equals(JingleTransport.NODENAME)) { done = true; } @@ -107,6 +109,7 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider String port = parser.getAttributeValue("", "port"); String preference = parser.getAttributeValue("", "preference"); String proto = parser.getAttributeValue("", "proto"); + String type = parser.getAttributeValue("", "type"); if (channel != null) { mt.setChannel(new TransportCandidate.Channel(channel)); @@ -115,13 +118,15 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider if (generation != null) { try { mt.setGeneration(Integer.parseInt(generation)); - } catch (Exception e) { + } + catch (Exception e) { } } if (ip != null) { mt.setIp(ip); - } else { + } + else { return null; } @@ -132,7 +137,8 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider if (network != null) { try { mt.setNetwork(Integer.parseInt(network)); - } catch (Exception e) { + } + catch (Exception e) { } } @@ -147,14 +153,16 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider if (port != null) { try { mt.setPort(Integer.parseInt(port)); - } catch (Exception e) { + } + catch (Exception e) { } } if (preference != null) { try { mt.setPreference(Integer.parseInt(preference)); - } catch (Exception e) { + } + catch (Exception e) { } } @@ -162,6 +170,10 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider mt.setProto(new TransportCandidate.Protocol(proto)); } + if (type != null) { + mt.setType(type); + } + return new JingleTransport.Ice.Candidate(mt); } } @@ -207,7 +219,8 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider if (generation != null) { try { mt.setGeneration(Integer.parseInt(generation)); - } catch (Exception e) { + } + catch (Exception e) { } } @@ -222,7 +235,8 @@ public abstract class JingleTransportProvider implements PacketExtensionProvider if (port != null) { try { mt.setPort(Integer.parseInt(port)); - } catch (Exception e) { + } + catch (Exception e) { } } return new JingleTransport.RawUdp.Candidate(mt); diff --git a/jingle/extension/test/org/jivesoftware/smackx/jingle/nat/STUNResolverTest.java b/jingle/extension/test/org/jivesoftware/smackx/jingle/nat/STUNResolverTest.java index e058df44d..4483d8f6a 100644 --- a/jingle/extension/test/org/jivesoftware/smackx/jingle/nat/STUNResolverTest.java +++ b/jingle/extension/test/org/jivesoftware/smackx/jingle/nat/STUNResolverTest.java @@ -59,15 +59,15 @@ public class STUNResolverTest extends SmackTestCase { int highestPref = 100; TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 3, 2, - "password", 3468, "username1", 1); + "password", 3468, "username1", 1, ""); TransportCandidate cand2 = new TransportCandidate.Ice("192.168.5.1", 2, 10, - "password", 3469, "username2", 15); + "password", 3469, "username2", 15, ""); TransportCandidate candH = new TransportCandidate.Ice("192.168.2.11", 1, 2, - "password", 3468, "usernameH", highestPref); + "password", 3468, "usernameH", highestPref, ""); TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.10", 2, 10, - "password", 3469, "username3", 2); + "password", 3469, "username3", 2, ""); TransportCandidate cand4 = new TransportCandidate.Ice("192.168.4.1", 3, 2, - "password", 3468, "username4", 78); + "password", 3468, "username4", 78, ""); STUNResolver stunResolver = new STUNResolver() { }; @@ -89,17 +89,17 @@ public class STUNResolverTest extends SmackTestCase { int highestPref = 100; TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 3, 2, - "password", 3468, "username1", 1); + "password", 3468, "username1", 1, ""); TransportCandidate cand2 = new TransportCandidate.Ice("192.168.5.1", 2, 10, - "password", 3469, "username2", 15); + "password", 3469, "username2", 15, ""); TransportCandidate candH = new TransportCandidate.Ice("192.168.2.11", 1, 2, - "password", 3468, "usernameH", highestPref); + "password", 3468, "usernameH", highestPref, ""); TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.10", 2, 10, - "password", 3469, "username3", 2); + "password", 3469, "username3", 2, ""); TransportCandidate cand4 = new TransportCandidate.Ice("192.168.4.1", 3, 2, - "password", 3468, "username4", 78); + "password", 3468, "username4", 78, ""); - ICEResolver iceResolver = new ICEResolver() { + ICEResolver iceResolver = new ICEResolver(getConnection(0), "stun.xten.net", 3478) { }; iceResolver.addCandidate(cand1); iceResolver.addCandidate(cand2); @@ -131,12 +131,14 @@ public class STUNResolverTest extends SmackTestCase { for (Candidate candidate : cc.getSortedCandidates()) try { - TransportCandidate transportCandidate = new TransportCandidate.Ice(candidate.getAddress().getInetAddress().getHostAddress(), 1, candidate.getNetwork(), "1", candidate.getPort(), "1", candidate.getPriority()); + TransportCandidate transportCandidate = new TransportCandidate.Ice(candidate.getAddress().getInetAddress().getHostAddress(), 1, candidate.getNetwork(), "1", candidate.getPort(), "1", candidate.getPriority(), ""); transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress()); System.out.println("C: " + candidate.getAddress().getInetAddress() + "|" + candidate.getBase().getAddress().getInetAddress() + " p:" + candidate.getPriority()); - } catch (UtilityException e) { + } + catch (UtilityException e) { e.printStackTrace(); - } catch (UnknownHostException e) { + } + catch (UnknownHostException e) { e.printStackTrace(); } Candidate candidate = cc.getSortedCandidates().get(0); @@ -166,7 +168,7 @@ public class STUNResolverTest extends SmackTestCase { System.out.println(STUN.serviceAvailable(getConnection(0))); STUN stun = STUN.getSTUNServer(getConnection(0)); - System.out.println(stun.getHost() + ":" +stun.getPort()); + System.out.println(stun.getHost() + ":" + stun.getPort()); } @@ -206,7 +208,8 @@ public class STUNResolverTest extends SmackTestCase { Thread.sleep(55000); assertTrue(valCounter() > 0); stunResolver.resolve(); - } catch (Exception e) { + } + catch (Exception e) { e.printStackTrace(); } } @@ -282,7 +285,7 @@ public class STUNResolverTest extends SmackTestCase { } public void sessionEstablished(PayloadType pt, - TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) { + TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) { incCounter(); System.out .println("Responder: the session is fully established."); @@ -297,7 +300,8 @@ public class STUNResolverTest extends SmackTestCase { } }); session1.start(request); - } catch (XMPPException e) { + } + catch (XMPPException e) { e.printStackTrace(); } } @@ -319,7 +323,7 @@ public class STUNResolverTest extends SmackTestCase { } public void sessionEstablished(PayloadType pt, - TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) { + TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) { incCounter(); System.out.println("Initiator: the session is fully established."); System.out.println("+ Payload Type: " + pt.getId()); @@ -338,7 +342,8 @@ public class STUNResolverTest extends SmackTestCase { assertTrue(valCounter() == 2); - } catch (Exception e) { + } + catch (Exception e) { e.printStackTrace(); fail("An error occured with Jingle"); } diff --git a/jingle/extension/test/org/jivesoftware/smackx/jingle/nat/TransportCandidateTest.java b/jingle/extension/test/org/jivesoftware/smackx/jingle/nat/TransportCandidateTest.java index 2aee30e70..53676b6cf 100644 --- a/jingle/extension/test/org/jivesoftware/smackx/jingle/nat/TransportCandidateTest.java +++ b/jingle/extension/test/org/jivesoftware/smackx/jingle/nat/TransportCandidateTest.java @@ -2,58 +2,59 @@ package org.jivesoftware.smackx.jingle.nat; import java.util.ArrayList; import java.util.Collections; + import org.jivesoftware.smack.test.SmackTestCase; public class TransportCandidateTest extends SmackTestCase { - public TransportCandidateTest(final String arg0) { - super(arg0); - } + public TransportCandidateTest(final String arg0) { + super(arg0); + } - /** - * Test for equals() - */ - public void testEqualsObject() { - TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 1, 2, - "password", 3468, "username", 25); - TransportCandidate cand2 = new TransportCandidate.Ice("192.168.2.1", 1, 2, - "password", 3468, "username", 25); - TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.1", 1, 2, - "password", 3469, "username", 25); + /** + * Test for equals() + */ + public void testEqualsObject() { + TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 1, 2, + "password", 3468, "username", 25, ""); + TransportCandidate cand2 = new TransportCandidate.Ice("192.168.2.1", 1, 2, + "password", 3468, "username", 25, ""); + TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.1", 1, 2, + "password", 3469, "username", 25, ""); - assertEquals(cand1, cand2); - assertFalse(cand1.equals(cand3)); - } + assertEquals(cand1, cand2); + assertFalse(cand1.equals(cand3)); + } - /** - * Test for compareTo() - */ - public void testCompareTo() { - int highestPref = 100; + /** + * Test for compareTo() + */ + public void testCompareTo() { + int highestPref = 100; - TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 3, 2, - "password", 3468, "username", 1); - TransportCandidate cand2 = new TransportCandidate.Ice("192.168.5.1", 2, 10, - "password", 3469, "username", 15); - TransportCandidate candH = new TransportCandidate.Ice("192.168.2.1", 1, 2, - "password", 3468, "username", highestPref); - TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.10", 2, 10, - "password", 3469, "username", 2); - TransportCandidate cand4 = new TransportCandidate.Ice("192.168.4.1", 3, 2, - "password", 3468, "username", 78); + TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 3, 2, + "password", 3468, "username", 1, ""); + TransportCandidate cand2 = new TransportCandidate.Ice("192.168.5.1", 2, 10, + "password", 3469, "username", 15, ""); + TransportCandidate candH = new TransportCandidate.Ice("192.168.2.1", 1, 2, + "password", 3468, "username", highestPref, ""); + TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.10", 2, 10, + "password", 3469, "username", 2, ""); + TransportCandidate cand4 = new TransportCandidate.Ice("192.168.4.1", 3, 2, + "password", 3468, "username", 78, ""); - ArrayList candList = new ArrayList(); - candList.add(cand1); - candList.add(cand2); - candList.add(candH); - candList.add(cand3); - candList.add(cand4); + ArrayList candList = new ArrayList(); + candList.add(cand1); + candList.add(cand2); + candList.add(candH); + candList.add(cand3); + candList.add(cand4); - Collections.sort(candList); - assertEquals(candList.get(candList.size() - 1), candH); - } + Collections.sort(candList); + assertEquals(candList.get(candList.size() - 1), candH); + } - protected int getMaxConnections() { - return 0; - } + protected int getMaxConnections() { + return 0; + } } diff --git a/jingle/media/source/org/jivesoftware/jingleaudio/jmf/JmfMediaManager.java b/jingle/media/source/org/jivesoftware/jingleaudio/jmf/JmfMediaManager.java index a6f0e3dd1..adf4ea0ac 100644 --- a/jingle/media/source/org/jivesoftware/jingleaudio/jmf/JmfMediaManager.java +++ b/jingle/media/source/org/jivesoftware/jingleaudio/jmf/JmfMediaManager.java @@ -24,6 +24,7 @@ import org.jivesoftware.smackx.jingle.media.JingleMediaManager; import org.jivesoftware.smackx.jingle.media.JingleMediaSession; import org.jivesoftware.smackx.jingle.media.PayloadType; import org.jivesoftware.smackx.jingle.nat.TransportCandidate; +import org.jivesoftware.jingleaudio.JMFInit; import java.io.File; import java.io.IOException; @@ -101,10 +102,9 @@ public class JmfMediaManager extends JingleMediaManager { // should be and put it there. runLinuxPreInstall(); - if (jmfProperties.length() == 0) { - //JMFInit init = new JMFInit(null); - //init.setVisible(false); - } + //if (jmfProperties.length() == 0) { + JMFInit init = new JMFInit(null, false); + //} } finally { diff --git a/jingle/media/source/org/jivesoftware/jingleaudio/jspeex/SpeexMediaManager.java b/jingle/media/source/org/jivesoftware/jingleaudio/jspeex/SpeexMediaManager.java index 6b8a61ecd..343e33999 100644 --- a/jingle/media/source/org/jivesoftware/jingleaudio/jspeex/SpeexMediaManager.java +++ b/jingle/media/source/org/jivesoftware/jingleaudio/jspeex/SpeexMediaManager.java @@ -4,6 +4,7 @@ import org.jivesoftware.smackx.jingle.media.JingleMediaManager; import org.jivesoftware.smackx.jingle.media.JingleMediaSession; import org.jivesoftware.smackx.jingle.media.PayloadType; import org.jivesoftware.smackx.jingle.nat.TransportCandidate; +import org.jivesoftware.jingleaudio.JMFInit; import java.io.File; import java.io.IOException; @@ -12,15 +13,15 @@ import java.io.IOException; * $RCSfile$ * $Revision: $ * $Date: 25/12/2006 - * + *

* Copyright 2003-2006 Jive Software. - * + *

* All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + *

* http://www.apache.org/licenses/LICENSE-2.0 - * + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -84,8 +85,7 @@ public class SpeexMediaManager extends JingleMediaManager { runLinuxPreInstall(); if (jmfProperties.length() == 0) { - //JMFInit init = new JMFInit(null); - //init.setVisible(false); + JMFInit init = new JMFInit(null, false); } } diff --git a/jingle/media/test/JingleMediaTest.java b/jingle/media/test/JingleMediaTest.java index ea3ccaec6..ceca7acfe 100644 --- a/jingle/media/test/JingleMediaTest.java +++ b/jingle/media/test/JingleMediaTest.java @@ -53,10 +53,16 @@ public class JingleMediaTest extends TestCase { x1.connect(); x1.login("barata6", "barata6"); + ICETransportManager icetm0 = new ICETransportManager(x0, "stun.xten.net", 3478); + ICETransportManager icetm1 = new ICETransportManager(x1, "stun.xten.net", 3478); + final JingleManager jm0 = new JingleManager( - x0, new ICETransportManager()); + x0, icetm0); final JingleManager jm1 = new JingleManager( - x1, new ICETransportManager()); + x1, icetm1); + + jm0.addCreationListener(icetm0); + jm1.addCreationListener(icetm1); JingleMediaManager jingleMediaManager0 = new JmfMediaManager(); JingleMediaManager jingleMediaManager1 = new JmfMediaManager(); @@ -70,7 +76,8 @@ public class JingleMediaTest extends TestCase { try { IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads()); session.start(request); - } catch (XMPPException e) { + } + catch (XMPPException e) { e.printStackTrace(); } @@ -89,7 +96,8 @@ public class JingleMediaTest extends TestCase { x0.disconnect(); x1.disconnect(); - } catch (Exception e) { + } + catch (Exception e) { e.printStackTrace(); } @@ -128,7 +136,8 @@ public class JingleMediaTest extends TestCase { IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads()); session.start(request); - } catch (XMPPException e) { + } + catch (XMPPException e) { e.printStackTrace(); } @@ -147,7 +156,8 @@ public class JingleMediaTest extends TestCase { x0.disconnect(); x1.disconnect(); - } catch (Exception e) { + } + catch (Exception e) { e.printStackTrace(); } @@ -178,8 +188,8 @@ public class JingleMediaTest extends TestCase { jm0.addCreationListener(btm0); jm1.addCreationListener(btm1); - JingleMediaManager jingleMediaManager = new SpeexMediaManager(); - JingleMediaManager jingleMediaManager2 = new SpeexMediaManager(); + JingleMediaManager jingleMediaManager = new JmfMediaManager(); + JingleMediaManager jingleMediaManager2 = new JmfMediaManager(); jm0.setMediaManager(jingleMediaManager); jm1.setMediaManager(jingleMediaManager2); @@ -191,7 +201,8 @@ public class JingleMediaTest extends TestCase { IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads()); session.start(request); - } catch (XMPPException e) { + } + catch (XMPPException e) { e.printStackTrace(); } @@ -211,7 +222,8 @@ public class JingleMediaTest extends TestCase { x0.disconnect(); x1.disconnect(); - } catch (Exception e) { + } + catch (Exception e) { e.printStackTrace(); } } @@ -222,7 +234,8 @@ public class JingleMediaTest extends TestCase { try { Thread.sleep(250000); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } @@ -262,7 +275,8 @@ public class JingleMediaTest extends TestCase { IncomingJingleSession session = request.accept(jm1.getMediaManager().getPayloads()); session.start(request); - } catch (XMPPException e) { + } + catch (XMPPException e) { e.printStackTrace(); } @@ -292,7 +306,8 @@ public class JingleMediaTest extends TestCase { x0.disconnect(); x1.disconnect(); - } catch (Exception e) { + } + catch (Exception e) { e.printStackTrace(); } @@ -310,7 +325,8 @@ public class JingleMediaTest extends TestCase { try { Thread.sleep(10000); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { e.printStackTrace(); } @@ -319,10 +335,12 @@ public class JingleMediaTest extends TestCase { try { Thread.sleep(3000); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { e.printStackTrace(); } - } catch (Exception e) { + } + catch (Exception e) { e.printStackTrace(); } } @@ -342,7 +360,8 @@ public class JingleMediaTest extends TestCase { try { Thread.sleep(10000); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { e.printStackTrace(); } @@ -351,11 +370,13 @@ public class JingleMediaTest extends TestCase { try { Thread.sleep(3000); - } catch (InterruptedException e) { + } + catch (InterruptedException e) { e.printStackTrace(); } } - } catch (Exception e) { + } + catch (Exception e) { e.printStackTrace(); } }