Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.protocol
Class Call

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.Call
All Implemented Interfaces:
EventListener, CallGroupListener
Direct Known Subclasses:
AbstractCall

public abstract class Call
extends Object
implements CallGroupListener

A representation of a Call. The Call class must only be created by users (i.e. telephony protocols) of the PhoneUIService such as a SIP protocol implementation. Extensions of this class might have names like CallSipImpl or CallJabberImpl or CallAnyOtherTelephonyProtocolImpl

Author:
Emil Ivov, Emanuel Onica

Constructor Summary
protected Call(ProtocolProviderService sourceProvider)
          Creates a new Call instance.
 
Method Summary
 void addCallChangeListener(CallChangeListener listener)
          Adds a call change listener to this call so that it could receive events on new call peers, theme changes and others.
abstract  void addLocalUserSoundLevelListener(SoundLevelListener l)
          Adds a specific SoundLevelListener to the list of listeners interested in and notified about changes in local sound level related information.
 boolean equals(Object obj)
          Compares the specified object with this call and returns true if it the specified object is an instance of a Call object and if the extending telephony protocol considers the calls represented by both objects to be the same.
protected  void fireCallChangeEvent(String type, Object oldValue, Object newValue)
          Creates a CallChangeEvent with this class as sourceCall, and the specified eventID and old and new values and dispatches it on all currently registered listeners.
protected  void fireCallChangeEvent(String type, Object oldValue, Object newValue, CallPeerChangeEvent cause)
          Creates a CallChangeEvent with this class as sourceCall, and the specified eventID and old and new values and dispatches it on all currently registered listeners.
protected  void fireCallPeerEvent(CallPeer sourceCallPeer, int eventID)
          Creates a CallPeerEvent with sourceCallPeer and eventID and dispatches it on all currently registered listeners.
abstract  CallGroup getCallGroup()
          Returns the CallGroup from which this Call belongs.
 String getCallID()
          Returns the id of the specified Call.
abstract  int getCallPeerCount()
          Returns the number of peers currently associated with this call.
abstract  Iterator<? extends CallPeer> getCallPeers()
          Returns an iterator over all call peers.
 CallState getCallState()
          Returns the state that this call is currently in.
abstract  int getCrossProtocolCallPeerCount()
          Returns the number of cross-protocol peers currently associated with this call.
abstract  Iterator<CallPeer> getCrossProtocolCallPeers()
          Returns an iterator over all cross-protocol call peers.
 ProtocolProviderService getProtocolProvider()
          Returns a reference to the ProtocolProviderService instance that created this call.
 int hashCode()
          Returns a hash code value for this call.
abstract  boolean isConferenceFocus()
          Gets the indicator which determines whether the local peer represented by this Call is acting as a conference focus and thus should send the "isfocus" parameter in the Contact headers of its outgoing SIP signaling.
 boolean isDefaultEncrypted()
          Returns the default call encryption flag
 boolean isSipZrtpAttribute()
          Check if to include the ZRTP attribute to SIP/SDP
 void removeCallChangeListener(CallChangeListener listener)
          Removes listener to this call so that it won't receive further CallChangeEvents.
abstract  void removeLocalUserSoundLevelListener(SoundLevelListener l)
          Removes a specific SoundLevelListener of the list of listeners interested in and notified about changes in local sound level related information.
abstract  void setCallGroup(CallGroup callGroup)
          Sets the CallGroup of this Call.
protected  void setCallState(CallState newState)
          Sets the state of this call and fires a call change event notifying registered listeners for the change.
protected  void setCallState(CallState newState, CallPeerChangeEvent cause)
          Sets the state of this call and fires a call change event notifying registered listeners for the change.
 String toString()
          Returns a string textually representing this Call.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.java.sip.communicator.service.protocol.event.CallGroupListener
callAdded, callRemoved
 

Constructor Detail

Call

protected Call(ProtocolProviderService sourceProvider)
Creates a new Call instance.

Parameters:
sourceProvider - the proto provider that created us.
Method Detail

getCallID

public String getCallID()
Returns the id of the specified Call.

Returns:
a String uniquely identifying the call.

equals

public boolean equals(Object obj)
Compares the specified object with this call and returns true if it the specified object is an instance of a Call object and if the extending telephony protocol considers the calls represented by both objects to be the same.

Overrides:
equals in class Object
Parameters:
obj - the call to compare this one with.
Returns:
true in case both objects are pertaining to the same call and false otherwise.

hashCode

public int hashCode()
Returns a hash code value for this call.

Overrides:
hashCode in class Object
Returns:
a hash code value for this call.

addCallChangeListener

public void addCallChangeListener(CallChangeListener listener)
Adds a call change listener to this call so that it could receive events on new call peers, theme changes and others.

Parameters:
listener - the listener to register

