}
}
@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);
}
}