Examples of JingleSession


Examples of com.xonami.javaBells.JingleSession

    if( js == currentJingleSession ) {
      currentJingleSession = null;
      jingleStreamManager = null;
      iceAgent = null;
    }
    JingleSession ret = super.removeJingleSession(js);
    return ret;
  }
View Full Code Here

Examples of nu.fw.jeti.plugins.jingle.jingle.JingleSession

   
    backend.getMain().addToRosterMenu(I18N.gettext("jingle.voice"),new RosterMenuListener()
    {
      public void actionPerformed(JIDStatus jidStatus,nu.fw.jeti.backend.roster.JIDStatusGroup group)
      {
        JingleSession session = sessions.get(jidStatus.getCompleteJID());
         if (session != null) {
          try
          {
            session.terminate();
            System.out.println("session removing because not yet removed");
           
          } catch (XMPPException e)
          {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
         }
            try {
                 OutgoingJingleSession jos = manager.createOutgoingJingleSession(jidStatus.getCompleteJID());
                 jos.addListener(createSessionListener(jidStatus.getCompleteJID()));
                 jos.start();
                 sessions.put(jidStatus.getCompleteJID(),jos);
                 endVoiceMenu.setEnabled(true);
                } catch (XMPPException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        
      }
    });
   
   
    String stunServer = "stun.xten.net";
    int stunPort = 3478;

//    if (STUN.serviceAvailable(backend)) {
//      STUN stun = STUN.getSTUNServer(backend);
//      if (stun != null) {
//        List<STUN.StunServerAddress> servers = stun.getServers();
//
//        if (servers.size() > 0) {
//          stunServer = servers.get(0).getServer();
//          stunPort = Integer.parseInt(servers.get(0).getPort());
//        }
//      }
//    }

    JingleTransportManager transportManager = new ICETransportManager(
        backend, stunServer, stunPort);
    // if running on Windows use Direct Sound for better performance
    //String locator = Spark.isWindows() && !Spark.isVista() ? "dsound://" : "javasound://";
    String locator =  "javasound://8000"; //48000 to fix os2 and mac bug
    MultiMediaManager jingleMediaManager = new MultiMediaManager();
    jingleMediaManager.addMediaManager(new JmfMediaManager(locator));
    jingleMediaManager.addMediaManager(new SpeexMediaManager());
    if (System.getProperty("codec") != null) {
      try {
        int codec = Integer.parseInt(System.getProperty("codec"));
        jingleMediaManager.setPreferredPayloadType(jingleMediaManager
            .getPayloads().get(codec));

      } catch (NumberFormatException e) {
        // do nothing
      }
    }
   
      manager = new JingleManager(backend, transportManager, jingleMediaManager);
      manager.addCreationListener((ICETransportManager)transportManager);
   
           
      manager.addJingleSessionRequestListener(new JingleSessionRequestListener() {
            public void sessionRequested(final JingleSessionRequest request) {

               
                JID from = request.getFrom();
                JingleSession session = sessions.get(from);
                if (session != null) {
                  try {
            session.terminate();
            System.out.println("incom session removing because not yet removed");
          } catch (XMPPException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
                  return;
                }
               
                String name = from.getUser();
                JIDStatus jidStatus = Roster.getJIDStatus(from);
                if(jidStatus!=null) name = jidStatus.getNick();
               
                
                Object[] options = { I18N.gettext("jeti.Decline") , I18N.gettext("jeti.Answer") };               
                Popups.showOptionDialog(MessageFormat.format(I18N.gettext("jingle.{0}_calls,_answer_call?"),name),
                    I18N.gettext("jingle.New Call"), JOptionPane.YES_NO_OPTION,
                    JOptionPane.QUESTION_MESSAGE, null,
                    options,options[1], new Popups.OptionChoosed() {
       
          public void optionChoosed(int option) {
            if(option == JOptionPane.NO_OPTION){
                      try {
                          // Accept the call
                          IncomingJingleSession incoming = request.accept();
                          incoming.start();
                            incoming.addListener(createSessionListener(request.getFrom()));
                      }
                      catch (Exception e) {
                          e.printStackTrace();
                      }
            }
            else{
              request.reject();
            }
          }
        });
            }
        });
     
    backend.addExtensionHandler("http://jabber.org/protocol/jingle",new JingleProvider(manager));
    backend.addExtensionHandler("http://jabber.org/protocol/jingle/description/audio",
                    new JingleContentDescriptionProvider.Audio());
    backend.addExtensionHandler("http://jabber.org/protocol/jingle/transport/ice",
                    new JingleTransportProvider.Ice());
    backend.addExtensionHandler("http://jabber.org/protocol/jingle/transport/raw-udp",
                    new JingleTransportProvider.RawUdp());
    backend.addExtensionHandler("http://jabber.org/protocol/jingle/info/audio",
                    new JingleContentInfoProvider.Audio());
    backend.addExtensionHandler("http://www.jivesoftware.com/protocol/rtpbridge", new Provider());
    backend.addExtensionHandler("google:jingleinfo", new STUN.Provider());
   
    backend.addCapability("jingle","http://www.xmpp.org/extensions/xep-0166.html#ns");

    backend.addListener(IQResultListener.class,new IQResultListener(){
      public void iqResult(InfoQuery iq) {
        for (JingleSession session : manager.getAllSessions()){
          try {
            session.respond(new Jingle(iq));
          } catch (XMPPException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }
View Full Code Here

Examples of nu.fw.jeti.plugins.jingle.jingle.JingleSession

      error = query.getXMPPError();
      System.out.println(this);     
      if(getAction().equals(Action.SESSIONINITIATE)){
        manager.triggerSessionRequested(this);
      }else {
        JingleSession session = manager.getSession(sid);
        //TODO probably wrong check how to fix not sending session initiated second time
             
        try {
          if(session != null)session.respond(this);
        } catch (XMPPException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
View Full Code Here

Examples of org.jivesoftware.smackx.jingle.JingleSession

    /**
     * Initialize the screen share channels.
     */
    public void initialize() {

        JingleSession session = getJingleSession();
        if ((session != null) && (session.getInitiator().equals(session.getConnection().getUser()))) {
            // If the initiator of the jingle session is us then we transmit a screen share.
            try {
                InetAddress remote = InetAddress.getByName(getRemote().getIp());
                transmitter = new ImageTransmitter(new DatagramSocket(getLocal().getPort()), remote, getRemote().getPort(),
                        new Rectangle(0, 0, width, height));
View Full Code Here

Examples of org.jivesoftware.smackx.jingle.JingleSession

    public synchronized IBytestreamConnection connect(JID peer,
        SubMonitor progress) throws IOException, InterruptedException {

        progress.subTask("Try to initiate bytestream with " + toString());

        JingleSession out = null;
        try {
            out = manager.createOutgoingJingleSession(peer.toString());
            out.startOutgoing();
            waitForConnection(out);
        } catch (XMPPException e) {
            log.error("Could not connect to " + peer.toString());
            return null;
        }
View Full Code Here

Examples of org.jivesoftware.smackx.jingle.JingleSession

                 */
                public void sessionRequested(final JingleSessionRequest request) {
                    System.out.println("Session request detected, from " + request.getFrom() + ": accepting.");

                    // We accept the request
                    JingleSession session1;
                    try {
                        session1 = request.accept();
                        session1.addListener(new JingleSessionListener() {
                            public void sessionClosed(String reason, JingleSession jingleSession) {
                            }

                            public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
                            }

                            public void sessionDeclined(String reason, JingleSession jingleSession) {
                            }

                            public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc,
                                    JingleSession jingleSession) {
                                incCounter();
                                System.out.println("Responder: the session is fully established.");
                                System.out.println("+ Payload Type: " + pt.getId());
                                System.out.println("+ Local IP/port: " + lc.getIp() + ":" + lc.getPort());
                                System.out.println("+ Remote IP/port: " + rc.getIp() + ":" + rc.getPort());
                            }

                            public void sessionRedirected(String redirection, JingleSession jingleSession) {
                            }

                            public void sessionMediaReceived(JingleSession jingleSession, String participant) {
                                // Do Nothing
                            }
                        });
                        session1.startIncoming();
                    } catch (XMPPException e) {
                        e.printStackTrace();
                    }
                }
            });

            // Session 0 starts a request
            System.out.println("Starting session request, to " + getFullJID(1) + "...");
            JingleSession session0 = man0.createOutgoingJingleSession(getFullJID(1));

            session0.addListener(new JingleSessionListener() {
                public void sessionClosed(String reason, JingleSession jingleSession) {
                }

                public void sessionClosedOnError(XMPPException e, JingleSession jingleSession) {
                }

                public void sessionDeclined(String reason, JingleSession jingleSession) {
                }

                public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc,
                        JingleSession jingleSession) {
                    incCounter();
                    System.out.println("Initiator: the session is fully established.");
                    System.out.println("+ Payload Type: " + pt.getId());
                    System.out.println("+ Local IP/port: " + lc.getIp() + ":" + lc.getPort());
                    System.out.println("+ Remote IP/port: " + rc.getIp() + ":" + rc.getPort());
                }

                public void sessionMediaReceived(JingleSession jingleSession, String participant) {
                    // Do Nothing
                }

                public void sessionRedirected(String redirection, JingleSession jingleSession) {
                }
            });
            session0.startOutgoing();

            Thread.sleep(60000);

            assertTrue(valCounter() == 2);

View Full Code Here

Examples of rocks.xmpp.extensions.jingle.JingleSession

        String ibbSessionId = UUID.randomUUID().toString();
        InBandBytestreamsTransportMethod ibbTransportMethod = new InBandBytestreamsTransportMethod(ibbSessionId, 4096);

        Jingle.Content content = new Jingle.Content("a-file-offer", Jingle.Content.Creator.INITIATOR, jingleFileTransfer, ibbTransportMethod);
        final JingleSession jingleSession = jingleManager.createSession(responder, content);

        final Lock lock = new ReentrantLock();
        final Condition condition = lock.newCondition();
        final Jingle[] response = new Jingle[1];

        jingleSession.addJingleListener(new JingleListener() {
            @Override
            public void jingleReceived(JingleEvent e) {
                if (e.getJingle().getAction() == Jingle.Action.SESSION_ACCEPT || e.getJingle().getAction() == Jingle.Action.SESSION_TERMINATE) {
                    lock.lock();
                    try {
                        response[0] = e.getJingle();
                        condition.signalAll();
                    } finally {
                        lock.unlock();
                    }
                }
            }
        });
        jingleSession.initiate();

        // Wait until the session is either accepted or declined (terminated).
        lock.lock();
        try {
            if (!condition.await(timeout, TimeUnit.MILLISECONDS)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.