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

项目:java-bells    文件:FixedResolver.java   
/**
 * Resolve the IP address.
 */
public synchronized void resolve(JingleSession session) throws XMPPException {
    if (!isResolving()) {
        setResolveInit();

        clearCandidates();

        if (fixedCandidate.getLocalIp() == null)
            fixedCandidate.setLocalIp(fixedCandidate.getIp());

        if (fixedCandidate != null) {
            addCandidate(fixedCandidate);
        }

        setResolveEnd();
    }
}
项目:java-bells    文件:MediaNegotiator.java   
/**
 * Default constructor. The constructor establishes some basic parameters,
 * but it does not start the negotiation. For starting the negotiation, call
 * startNegotiation.
 * 
 * @param js
 *            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);
        }
    }
}
项目:spark-svn-mirror    文件:OutgoingCall.java   
public void sessionEstablished(PayloadType payloadType, TransportCandidate transportCandidate, TransportCandidate transportCandidate1, JingleSession jingleSession) {
    established = true;
    mediaReceivedTask = new SwingTimerTask() {
        public void doRun() {
            if (!mediaReceived) {
                if (session != null) {
                    try {
                        session.terminate("No Media Received. This may be caused by firewall configuration problems.");
                    }
                    catch (XMPPException e) {
                        Log.error(e);
                    }
                }
            }
        }
    };
    TaskEngine.getInstance().schedule(mediaReceivedTask, WAIT_FOR_MEDIA_DELAY, WAIT_FOR_MEDIA_DELAY);

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            updateOutgoingCallPanel();
        }
    });
}
项目:spark-svn-mirror    文件:OutgoingCall.java   
public void sessionClosed(String string, JingleSession jingleSession) {

    if (jingleSession instanceof JingleSession) {
        if (established && mediaReceived) {
            final SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy h:mm a");
            showCallEndedState("Voice chat ended on " + formatter.format(new Date()));
        }
        else {
            showCallEndedState("Session closed due to " + string);
        }
    }
    if(PhoneManager.isUseStaticLocator()&&PhoneManager.isUsingMediaLocator()){
        PhoneManager.setUsingMediaLocator(false);
    }

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            updateOutgoingCallPanel();
        }
    });
}
项目:spark-svn-mirror    文件:IncomingCall.java   
public void sessionEstablished(PayloadType payloadType, TransportCandidate transportCandidate, TransportCandidate transportCandidate1, JingleSession jingleSession) {

        established = true;
        mediaReceivedTask = new SwingTimerTask() {
            public void doRun() {
                if (!mediaReceived) {
                    if (session != null) {
                        try {
                            session.terminate("No Media Received. This may be caused by firewall configuration problems.");
                        }
                        catch (XMPPException e) {
                            Log.error(e);
                        }
                    }
                }
            }
        };
        TaskEngine.getInstance().schedule(mediaReceivedTask, WAIT_FOR_MEDIA_DELAY, WAIT_FOR_MEDIA_DELAY);
    }
项目:spark-svn-mirror    文件:JingleRoom.java   
public JingleRoom(JingleSession session, ChatRoom chatRoom) {
    this.session = session;
    this.chatRoom = chatRoom;
    setLayout(new GridBagLayout());
    setBorder(BorderFactory.createLineBorder(Color.lightGray));

    // Build Top Layer
    final JPanel topPanel = buildTopPanel();
    add(topPanel, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));

    // Build Control Panel
    final JPanel controlPanel = buildControlPanel();
    add(controlPanel, new GridBagConstraints(1, 6, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));

    // Add Previous Conversation
    historyPanel = new PreviousConversationPanel();
    historyPanel.addPreviousConversations("");
    //  add(historyPanel, new GridBagConstraints(1, 8, 1, 1, 0.0, 1.0, GridBagConstraints.SOUTH, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 100));

    // Setup default settings
    setupDefaults();
}
项目:java-bells    文件: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;
}
项目:java-bells    文件: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;
}
项目:java-bells    文件: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;
}
项目:java-bells    文件:STUNTransportManager.java   
protected TransportResolver createResolver(JingleSession session) {
    try {
        stunResolver.resolve(session);
    } catch (XMPPException e) {
        e.printStackTrace();
    }
    return stunResolver;
}
项目:java-bells    文件:TransportNegotiator.java   
/**
* Default constructor.
*
* @param js            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;
}
项目:java-bells    文件:JingleTransportManager.java   
/**
 * Get a new Transport Resolver to be used in a Jingle Session
 *
 * @return
 */
public TransportResolver getResolver(JingleSession session) throws XMPPException {
    TransportResolver resolver = createResolver(session);
    if (resolver == null) {
        resolver = new BasicResolver();
    }
    resolver.initializeAndWait();

    return resolver;
}
项目:java-bells    文件:ICETransportManager.java   
protected TransportResolver createResolver(JingleSession session) {
    try {
        iceResolver.resolve(session);
    }
    catch (XMPPException e) {
        e.printStackTrace();
    }
    return iceResolver;
}
项目:java-bells    文件:ICETransportManager.java   
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
    if (lc instanceof ICECandidate) {
        if (((ICECandidate) lc).getType().equals("relay")) {
            RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc);
        }
    }
}
项目:java-bells    文件: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();
    }


}
项目:java-bells    文件: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;
}
项目:spark-svn-mirror    文件:OutgoingCall.java   
/**
 * Updates the UI to reflect the current state.
 */
