1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-23 11:07:57 +01:00

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
This commit is contained in:
Thiago Camargo 2007-01-29 23:45:13 +00:00 committed by thiago
parent 59a7863401
commit 01abc3a797
12 changed files with 322 additions and 148 deletions

View file

@ -24,9 +24,11 @@ import de.javawi.jstun.test.demo.ice.Candidate;
import de.javawi.jstun.test.demo.ice.ICENegociator;
import de.javawi.jstun.util.UtilityException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.XMPPConnection;
import java.net.UnknownHostException;
import java.util.List;
import java.util.Random;
/**
* ICE Resolver for Jingle transport method that results in sending data between two entities using the Interactive Connectivity Establishment (ICE) methodology. (XEP-0176)
@ -37,8 +39,17 @@ import java.util.List;
*/
public class ICEResolver extends TransportResolver {
public ICEResolver() {
XMPPConnection connection;
Random random = new Random();
long sid;
String server = "stun.xten.net";
int port = 3478;
public ICEResolver(XMPPConnection connection, String server, int port) {
super();
this.connection = connection;
this.server = server;
this.port = port;
this.setType(Type.ice);
}
@ -46,25 +57,79 @@ public class ICEResolver extends TransportResolver {
if (!isResolving() && !isResolved()) {
System.out.println("Initialized");
ICENegociator cc = new ICENegociator((short) 1);
ICENegociator cc = new ICENegociator((short) 1, server, port);
// gather candidates
cc.gatherCandidateAddresses();
// priorize candidates
cc.prioritizeCandidates();
// get SortedCandidates
//List<Candidate> 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();
}

View file

@ -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
*
* <p/>
* Copyright 2003-2006 Jive Software.
*
* <p/>
* 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
*
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p/>
* 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);
}
}

View file

@ -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)
*

View file

@ -21,8 +21,8 @@ import java.util.List;
/**
* Transport negotiator.
*
*
* <p/>
* <p/>
* This class is responsible for managing the transport negotiation process,
* handling all the packet interchange and the stage control.
*
@ -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());
}
@ -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<TransportCandidate.Ice> 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);
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;
}
}

View file

@ -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) {

View file

@ -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);

View file

@ -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();
}
}
@ -297,7 +300,8 @@ public class STUNResolverTest extends SmackTestCase {
}
});
session1.start(request);
} catch (XMPPException e) {
}
catch (XMPPException e) {
e.printStackTrace();
}
}
@ -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");
}

View file

@ -2,6 +2,7 @@ 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 {
@ -15,11 +16,11 @@ public class TransportCandidateTest extends SmackTestCase {
*/
public void testEqualsObject() {
TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 1, 2,
"password", 3468, "username", 25);
"password", 3468, "username", 25, "");
TransportCandidate cand2 = new TransportCandidate.Ice("192.168.2.1", 1, 2,
"password", 3468, "username", 25);
"password", 3468, "username", 25, "");
TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.1", 1, 2,
"password", 3469, "username", 25);
"password", 3469, "username", 25, "");
assertEquals(cand1, cand2);
assertFalse(cand1.equals(cand3));
@ -32,15 +33,15 @@ public class TransportCandidateTest extends SmackTestCase {
int highestPref = 100;
TransportCandidate cand1 = new TransportCandidate.Ice("192.168.2.1", 3, 2,
"password", 3468, "username", 1);
"password", 3468, "username", 1, "");
TransportCandidate cand2 = new TransportCandidate.Ice("192.168.5.1", 2, 10,
"password", 3469, "username", 15);
"password", 3469, "username", 15, "");
TransportCandidate candH = new TransportCandidate.Ice("192.168.2.1", 1, 2,
"password", 3468, "username", highestPref);
"password", 3468, "username", highestPref, "");
TransportCandidate cand3 = new TransportCandidate.Ice("192.168.2.10", 2, 10,
"password", 3469, "username", 2);
"password", 3469, "username", 2, "");
TransportCandidate cand4 = new TransportCandidate.Ice("192.168.4.1", 3, 2,
"password", 3468, "username", 78);
"password", 3468, "username", 78, "");
ArrayList candList = new ArrayList();
candList.add(cand1);

View file

@ -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 {

View file

@ -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
*
* <p/>
* Copyright 2003-2006 Jive Software.
*
* <p/>
* 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
*
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p/>
* 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);
}
}

View file

@ -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();
}
}