removeCallChangeListener

public void removeCallChangeListener(CallChangeListener listener)
Removes listener to this call so that it won't receive further CallChangeEvents.

Parameters:
listener - the listener to register

getProtocolProvider

public ProtocolProviderService getProtocolProvider()
Returns a reference to the ProtocolProviderService instance that created this call.

Returns:
a reference to the ProtocolProviderService instance that created this call.

fireCallPeerEvent

protected void fireCallPeerEvent(CallPeer sourceCallPeer,
                                 int eventID)
Creates a CallPeerEvent with sourceCallPeer and eventID and dispatches it on all currently registered listeners.

Parameters:
sourceCallPeer - the source CallPeer for the newly created event.
eventID - the ID of the event to create (see CPE member ints)

toString

public String toString()
Returns a string textually representing this Call.

Overrides:
toString in class Object
Returns:
a string representation of the object.

fireCallChangeEvent

protected void fireCallChangeEvent(String type,
                                   Object oldValue,
                                   Object newValue)
Creates a CallChangeEvent with this class as sourceCall, and the specified eventID and old and new values and dispatches it on all currently registered listeners.

Parameters:
type - the type of the event to create (see CallChangeEvent member ints)
oldValue - the value of the call property that changed, before the event had occurred.
newValue - the value of the call property that changed, after the event has occurred.

fireCallChangeEvent

protected void fireCallChangeEvent(String type,
                                   Object oldValue,
                                   Object newValue,
                                   CallPeerChangeEvent cause)
Creates a CallChangeEvent with this class as sourceCall, and the specified eventID and old and new values and dispatches it on all currently registered listeners.

Parameters:
type - the type of the event to create (see CallChangeEvent member ints)
oldValue - the value of the call property that changed, before the event had occurred.
newValue - the value of the call property that changed, after the event has occurred.
cause - the event that is the initial cause of the current one.

getCallState

public CallState getCallState()
Returns the state that this call is currently in.

Returns:
a reference to the CallState instance that the call is currently in.

setCallState

protected void setCallState(CallState newState)
Sets the state of this call and fires a call change event notifying registered listeners for the change.

Parameters:
newState - a reference to the CallState instance that the call is to enter.

setCallState

protected void setCallState(CallState newState,
                            CallPeerChangeEvent cause)
Sets the state of this call and fires a call change event notifying registered listeners for the change.

Parameters:
newState - a reference to the CallState instance that the call is to enter.
cause - the event that is the cause of the current change of state.

isDefaultEncrypted

public boolean isDefaultEncrypted()
Returns the default call encryption flag

Returns:
the default call encryption flag

isSipZrtpAttribute

public boolean isSipZrtpAttribute()
Check if to include the ZRTP attribute to SIP/SDP

Returns:
include the ZRTP attribute to SIP/SDP

setCallGroup

public abstract void setCallGroup(CallGroup callGroup)
Sets the CallGroup of this Call.

Parameters:
callGroup - CallGroup to set

getCallGroup

public abstract CallGroup getCallGroup()
Returns the CallGroup from which this Call belongs.

Returns:
CallGroup or null if the Call does not belongs to a CallGroup

getCallPeers

public abstract Iterator<? extends CallPeer> getCallPeers()
Returns an iterator over all call peers.

Returns:
an Iterator over all peers currently involved in the call.

getCallPeerCount

public abstract int getCallPeerCount()
Returns the number of peers currently associated with this call.

Returns:
an int indicating the number of peers currently associated with this call.

getCrossProtocolCallPeers

public abstract Iterator<CallPeer> getCrossProtocolCallPeers()
Returns an iterator over all cross-protocol call peers.

Returns:
an Iterator over all cross-protocol peers currently involved in the call.

getCrossProtocolCallPeerCount

public abstract int getCrossProtocolCallPeerCount()
Returns the number of cross-protocol peers currently associated with this call.

Returns:
an int indicating the number of cross-protocol peers currently associated with this call.

isConferenceFocus

public abstract boolean isConferenceFocus()
Gets the indicator which determines whether the local peer represented by this Call is acting as a conference focus and thus should send the "isfocus" parameter in the Contact headers of its outgoing SIP signaling.

Returns:
true if the local peer represented by this Call is acting as a conference focus; otherwise, false

addLocalUserSoundLevelListener

public abstract void addLocalUserSoundLevelListener(SoundLevelListener l)
Adds a specific SoundLevelListener to the list of listeners interested in and notified about changes in local sound level related information.

Parameters:
l - the SoundLevelListener to add

removeLocalUserSoundLevelListener

public abstract void removeLocalUserSoundLevelListener(SoundLevelListener l)
Removes a specific SoundLevelListener of the list of listeners interested in and notified about changes in local sound level related information.

Parameters:
l - the SoundLevelListener to remove

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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