Package org.ice4j.ice

Examples of org.ice4j.ice.Agent


    return true;
  }

  @Override
  public void propertyChange(PropertyChangeEvent evt) {
    Agent agent = (Agent) evt.getSource();
    System.out.println("\n\n++++++++++++++++++++++++++++\n\n");
    try {
      System.out.println(agent.getStreams().iterator().next().getCheckList());
    } catch (Exception e) {
    }
    System.out.println("New State: " + evt.getNewValue());
    for( String s : iceAgent.getStreamNames() ) {
      System.out.println("Stream          : " + s );
      System.out.println("Local Candidate : " + agent.getSelectedLocalCandidate(s));
      System.out.println("Remote Candidate: " + agent.getSelectedRemoteCandidate(s));
    }
    System.out.println("\n\n++++++++++++++++++++++++++++\n\n");
    if (agent.getState() == IceProcessingState.COMPLETED) {
      try {
        for( String s : iceAgent.getStreamNames() ) {
          System.out.println( "For Stream : " + s );
          jingleStream = jingleStreamManager.startStream(s, iceAgent);
          jingleStream.quickShow(jingleStreamManager.getDefaultAudioDevice());
        }
      } catch (IOException ioe) {
        ioe.printStackTrace(); // FIXME: deal with this.
      }
    } else if (agent.getState() == IceProcessingState.FAILED) {
      closeSession(Reason.CONNECTIVITY_ERROR);
    }
  }
View Full Code Here


    }
  }
 
  @Override
  public void propertyChange(PropertyChangeEvent evt) {
    Agent agent = (Agent) evt.getSource();
   
    System.out.println( "-------------- Caller - Agent Property Change - -----------------" );
    System.out.println( "New State: " + evt.getNewValue() );
    for( String s : iceAgent.getStreamNames() ) {
      System.out.println("Stream          : " + s );
      System.out.println("Local Candidate : " + agent.getSelectedLocalCandidate(s));
      System.out.println("Remote Candidate: " + agent.getSelectedRemoteCandidate(s));
    }
    System.out.println( "-------------- Caller - Agent Property Change - -----------------" );
   
        if(agent.getState() == IceProcessingState.COMPLETED) {
            List<IceMediaStream> streams = agent.getStreams();

            //////////
            for(IceMediaStream stream : streams)
            {
                String streamName = stream.getName();
                System.out.println( "Pairs selected for stream: " + streamName);
                List<Component> components = stream.getComponents();

                for(Component cmp : components)
                {
                    String cmpName = cmp.getName();
                    System.out.println(cmpName + ": " + cmp.getSelectedPair());
                }
            }

            System.out.println("Printing the completed check lists:");
            for(IceMediaStream stream : streams)
            {
                String streamName = stream.getName();
                System.out.println("Check list for  stream: " + streamName);
                //uncomment for a more verbose output
                System.out.println(stream.getCheckList());
            }
            ////////////
           
            try {
              for( String s : iceAgent.getStreamNames() ) {
          jingleStream = jingleStreamManager.startStream(s, iceAgent);
          jingleStream.quickShow(jingleStreamManager.getDefaultAudioDevice());
        }
            } catch( IOException ioe ) {
              System.out.println( "An io error occured when negotiating the call: " ) ;
              ioe.printStackTrace();
              System.exit(1);
            }
        } else if( agent.getState() == IceProcessingState.FAILED ) {
          closeSession(Reason.CONNECTIVITY_ERROR);
        }
  }
View Full Code Here

    }
  }

  @Override
  public void propertyChange(PropertyChangeEvent evt) {
    Agent agent = (Agent) evt.getSource();
    System.out.println("\n\n++++++++++++++++++++++++++++\n\n");
    try {
      System.out.println(agent.getStreams().iterator().next().getCheckList());
    } catch (Exception e) {
    }
    System.out.println("New State: " + evt.getNewValue() + " : " + iceAgent.getState() );
    for( String s : iceAgent.getStreamNames() ) {
      System.out.println("Stream          : " + s );
      System.out.println("Local Candidate : " + agent.getSelectedLocalCandidate(s));
      System.out.println("Remote Candidate: " + agent.getSelectedRemoteCandidate(s));
    }
    System.out.println("\n\n++++++++++++++++++++++++++++\n\n");
    if (agent.getState() == IceProcessingState.COMPLETED) {
      try {
        // when connecting to jitsi, a failed is sometimes sent after completed
        iceAgent.removeAgentStateChangeListener(this);
        for( String s : iceAgent.getStreamNames() ) {
          System.out.println( "For Stream : " + s );
          jingleStream = jingleStreamManager.startStream(s, iceAgent);
          jingleStream.quickShow(jingleStreamManager.getDefaultAudioDevice());
        }
      } catch (IOException ioe) {
        System.out.println( "IOException." );
        ioe.printStackTrace(); // FIXME: deal with this.
        closeSession(Reason.CONNECTIVITY_ERROR);
      } catch( Exception e ) {
        System.out.println( "Exception." );
        e.printStackTrace(); // FIXME: deal with this.
        closeSession(Reason.CONNECTIVITY_ERROR);
      }
    } else if (agent.getState() == IceProcessingState.FAILED) {
      closeSession(Reason.CONNECTIVITY_ERROR);
    }
  }
View Full Code Here

  private final Agent agent;
 
  /** creates an ice agent with the given parameters. */
  public IceAgent( final boolean controling, StunTurnAddress sta ) {
    this.agent = new Agent();
    agent.setControlling(controling);
    if( controling )
      agent.setNominationStrategy(NominationStrategy.NOMINATE_HIGHEST_PRIO);
   
    //stun and turn
View Full Code Here

TOP

Related Classes of org.ice4j.ice.Agent

Copyright © 2018 www.massapicom. 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.