/** * Resolve the IP address. * @throws NotConnectedException */ public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException { if (!isResolving()) { setResolveInit(); clearCandidates(); if (fixedCandidate.getLocalIp() == null) fixedCandidate.setLocalIp(fixedCandidate.getIp()); if (fixedCandidate != null) { addCandidate(fixedCandidate); } setResolveEnd(); } }
/** * Default constructor. The constructor establishes some basic parameters, * but it does not start the negotiation. For starting the negotiation, call * startNegotiation. * * @param session * The jingle session. */ public MediaNegotiator(JingleSession session, JingleMediaManager mediaManager, List<PayloadType> pts, ContentNegotiator parentNegotiator) { super(session); this.mediaManager = mediaManager; this.parentNegotiator = parentNegotiator; bestCommonAudioPt = null; if (pts != null) { if (pts.size() > 0) { localAudioPts.addAll(pts); } } }
/** * Returns a new JingleMediaSession * * @param payloadType payloadType * @param remote remote Candidate * @param local local Candidate * @return JingleMediaSession JingleMediaSession */ public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) { ScreenShareSession session = null; session = new ScreenShareSession(payloadType, remote, local, "Screen", jingleSession); if (encoder != null) { session.setEncoder(encoder); } if (decoder != null) { session.setDecoder(decoder); } return session; }
/** * Returns a new JingleMediaSession * * @param payloadType payloadType * @param remote remote Candidate * @param local local Candidate * @return JingleMediaSession JingleMediaSession */ public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) { TestMediaSession session = null; session = new TestMediaSession(payloadType, remote, local, "", jingleSession); return session; }
/** * Returns a new JingleMediaSession * * @param payloadType payloadType * @param remote remote Candidate * @param local local Candidate * @return JingleMediaSession JingleMediaSession */ public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) { for (JingleMediaManager manager : managers) { if (manager.getPayloads().contains(payloadType)) { return manager.createMediaSession(payloadType, remote, local, jingleSession); } } return null; }
protected TransportResolver createResolver(JingleSession session) { try { stunResolver.resolve(session); } catch (Exception e) { e.printStackTrace(); } return stunResolver; }
/** * Default constructor. * * @param session The Jingle session * @param transResolver The JingleTransportManager to use */ public TransportNegotiator(JingleSession session, TransportResolver transResolver, ContentNegotiator parentNegotiator) { super(session); resolver = transResolver; this.parentNegotiator = parentNegotiator; resultThread = null; }
/** * Get a new Transport Resolver to be used in a Jingle Session * * @return the TransportResolver to be used */ public TransportResolver getResolver(JingleSession session) throws XMPPException, SmackException { TransportResolver resolver = createResolver(session); if (resolver == null) { resolver = new BasicResolver(); } resolver.initializeAndWait(); return resolver; }
protected TransportResolver createResolver(JingleSession session) throws SmackException { try { iceResolver.resolve(session); } catch (XMPPException e) { e.printStackTrace(); } return iceResolver; }
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException { if (lc instanceof ICECandidate) { if (((ICECandidate) lc).getType().equals("relay")) { RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc); } } }
public CandidateEcho(TransportCandidate candidate, JingleSession session) throws UnknownHostException, SocketException { this.socket = new DatagramSocket(candidate.getPort(), InetAddress.getByName(candidate.getLocalIp())); this.localUser = session.getInitiator(); this.remoteUser = session.getResponder(); this.id = session.getSid(); this.candidate = candidate; int keySplitIndex = ((int) Math.ceil(((float) id.length()) / 2)); String local = id.substring(0, keySplitIndex) + ";" + localUser; String remote = id.substring(keySplitIndex) + ";" + remoteUser; try { if (session.getConnection().getUser().equals(session.getInitiator())) { this.send = local.getBytes("UTF-8"); this.receive = remote.getBytes("UTF-8"); } else { this.receive = local.getBytes("UTF-8"); this.send = remote.getBytes("UTF-8"); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } }
/** * Creates a new JingleMediaSession Instance to handle Media methods. * * @param payloadType Payload Type of the transmittion * @param remote Remote accepted Transport Candidate * @param local Local accepted Transport Candidate * @param mediaLocator Media Locator of the capture device */ public JingleMediaSession(PayloadType payloadType, TransportCandidate remote, TransportCandidate local, String mediaLocator, JingleSession jingleSession) { this.local = local; this.remote = remote; this.payloadType = payloadType; this.mediaLocator = mediaLocator; this.jingleSession = jingleSession; }
protected TransportResolver createResolver(JingleSession session) { return resolver; }
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) { }
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) { }
public void sessionMediaReceived(JingleSession jingleSession, String participant) { // Do Nothing }
public void sessionCreated(JingleSession jingleSession) { jingleSession.addListener(this); }
/** * Resolve the IP and obtain a valid transport method. * @throws NotConnectedException */ public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException { setResolveInit(); clearCandidates(); TransportCandidate candidate = new TransportCandidate.Fixed( resolvedPublicIP, getFreePort()); candidate.setLocalIp(resolvedLocalIP); LOGGER.fine("RESOLVING : " + resolvedPublicIP + ":" + candidate.getPort()); addCandidate(candidate); setResolveEnd(); }
public void addCandidateEcho(JingleSession session) throws SocketException, UnknownHostException { candidateEcho = new CandidateEcho(this, session); echoThread = new Thread(candidateEcho); echoThread.start(); }
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException { RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc); }
protected TransportResolver createResolver(JingleSession session) { return new BasicResolver(); }
/** * Resolve Bridged Candidate. * <p/> * The BridgedResolver takes the IP addresse and ports of a jmf proxy service. * @throws NotConnectedException */ public synchronized void resolve(JingleSession session) throws XMPPException, NotConnectedException { setResolveInit(); clearCandidates(); sid = Math.abs(random.nextLong()); RTPBridge rtpBridge = RTPBridge.getRTPBridge(connection, String.valueOf(sid)); String localIp = getLocalHost(); TransportCandidate localCandidate = new TransportCandidate.Fixed( rtpBridge.getIp(), rtpBridge.getPortA()); localCandidate.setLocalIp(localIp); TransportCandidate remoteCandidate = new TransportCandidate.Fixed( rtpBridge.getIp(), rtpBridge.getPortB()); 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); setResolveEnd(); }
/** * Returns a new jingleMediaSession * * @param payloadType payloadType * @param remote remote Candidate * @param local local Candidate * @return JingleMediaSession */ public JingleMediaSession createMediaSession(final PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) { return new AudioMediaSession(payloadType, remote, local, mediaLocator, jingleSession); }
/** * Creates a org.jivesoftware.jingleaudio.jmf.AudioMediaSession with defined payload type, remote and local candidates * * @param payloadType Payload of the jmf * @param remote the remote information. The candidate that the jmf will be sent to. * @param local the local information. The candidate that will receive the jmf * @param locator media locator */ public AudioMediaSession(final PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, String locator, JingleSession jingleSession) { super(payloadType, remote, local, locator==null?"dsound://":locator,jingleSession); initialize(); }
/** * Creates a org.jivesoftware.jingleaudio.jmf.AudioMediaSession with defined payload type, remote and local candidates * * @param payloadType Payload of the jmf * @param remote the remote information. The candidate that the jmf will be sent to. * @param local the local information. The candidate that will receive the jmf * @param locator media locator */ public ScreenShareSession(final PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final String locator, JingleSession jingleSession) { super(payloadType, remote, local, "Screen", jingleSession); initialize(); }