Java 类org.jivesoftware.smackx.jingleold.JingleSession 实例源码

项目:Smack    文件:FixedResolver.java   
/**
 * 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();
    }
}
项目:Smack    文件:MediaNegotiator.java   
/**
 * 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);
        }
    }
}
项目:Smack    文件:ScreenShareMediaManager.java   
/**
 * 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;
}
项目:Smack    文件:TestMediaManager.java   
/**
 * 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;
}
项目:Smack    文件:MultiMediaManager.java   
/**
 * 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;
}
项目:Smack    文件:STUNTransportManager.java   
protected TransportResolver createResolver(JingleSession session) {
    try {
        stunResolver.resolve(session);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return stunResolver;
}
项目:Smack    文件:TransportNegotiator.java   
/**
* 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;
}
项目:Smack    文件:JingleTransportManager.java   
/**
 * 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;
}
项目:Smack    文件:ICETransportManager.java   
protected TransportResolver createResolver(JingleSession session) throws SmackException {
    try {
        iceResolver.resolve(session);
    }
    catch (XMPPException e) {
        e.printStackTrace();
    }
    return iceResolver;
}
项目:Smack    文件:ICETransportManager.java   
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);
        }
    }
}
项目:Smack    文件:TransportCandidate.java   
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();
    }


}
项目:Smack    文件:JingleMediaSession.java   
/**
 * 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;
}
项目:Smack    文件:FixedTransportManager.java   
protected TransportResolver createResolver(JingleSession session) {
    return resolver;
}
项目:Smack    文件:FixedTransportManager.java   
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
}
项目:Smack    文件:FixedTransportManager.java   
public void sessionDeclined(String reason, JingleSession jingleSession) {
}
项目:Smack    文件:FixedTransportManager.java   
public void sessionRedirected(String redirection, JingleSession jingleSession) {
}
项目:Smack    文件:FixedTransportManager.java   
public void sessionClosed(String reason, JingleSession jingleSession) {
}
项目:Smack    文件:FixedTransportManager.java   
public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
}
项目:Smack    文件:FixedTransportManager.java   
public void sessionMediaReceived(JingleSession jingleSession, String participant) {
    // Do Nothing
}
项目:Smack    文件:FixedTransportManager.java   
public void sessionCreated(JingleSession jingleSession) {
    jingleSession.addListener(this);
}
项目:Smack    文件:STUNResolver.java   
/**
 * 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();

}
项目:Smack    文件:ICETransportManager.java   
public void sessionDeclined(String reason, JingleSession jingleSession) {
}
项目:Smack    文件:ICETransportManager.java   
public void sessionRedirected(String redirection, JingleSession jingleSession) {
}
项目:Smack    文件:ICETransportManager.java   
public void sessionClosed(String reason, JingleSession jingleSession) {
}
项目:Smack    文件:ICETransportManager.java   
public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
}
项目:Smack    文件:ICETransportManager.java   
public void sessionMediaReceived(JingleSession jingleSession, String participant) {
    // Do Nothing
}
项目:Smack    文件:ICETransportManager.java   
public void sessionCreated(JingleSession jingleSession) {
    jingleSession.addListener(this);
}
项目:Smack    文件:TransportCandidate.java   
public void addCandidateEcho(JingleSession session) throws SocketException, UnknownHostException {
    candidateEcho = new CandidateEcho(this, session);
    echoThread = new Thread(candidateEcho);
    echoThread.start();
}
项目:Smack    文件:BridgedTransportManager.java   
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);
}
项目:Smack    文件:BridgedTransportManager.java   
public void sessionDeclined(String reason, JingleSession jingleSession) {
}
项目:Smack    文件:BridgedTransportManager.java   
public void sessionRedirected(String redirection, JingleSession jingleSession) {
}
项目:Smack    文件:BridgedTransportManager.java   
public void sessionClosed(String reason, JingleSession jingleSession) {
}
项目:Smack    文件:BridgedTransportManager.java   
public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
}
项目:Smack    文件:BridgedTransportManager.java   
public void sessionMediaReceived(JingleSession jingleSession, String participant) {
    // Do Nothing
}
项目:Smack    文件:BridgedTransportManager.java   
public void sessionCreated(JingleSession jingleSession) {
    jingleSession.addListener(this);
}
项目:Smack    文件:BasicTransportManager.java   
protected TransportResolver createResolver(JingleSession session) {
    return new BasicResolver();
}
项目:Smack    文件:BridgedResolver.java   
/**
 * 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();
}
项目:Smack    文件:JmfMediaManager.java   
/**
 * 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);
}
项目:Smack    文件:AudioMediaSession.java   
/**
 * 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();
}
项目:Smack    文件:ScreenShareSession.java   
/**
 * 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();
}