Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.CallPeerState

public class CallPeerState
extends Object

The CallPeerState class reflects the current state of a call peer. In other words when you start calling your grand mother she will be in a INITIATING_CALL state, when her phone rings her state will change to ALERTING_REMOTE_SIDE, and when she replies she will enter a CONNCECTED state.

Though not mandatory CallPeerState would generally have one of the following life cycles

In the case with your grand mother that we just described we have:
INITIATING_CALL -> CONNECTING -> ALERTING_REMOTE_USER -> CONNECTED -> DISCONNECTED

If your granny was already on the phone we have:
INITIATING_CALL -> CONNECTING -> BUSY -> DISCONNECTED

Whenever someone tries to reach you:
INCOMING_CALL -> CONNECTED -> DISCONNECTED

A FAILED state is prone to appear at any place in the above diagram and is generally followed by a disconnected state.

Information on call peer is shown in the phone user interface until they enter the DISCONNECTED state. At that point call peer information is automatically removed from the user interface and the call is considered terminated.

Author:
Emil Ivov, Lubomir Marinov, Yana Stamcheva

Field Summary
static String _ALERTING_REMOTE_SIDE
          This constant value indicates a String representation of the ALERTING_REMOTE_SIDE call state.
static String _BUSY
          This constant value indicates a String representation of the BUSY call state.
static String _CONNECTED
          This constant value indicates a String representation of the CONNECTED call state.
static String _CONNECTING
          This constant value indicates a String representation of the CONNECTING call state.
static String _CONNECTING_WITH_EARLY_MEDIA
          This constant value indicates a String representation of the CONNECTING call state but in cases where early media is being exchanged.
static String _DISCONNECTED
          This constant value indicates a String representation of the DISCONNECTED call state.
static String _FAILED
          This constant value indicates a String representation of the FAILED call state.
static String _INCOMING_CALL
          This constant value indicates a String representation of the INCOMING_CALL call state.
static String _INITIATING_CALL
          This constant value indicates a String representation of the INITIATING_CALL call state.
static String _ON_HOLD_LOCALLY
          The constant value being a String representation of the ON_HOLD_LOCALLY call peer state.
static String _ON_HOLD_MUTUALLY
          The constant value being a String representation of the ON_HOLD_MUTUALLY call peer state.
static String _ON_HOLD_REMOTELY
          The constant value being a String representation of the ON_HOLD_REMOTELY call peer state.
static String _REFERRED
          This constant value indicates a String representation of the REFERRED call state.
static String _UNKNOWN
          This constant value indicates a String representation of the UNKNOWN call state.
static CallPeerState ALERTING_REMOTE_SIDE
          This constant value indicates that the state of the call peer is is ALERTING_REMOTE_SIDE - which means that a network connection to that peer has been established and peer's phone is currently alerting the remote user of the current call.
static CallPeerState BUSY
          This constant value indicates that the state of the call peer is is BUSY - which means that an attempt to establish a call with that peer has been made and that it has been turned down by them (e.g.
static CallPeerState CONNECTED
          This constant value indicates that the state of the call peer is is CONNECTED - which means that there is an ongoing call with that peer.
static CallPeerState CONNECTING
          This constant value indicates that the state of the call peer is CONNECTING - which means that a network connection to that peer is currently being established.
static CallPeerState CONNECTING_INCOMING_CALL
          This constant value indicates that the state of the incoming call peer is CONNECTING - which means that a network connection to that peer is currently being established.
static CallPeerState CONNECTING_INCOMING_CALL_WITH_MEDIA
          This constant value indicates that the state of the incoming call peer is CONNECTING - which means that a network connection to that peer is currently being established and during the process before hearing the other peer we can still can hear media coming from the server for example.
static CallPeerState CONNECTING_WITH_EARLY_MEDIA
          This constant value indicates that the state of the call peer is CONNECTING - which means that a network connection to that peer is currently being established.
static CallPeerState DISCONNECTED
          This constant value indicates that the state of the call peer is is DISCONNECTED - which means that this peer is not participating :) in the call any more.
static CallPeerState FAILED
          This constant value indicates that the state of the call peer is is ON_HOLD - which means that an attempt to establish a call with that peer has failed for an unexpected reason.
static CallPeerState INCOMING_CALL
          This constant value indicates that the state of the call peer is is INCOMING_CALL - which means that the peer is willing to start a call with us.