private void updateOutgoingCallPanel() {
    if (session == null || session.isClosed()) {
        return;
    }
    else if (session instanceof JingleSession) {
        showAlert(false);
        if (session.getSessionState() instanceof JingleSessionStatePending) {
            titleLabel.setText("Calling user. Please wait...");
            cancelButton.setVisible(true);
        }
    }
}
项目:spark-svn-mirror    文件:OutgoingCall.java   
public void sessionDeclined(String string, JingleSession jingleSession) {
    showCallEndedState("The Session was rejected.");

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            updateOutgoingCallPanel();
        }
    });
}
项目:spark-svn-mirror    文件:OutgoingCall.java   
public void sessionRedirected(String string, JingleSession jingleSession) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            updateOutgoingCallPanel();
        }
    });
}
项目:spark-svn-mirror    文件:OutgoingCall.java   
public void sessionClosedOnError(XMPPException xmppException, JingleSession jingleSession) {
    showCallEndedState("Voice chat ended due: " + xmppException.getMessage());
    if(PhoneManager.isUseStaticLocator()&&PhoneManager.isUsingMediaLocator()){
        PhoneManager.setUsingMediaLocator(false);
    }                

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            updateOutgoingCallPanel();
        }
    });
}
项目:spark-svn-mirror    文件:IncomingCall.java   
public void sessionClosed(String string, JingleSession jingleSession) {
    if (established && mediaReceived) {
        final SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy h:mm a");
        showCallEndedState("Voice chat ended on " + formatter.format(new Date()));
    } else {
        showCallEndedState("Voice chat ended: " + string);
    }
    if(PhoneManager.isUseStaticLocator()&&PhoneManager.isUsingMediaLocator()){
        PhoneManager.setUsingMediaLocator(false);
    }
}
项目:java-bells    文件:FixedTransportManager.java   
protected TransportResolver createResolver(JingleSession session) {
    return resolver;
}
项目:java-bells    文件:FixedTransportManager.java   
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
}
项目:java-bells    文件:FixedTransportManager.java   
public void sessionDeclined(String reason, JingleSession jingleSession) {
}
项目:java-bells    文件:FixedTransportManager.java   
public void sessionRedirected(String redirection, JingleSession jingleSession) {
}
项目:java-bells    文件:FixedTransportManager.java   
public void sessionClosed(String reason, JingleSession jingleSession) {
}
项目:java-bells    文件:FixedTransportManager.java   
public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
}
项目:java-bells    文件:FixedTransportManager.java   
public void sessionMediaReceived(JingleSession jingleSession, String participant) {
    // Do Nothing
}
项目:java-bells    文件:FixedTransportManager.java   
public void sessionCreated(JingleSession jingleSession) {
    jingleSession.addListener(this);
}
项目:java-bells    文件:STUNResolver.java   
/**
 * Resolve the IP and obtain a valid transport method.
 */
public synchronized void resolve(JingleSession session) throws XMPPException {

    setResolveInit();

    clearCandidates();

    TransportCandidate candidate = new TransportCandidate.Fixed(
            resolvedPublicIP, getFreePort());
    candidate.setLocalIp(resolvedLocalIP);

    LOGGER.debug("RESOLVING : " + resolvedPublicIP + ":" + candidate.getPort());

    addCandidate(candidate);

    setResolveEnd();

}
项目:java-bells    文件:ICETransportManager.java   
public void sessionDeclined(String reason, JingleSession jingleSession) {
}
项目:java-bells    文件:ICETransportManager.java   
public void sessionRedirected(String redirection, JingleSession jingleSession) {
}
项目:java-bells    文件:ICETransportManager.java   
public void sessionClosed(String reason, JingleSession jingleSession) {
}
项目:java-bells    文件:ICETransportManager.java   
public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
}
项目:java-bells    文件:ICETransportManager.java   
public void sessionMediaReceived(JingleSession jingleSession, String participant) {
    // Do Nothing
}
项目:java-bells    文件:ICETransportManager.java   
public void sessionCreated(JingleSession jingleSession) {
    jingleSession.addListener(this);
}
项目:java-bells    文件:TransportCandidate.java   
public void addCandidateEcho(JingleSession session) throws SocketException, UnknownHostException {
    candidateEcho = new CandidateEcho(this, session);
    echoThread = new Thread(candidateEcho);
    echoThread.start();
}
项目:java-bells    文件:BridgedTransportManager.java   
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) {
    RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc);
}
项目:java-bells    文件:BridgedTransportManager.java   
public void sessionDeclined(String reason, JingleSession jingleSession) {
}
项目:java-bells    文件:BridgedTransportManager.java   
public void sessionRedirected(String redirection, JingleSession jingleSession) {
}