Examples of IceAgent


Examples of com.xonami.javaBells.IceAgent

          // derive stun and turn server addresses from the connection:
          StunTurnAddress sta = StunTurnAddress.getAddress( connection );
          // create an ice agent using the stun/turn address. We will need this to figure out
          // how to connect our clients:
          final IceAgent iceAgent = new IceAgent(true, sta);
          // setup our jingle stream manager using the default audio and video devices:
          final JingleStreamManager jsm = new JingleStreamManager(CreatorEnum.initiator);
          jsm.addDefaultMedia(MediaType.VIDEO, "video");
          jsm.addDefaultMedia(MediaType.AUDIO, "audio");
          // create ice streams that correspond to the jingle streams that we want
          iceAgent.createStreams(jsm.getMediaNames());
         
          // Handle all incoming Jingle packets with a Jingle Packet Handler.
          // The main thing we need to do is ensure that created Jingle sessions
          // are of our ReceiverJingleSession type.
          new JinglePacketHandler(connection) {
            @Override
            public JingleSession createJingleSession( String sid, JingleIQ jiq ) {
              return new CallerJingleSession(iceAgent, jsm, this, receiverJid, sid, this.connection);
            }
          } ;
         
          // display all incoming packets:
          connection.addPacketListener( new PacketListener() {
              @Override
              public void processPacket(Packet packet) {
                System.out.println( CALLER + ": " + packet.toXML() );
              }
            },
            new PacketFilter() {
              @Override
              public boolean accept(Packet packet) {
                return packet.getClass() == JingleIQ.class;
              }
            } );
         
//          PacketCollector collector = connection.createPacketCollector( new PacketFilter() {
//            @Override
//            public boolean accept(Packet packet) {
//              return true;
//            }} );
         
          // log in:
          log( CALLER, "logging on as " + username + "/" + CALLER );
          connection.login(username, password, CALLER);
         
          //this only works if they are in our roster
//          log( CALLER, "Waiting for Receiver to become available." );
//          while( running && !connection.getRoster().contains(receiverJid) ) {
//            collector.nextResult(100);
//          }
         
          // Use Ice and JingleSessionManager to initiate session:
          log( CALLER, "Ringing" );
          List<ContentPacketExtension> contentList = jsm.createContentList(SendersEnum.both);
          iceAgent.addLocalCandidateToContents(contentList);
         
                JingleIQ sessionInitIQ = JinglePacketFactory.createSessionInitiate(
                    connection.getUser(),
                    receiverJid,
                    JingleIQ.generateSID(),
View Full Code Here

Examples of com.xonami.javaBells.IceAgent

          // it didn't match. Reject the call.
          closeSession(Reason.INCOMPATIBLE_PARAMETERS);
          return;
        }

        iceAgent = new IceAgent(false, sta);
        iceAgent.createStreams(jingleStreamManager.getMediaNames());

        iceAgent.addAgentStateChangeListener(this);
        iceAgent.addLocalCandidateToContents(acceptedContent);
 
View Full Code Here

Examples of com.xonami.javaBells.IceAgent

          // it didn't match. Reject the call.
          closeSession(Reason.INCOMPATIBLE_PARAMETERS);
          return;
        }

        iceAgent = new IceAgent(false, sta);
        iceAgent.createStreams(jingleStreamManager.getMediaNames());

        iceAgent.addAgentStateChangeListener(this);
        iceAgent.addLocalCandidateToContents(acceptedContent);
View Full Code Here

Examples of com.xonami.javaBells.IceAgent

  public void initiateOutgoingCall(final String targetJid) throws IOException {
    // derive stun and turn server addresses from the connection:
    StunTurnAddress sta = StunTurnAddress.getAddress( connection );
    // create an ice agent using the stun/turn address. We will need this to figure out
    // how to connect our clients:
    iceAgent = new IceAgent(true, sta);
    // setup our jingle stream manager using the default audio and video devices:
    jingleStreamManager = new JingleStreamManager(CreatorEnum.initiator);
    jingleStreamManager.addDefaultMedia(MediaType.VIDEO, "video");
    jingleStreamManager.addDefaultMedia(MediaType.AUDIO, "audio");
    // create ice streams that correspond to the jingle streams that we want
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.