static CallPeerState INITIATING_CALL
          This constant value indicates that the state of the call peer is is INITIATING_CALL - which means that we're currently trying to open a socket and send our request.
static CallPeerState ON_HOLD_LOCALLY
          The constant value indicating that the state of a call peer is locally put on hold.
static CallPeerState ON_HOLD_MUTUALLY
          The constant value indicating that the state of a call peer is mutually - locally and remotely - put on hold.
static CallPeerState ON_HOLD_REMOTELY
          The constant value indicating that the state of a call peer is remotely put on hold.
static CallPeerState REFERRED
          This constant value indicates that the state of the call peer is is REFERRED - which means that this peer has transfered us to another peer.
static CallPeerState UNKNOWN
          This constant value indicates that the state of the call peer is is UNKNOWN - which means that there is no information on the state for the time being (this constant should be used as a default value for newly created call peer that don't yet have an attributed call state.
 
Method Summary
 String getLocalizedStateString()
          Returns a localized String representation of the CallPeerState.
 String getStateString()
          Returns a String representation of the CallPeerState.
static boolean isOnHold(CallPeerState state)
          Determines whether a specific CallPeerState value signal a call hold regardless of the issuer (which may be local and/or remote).
 String toString()
          Returns a string representation of this call state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_UNKNOWN

public static final String _UNKNOWN
This constant value indicates a String representation of the UNKNOWN call state.
This constant has the String value "Unknown".

See Also:
Constant Field Values

UNKNOWN

public static final CallPeerState UNKNOWN
This constant value indicates that the state of the call peer is is UNKNOWN - which means that there is no information on the state for the time being (this constant should be used as a default value for newly created call peer that don't yet have an attributed call state.


_INITIATING_CALL

public static final String _INITIATING_CALL
This constant value indicates a String representation of the INITIATING_CALL call state.
This constant has the String value "Initiating Call".

See Also:
Constant Field Values

INITIATING_CALL

public static final CallPeerState INITIATING_CALL
This constant value indicates that the state of the call peer is is INITIATING_CALL - which means that we're currently trying to open a socket and send our request. In the case of SIP for example we will leave this state the moment we receive a "100 Trying" request from a proxy or the remote side.


_CONNECTING

public static final String _CONNECTING
This constant value indicates a String representation of the CONNECTING call state.
This constant has the String value "Connecting".

See Also:
Constant Field Values

CONNECTING

public static final CallPeerState CONNECTING
This constant value indicates that the state of the call peer is CONNECTING - which means that a network connection to that peer is currently being established.


_CONNECTING_WITH_EARLY_MEDIA

public static final String _CONNECTING_WITH_EARLY_MEDIA
This constant value indicates a String representation of the CONNECTING call state but in cases where early media is being exchanged.
This constant has the String value "Connecting".

See Also:
Constant Field Values

CONNECTING_WITH_EARLY_MEDIA

public static final CallPeerState CONNECTING_WITH_EARLY_MEDIA
This constant value indicates that the state of the call peer is CONNECTING - which means that a network connection to that peer is currently being established.


CONNECTING_INCOMING_CALL

public static final CallPeerState CONNECTING_INCOMING_CALL
This constant value indicates that the state of the incoming call peer is CONNECTING - which means that a network connection to that peer is currently being established.


CONNECTING_INCOMING_CALL_WITH_MEDIA

public static final CallPeerState CONNECTING_INCOMING_CALL_WITH_MEDIA
This constant value indicates that the state of the incoming call peer is CONNECTING - which means that a network connection to that peer is currently being established and during the process before hearing the other peer we can still can hear media coming from the server for example.


_ALERTING_REMOTE_SIDE

public static final String _ALERTING_REMOTE_SIDE
This constant value indicates a String representation of the ALERTING_REMOTE_SIDE call state.
This constant has the String value "Alerting Remote User".

See Also:
Constant Field Values

ALERTING_REMOTE_SIDE

public static final CallPeerState ALERTING_REMOTE_SIDE
This constant value indicates that the state of the call peer is is ALERTING_REMOTE_SIDE - which means that a network connection to that peer has been established and peer's phone is currently alerting the remote user of the current call.


_INCOMING_CALL

public static final String _INCOMING_CALL
This constant value indicates a String representation of the INCOMING_CALL call state.
This constant has the String value "Incoming Call".

See Also:
Constant Field Values

INCOMING_CALL

public static final CallPeerState INCOMING_CALL
This constant value indicates that the state of the call peer is is INCOMING_CALL - which means that the peer is willing to start a call with us. At that point local side should be playing a sound or a graphical alert (the phone is ringing).


_CONNECTED

public static final String _CONNECTED
This constant value indicates a String representation of the CONNECTED call state.
This constant has the String value "Connected".

See Also:
Constant Field Values

CONNECTED

public static final CallPeerState CONNECTED
This constant value indicates that the state of the call peer is is CONNECTED - which means that there is an ongoing call with that peer.


_DISCONNECTED

public static final String _DISCONNECTED
This constant value indicates a String representation of the DISCONNECTED call state.
This constant has the String value "Disconnected".

See Also:
Constant Field Values

DISCONNECTED

public static final CallPeerState DISCONNECTED
This constant value indicates that the state of the call peer is is DISCONNECTED - which means that this peer is not participating :) in the call any more.


_REFERRED

public static final String _REFERRED
This constant value indicates a String representation of the REFERRED call state.
This constant has the String value "Referred".

See Also:
Constant Field Values

REFERRED

public static final CallPeerState REFERRED
This constant value indicates that the state of the call peer is is REFERRED - which means that this peer has transfered us to another peer.


_BUSY

public static final String _BUSY
This constant value indicates a String representation of the BUSY call state.
This constant has the String value "Busy".

See Also:
Constant Field Values

BUSY

public static final CallPeerState BUSY
This constant value indicates that the state of the call peer is is BUSY - which means that an attempt to establish a call with that peer has been made and that it has been turned down by them (e.g. because they were already in a call).


_FAILED

public static final String _FAILED
This constant value indicates a String representation of the FAILED call state.
This constant has the String value "Failed".

See Also:
Constant Field Values

FAILED

public static final CallPeerState FAILED
This constant value indicates that the state of the call peer is is ON_HOLD - which means that an attempt to establish a call with that peer has failed for an unexpected reason.


_ON_HOLD_LOCALLY

public static final String _ON_HOLD_LOCALLY
The constant value being a String representation of the ON_HOLD_LOCALLY call peer state.

This constant has the String value "Locally On Hold".

See Also:
Constant Field Values

ON_HOLD_LOCALLY

public static final CallPeerState ON_HOLD_LOCALLY
The constant value indicating that the state of a call peer is locally put on hold.


_ON_HOLD_MUTUALLY

public static final String _ON_HOLD_MUTUALLY
The constant value being a String representation of the ON_HOLD_MUTUALLY call peer state.

This constant has the String value "Mutually On Hold".

See Also:
Constant Field Values

ON_HOLD_MUTUALLY

public static final CallPeerState ON_HOLD_MUTUALLY
The constant value indicating that the state of a call peer is mutually - locally and remotely - put on hold.


_ON_HOLD_REMOTELY

public static final String _ON_HOLD_REMOTELY
The constant value being a String representation of the ON_HOLD_REMOTELY call peer state.

This constant has the String value "Remotely On Hold".

See Also:
Constant Field Values

ON_HOLD_REMOTELY

public static final CallPeerState ON_HOLD_REMOTELY
The constant value indicating that the state of a call peer is remotely put on hold.

Method Detail

isOnHold

public static final boolean isOnHold(CallPeerState state)
Determines whether a specific CallPeerState value signal a call hold regardless of the issuer (which may be local and/or remote).

Parameters:
state - the CallPeerState value to be checked whether it signals a call hold
Returns:
true if the specified state signals a call hold; false, otherwise

getStateString

public String getStateString()
Returns a String representation of the CallPeerState.

Returns:
A string value (one of the _BUSY, _CALLING, _CONNECTED, _CONNECTING, _DISCONNECTED, _FAILED, _RINGING constants) representing this call peer state).

getLocalizedStateString

public String getLocalizedStateString()
Returns a localized String representation of the CallPeerState.

Returns:
a localized String representation of the CallPeerState

toString

public String toString()
Returns a string representation of this call state. Strings returned by this method have the following format: CallPeerState: and are meant to be used for logging/debugging purposes.

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

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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