/** * 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(); } }
/** * 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); } } }
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 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(); } }); }
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); }
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(); }
/** * 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 (XMPPException e) { e.printStackTrace(); } return stunResolver; }
/** * 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; }
/** * 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; }
protected TransportResolver createResolver(JingleSession session) { try { iceResolver.resolve(session); } catch (XMPPException e) { e.printStackTrace(); } return iceResolver; }
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); } } }
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; }
/** * 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); } } }
public void sessionDeclined(String string, JingleSession jingleSession) { showCallEndedState("The Session was rejected."); SwingUtilities.invokeLater(new Runnable() { public void run() { updateOutgoingCallPanel(); } }); }
public void sessionRedirected(String string, JingleSession jingleSession) { SwingUtilities.invokeLater(new Runnable() { public void run() { updateOutgoingCallPanel(); } }); }
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(); } }); }
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); } }
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. */ 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(); }
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) { RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc); }