Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber
Class CallPeerGTalkImpl

java.lang.Object
  extended by net.java.sip.communicator.util.event.PropertyChangeNotifier
      extended by net.java.sip.communicator.service.protocol.AbstractCallPeer<T,V>
          extended by net.java.sip.communicator.service.protocol.media.MediaAwareCallPeer<CallGTalkImpl,CallPeerMediaHandlerGTalkImpl,ProtocolProviderServiceJabberImpl>
              extended by net.java.sip.communicator.impl.protocol.jabber.CallPeerGTalkImpl
All Implemented Interfaces:
EventListener, CsrcAudioLevelListener, SimpleAudioLevelListener, SrtpListener, CallPeer, CallPeerConferenceListener

public class CallPeerGTalkImpl
extends MediaAwareCallPeer<CallGTalkImpl,CallPeerMediaHandlerGTalkImpl,ProtocolProviderServiceJabberImpl>

Implements a Google Talk CallPeer.

Author:
Sebastien Vincent

Field Summary
protected  boolean isInitiator
          Indicates whether this peer was the one that initiated the session.
 
Fields inherited from class net.java.sip.communicator.service.protocol.AbstractCallPeer
callPeerConferenceListeners, callPeerListeners, callPeerSecurityListeners, NO_CONFERENCE_MEMBERS
 
Fields inherited from interface net.java.sip.communicator.service.neomedia.event.SimpleAudioLevelListener
MAX_LEVEL, MIN_LEVEL
 
Fields inherited from interface net.java.sip.communicator.service.protocol.CallPeer
CALL_DURATION_START_TIME_UNKNOWN, MUTE_PROPERTY_NAME
 
Constructor Summary
CallPeerGTalkImpl(String peerAddress, CallGTalkImpl owningCall)
          Creates a new call peer with address peerAddress.
 
Method Summary
 void answer()
          Indicates a user request to answer an incoming call from this CallPeer.
 String getAddress()
          Returns a String locator for that peer.
 Contact getContact()
          Returns the contact corresponding to this peer or null if no particular contact has been associated.
 String getDisplayName()
          Returns a human readable name representing this peer.
 String getSessInitID()
          Returns the IQ ID of the Jingle session-initiate packet associated with this call.
 String getSessionID()
          Returns the session ID of the Jingle session associated with this call.
 String getURI()
          Returns full URI of the address.
 void hangup(boolean failed, String reasonText, org.jivesoftware.smack.packet.PacketExtension reasonOtherExtension)
          Ends the call with for this CallPeer.
protected  void initiateSession(Iterable<org.jivesoftware.smack.packet.PacketExtension> sessionInitiateExtensions)
          Initiate a Google Talk session SessionIQ.
 boolean isInitiator()
          Determines whether this peer was the one that initiated the session.
 void processCandidates(SessionIQ sessionInitIQ)
          Process candidates received.
 void processSessionAccept(SessionIQ sessionInitIQ)
          Processes the session initiation SessionIQ that we were created with, passing its content to the media handler.
protected  void processSessionInitiate(SessionIQ sessionInitIQ)
          Processes the session initiation SessionIQ that we were created with, passing its content to the media handler and then sends either a "session-info/ringing" or a "terminate" response.
 void processSessionReject(SessionIQ sessionIQ)
          Puts this peer into a CallPeerState.DISCONNECTED, indicating a reason to the user, if there is one.
 void processSessionTerminate(SessionIQ sessionIQ)
          Puts this peer into a CallPeerState.DISCONNECTED, indicating a reason to the user, if there is one.
protected  void sendCandidates(Iterable<GTalkCandidatePacketExtension> candidates)
          Sends local candidate addresses from the local peer to the remote peer using the candidates SessionIQ.
 void setAddress(String address)
          Specifies the address, phone number, or other protocol specific identifier that represents this call peer.
 
Methods inherited from class net.java.sip.communicator.service.protocol.media.MediaAwareCallPeer
addConferenceMembersSoundLevelListener, addStreamSoundLevelListener, addVideoPropertyChangeListener, audioLevelChanged, audioLevelsReceived, callPeerAdded, callPeerRemoved, conferenceFocusChanged, conferenceMemberAdded, conferenceMemberRemoved, getCall, getImage, getMediaHandler, getPeerID, getProtocolProvider, isLocalVideoStreaming, isMute, logAndFail, reevalLocalHoldStatus, reevalRemoteHoldStatus, removeConferenceMembersSoundLevelListener, removeStreamSoundLevelListener, removeVideoPropertyChangeListener, securityMessageReceived, securityNegotiationStarted, securityTimeout, securityTurnedOff, securityTurnedOn, setCall, setImage, setLocalVideoAllowed, setMediaHandler, setMute, setPeerID, setState
 
Methods inherited from class net.java.sip.communicator.service.protocol.AbstractCallPeer
addCallPeerConferenceListener, addCallPeerListener, addCallPeerSecurityListener, addConferenceMember, findConferenceMember, fireCallPeerChangeEvent, fireCallPeerChangeEvent, fireCallPeerChangeEvent, fireCallPeerConferenceEvent, fireCallPeerSecurityMessageEvent, fireCallPeerSecurityNegotiationStartedEvent, fireCallPeerSecurityOffEvent, fireCallPeerSecurityOnEvent, fireCallPeerSecurityTimeoutEvent, getCallDurationStartTime, getCallInfoURL, getConferenceMemberCount, getConferenceMembers, getCurrentSecuritySettings, getState, isConferenceFocus, removeCallPeerConferenceListener, removeCallPeerListener, removeCallPeerSecurityListener, removeConferenceMember, setConferenceFocus, setState, setState, toString
 
