/** * Trigger a session closed event due to an error. */ protected void triggerSessionClosedOnError(XMPPException exc) { for (ContentNegotiator contentNegotiator : contentNegotiators) { contentNegotiator.stopJingleMediaSession(); for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates()) candidate.removeCandidateEcho(); } List<JingleListener> listeners = getListenersList(); for (JingleListener li : listeners) { if (li instanceof JingleSessionListener) { JingleSessionListener sli = (JingleSessionListener) li; sli.sessionClosedOnError(exc, this); } } close(); }
/** * Terminate negotiations. */ public void close() { if (isClosed()) return; // Set the session state to ENDED. setSessionState(JingleSessionStateEnded.getInstance()); for (ContentNegotiator contentNegotiator : contentNegotiators) { contentNegotiator.stopJingleMediaSession(); for (TransportCandidate candidate : contentNegotiator.getTransportNegotiator().getOfferedCandidates()) candidate.removeCandidateEcho(); contentNegotiator.close(); } removePacketListener(); removeConnectionListener(); getConnection().removeConnectionListener(connectionListener); LOGGER.debug("Negotiation Closed: " + getConnection().getUser() + " " + sid); super.close(); }
/** * Get the elements of this candidate. */ protected String getChildElements() { StringBuilder buf = new StringBuilder(); if (transportCandidate != null && transportCandidate instanceof TransportCandidate.Fixed) { TransportCandidate.Fixed tcf = (TransportCandidate.Fixed) transportCandidate; buf.append(" generation=\"").append(tcf.getGeneration()).append("\""); buf.append(" ip=\"").append(tcf.getIp()).append("\""); buf.append(" port=\"").append(tcf.getPort()).append("\""); // Optional parameters String name = tcf.getName(); if (name != null) { buf.append(" name=\"").append(name).append("\""); } } return buf.toString(); }
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(); } }); }
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); }
/** * 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; }
public void triggerContentEstablished() { PayloadType bestCommonAudioPt = getMediaNegotiator().getBestCommonAudioPt(); TransportCandidate bestRemoteCandidate = getTransportNegotiator().getBestRemoteCandidate(); TransportCandidate acceptedLocalCandidate = getTransportNegotiator().getAcceptedLocalCandidate(); // Trigger the session established flag triggerContentEstablished(bestCommonAudioPt, bestRemoteCandidate, acceptedLocalCandidate); }
/** * Trigger a session established event. */ private void triggerContentEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc) { // Let the session know that we've established a content/media segment. JingleSession session = getSession(); if (session != null) { List<JingleListener> listeners = session.getListenersList(); for (JingleListener li : listeners) { if (li instanceof JingleSessionListener) { JingleSessionListener sli = (JingleSessionListener) li; sli.sessionEstablished(pt, rc, lc, session); } } } // Create a media session for each media manager in the session. if (mediaNeg.getMediaManager() != null) { rc.removeCandidateEcho(); lc.removeCandidateEcho(); jingleMediaSession = getMediaNegotiator().getMediaManager().createMediaSession(pt, rc, lc, session); jingleMediaSession.addMediaReceivedListener(session); if (jingleMediaSession != null) { jingleMediaSession.startTrasmit(); jingleMediaSession.startReceive(); for (TransportCandidate candidate : getTransportNegotiator().getOfferedCandidates()) candidate.removeCandidateEcho(); } JingleMediaManager mediaManager = getMediaNegotiator().getMediaManager(); getSession().addJingleMediaSession(mediaManager.getName(), jingleMediaSession); } }
/** * 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; }
public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) { }
/** * Set the transportElement candidate. * * @param cand the transportElement candidate */ public void setMediaTransport(final TransportCandidate cand) { if (cand != null) { transportCandidate = cand; } }
/** * Constructor with a transport candidate. */ public Candidate(final TransportCandidate tc) { super(tc); }
/** * 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(); }
/** * Returns a new jingleMediaSession * * @param payloadType payloadType * @param remote remote Candidate * @param local local Candidate * @return JingleMediaSession */ public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) { return new AudioMediaSession(payloadType, remote, local, null,null); }
/** * Creates a org.jivesoftware.jingleaudio.jspeex.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 TestMediaSession 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 TestMediaSession(final PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final String locator, JingleSession jingleSession) { super(payloadType, remote, local, "Test", jingleSession); initialize(); }
/** * Returns the Media Session local Candidate * * @return */ public TransportCandidate getLocal() { return local; }
/** * Returns the Media Session remote Candidate * * @return */ public TransportCandidate getRemote() { return remote; }
/** * Create a Media Session Implementation * * @param payloadType * @param remote * @param local * @return */ public abstract JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, JingleSession jingleSession);
/** * Notification that the session has been established. Arguments specify * the payload type and transport to use. * * @param pt the Payload tyep to use * @param remoteCandidate the remote candidate to use for connecting to the remote * service. * @param localCandidate the local candidate where we must listen for connections * @param jingleSession Session that called the method */ public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate, TransportCandidate localCandidate, JingleSession jingleSession);
/** * Notification that the transport has been established. * * @param local The transport candidate that has been used for listening * in the local machine * @param remote The transport candidate that has been used for * transmitting to the remote machine */ public void transportEstablished(TransportCandidate local, TransportCandidate remote);
/** * Notification that a transport must be cancelled. * * @param cand The transport candidate that must be cancelled. A value * of "null" means all the transports for this session. */ public void transportClosed(TransportCandidate cand);
/** * Creates a new TransportNegotiator child. * * @param candidate the jmf transport candidate */ public JingleTransportCandidate(final TransportCandidate candidate) { super(); setMediaTransport(candidate); }
/** * Get the current transportElement candidate. * * @return the transportElement candidate */ public TransportCandidate getMediaTransport() { return transportCandidate; }