Methods inherited from class net.java.sip.communicator.util.event.PropertyChangeNotifier
addPropertyChangeListener, firePropertyChange, getPropertyChangeSource, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.java.sip.communicator.service.protocol.CallPeer
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

isInitiator

protected boolean isInitiator
Indicates whether this peer was the one that initiated the session.

Constructor Detail

CallPeerGTalkImpl

public CallPeerGTalkImpl(String peerAddress,
                         CallGTalkImpl owningCall)
Creates a new call peer with address peerAddress.

Parameters:
peerAddress - the Google Talk address of the new call peer.
owningCall - the call that contains this call peer.
Method Detail

getAddress

public String getAddress()
Returns a String locator for that peer.

Returns:
the peer's address or phone number.

getURI

public String getURI()
Returns full URI of the address.

Returns:
full URI of the address

setAddress

public void setAddress(String address)
Specifies the address, phone number, or other protocol specific identifier that represents this call peer. This method is to be used by service users and MUST NOT be called by the implementation.

Parameters:
address - The address of this call peer.

getDisplayName

public String getDisplayName()
Returns a human readable name representing this peer.

Returns:
a String containing a name for that peer.

isInitiator

public boolean isInitiator()
Determines whether this peer was the one that initiated the session. Note that if this peer is the initiator of the session then this means we are the responder!

Returns:
true if this peer is the one that initiated the session and false otherwise (i.e. if _we_ initiated the session).

getContact

public Contact getContact()
Returns the contact corresponding to this peer or null if no particular contact has been associated.

Returns:
the Contact corresponding to this peer or null if no particular contact has been associated.

processSessionInitiate

protected void processSessionInitiate(SessionIQ sessionInitIQ)
Processes the session initiation SessionIQ that we were created with, passing its content to the media handler and then sends either a "session-info/ringing" or a "terminate" response.

Parameters:
sessionInitIQ - The SessionIQ that created the session that we are handling here.

initiateSession

protected void initiateSession(Iterable<org.jivesoftware.smack.packet.PacketExtension> sessionInitiateExtensions)
                        throws OperationFailedException
Initiate a Google Talk session SessionIQ.

Parameters:
sessionInitiateExtensions - a collection of additional and optional PacketExtensions to be added to the initiate SessionIQ which is to initiate the session with this CallPeerGTalkImpl
Throws:
OperationFailedException - exception

processSessionReject

public void processSessionReject(SessionIQ sessionIQ)
Puts this peer into a CallPeerState.DISCONNECTED, indicating a reason to the user, if there is one.

Parameters:
sessionIQ - the SessionIQ that's terminating our session.

processSessionTerminate

public void processSessionTerminate(SessionIQ sessionIQ)
Puts this peer into a CallPeerState.DISCONNECTED, indicating a reason to the user, if there is one.

Parameters:
sessionIQ - the SessionIQ that's terminating our session.

processSessionAccept

public void processSessionAccept(SessionIQ sessionInitIQ)
Processes the session initiation SessionIQ that we were created with, passing its content to the media handler.

Parameters:
sessionInitIQ - The SessionIQ that created the session that we are handling here.

processCandidates

public void processCandidates(SessionIQ sessionInitIQ)
Process candidates received.

Parameters:
sessionInitIQ - The SessionIQ that created the session we are handling here

getSessionID

public String getSessionID()
Returns the session ID of the Jingle session associated with this call.

Returns:
the session ID of the Jingle session associated with this call.

getSessInitID

public String getSessInitID()
Returns the IQ ID of the Jingle session-initiate packet associated with this call.

Returns:
the IQ ID of the Jingle session-initiate packet associated with this call.

hangup

public void hangup(boolean failed,
                   String reasonText,
                   org.jivesoftware.smack.packet.PacketExtension reasonOtherExtension)
Ends the call with for this CallPeer. Depending on the state of the peer the method would send a CANCEL, BYE, or BUSY_HERE message and set the new state to DISCONNECTED.

Parameters:
failed - indicates if the hangup is following to a call failure or simply a disconnect
reasonText - the text, if any, to be set on the ReasonPacketExtension as the value of its
reasonOtherExtension - the PacketExtension, if any, to be set on the ReasonPacketExtension as the value of its otherExtension property

answer

public void answer()
            throws OperationFailedException
Indicates a user request to answer an incoming call from this CallPeer. Sends an OK response to callPeer. Make sure that the call peer contains an SDP description when you call this method.

Throws:
OperationFailedException - if we fail to create or send the response.

sendCandidates

protected void sendCandidates(Iterable<GTalkCandidatePacketExtension> candidates)
Sends local candidate addresses from the local peer to the remote peer using the candidates SessionIQ.

Parameters:
candidates - the local candidate addresses to be sent from the local peer to the remote peer using the candidates SessionIQ

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.