blob: 1e44a84f24f7387b836e12b9f4160ae94aa145c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol;
/**
* The CallState class reflects the current state of a call. Compared to the
* state of a single call peer, a call itself has a more limited amount
* of sets which follow the following cycle:
* <p>
* CALL_INITIALIZATION -> CALL_IN_PROGRESS -> CALL_ENDED
* <p>
* When you start calling someone or receive a call alert, the call that is
* automatically created is in the CALL_INITIALIZATION_PHASE. As soon as one of
* the peers passes into a CONNECTED call peer state, the call
* would enter the CALL_IN_PROGRESS state. When the last call peer enters
* a DISCONNECTED state the call itself would go into the CALL_ENDED state and
* will be ready for garbage collection.
*
* @author Emil Ivov
*/
public class CallState
{
/**
* This constant containing a String representation of the
* CALL_INITIALIZATION state.
* <p>
* This constant has the String value "Initializing".
*/
public static final String _CALL_INITIALIZATION = "Initializing";
/**
* This constant value indicates that the associated call is currently in an
* initialization state.
*/
public static final CallState CALL_INITIALIZATION =
new CallState(_CALL_INITIALIZATION);
/**
* This constant containing a String representation of the CALL_IN_PROGRESS
* state.
* <p>
* This constant has the String value "In Progress".
*/
public static final String _CALL_IN_PROGRESS = "In Progress";
/**
* This constant value indicates that the associated call is currently in an
* active state.
*/
public static final CallState CALL_IN_PROGRESS =
new CallState(_CALL_IN_PROGRESS);
/**
* This constant containing a String representation of the CALL_ENDED state.
* <p>
* This constant has the String value "Ended".
*/
public static final String _CALL_ENDED = "Ended";
/**
* This constant value indicates that the associated call is currently in a
* terminated phase.
*/
public static final CallState CALL_ENDED = new CallState(_CALL_ENDED);
/**
* This constant containing a String representation of the CALL_REFERED
* state.
* <p>
* This constant has the String value "Referred".
*/
public static final String _CALL_REFERRED = "Refered";
/**
* This constant value indicates that the associated call is currently
* referred.
*/
public static final CallState CALL_REFERRED = new CallState(_CALL_REFERRED);
/**
* A string representation of this Call State. Could be
* _CALL_INITIALIZATION, _CALL_IN_PROGRESS, _CALL_ENDED.
*/
private String callStateStr;
/**
* Create a call state object with a value corresponding to the specified
* string.
*
* @param callState a string representation of the state.
*/
private CallState(String callState)
{
this.callStateStr = callState;
}
/**
* Returns a String representation of this CallState.
*
* @return a string value (one of the _CALL_XXX constants) representing this
* call state).
*/
public String getStateString()
{
return callStateStr;
}
/**
* Returns a string representation of this call state. Strings returned by
* this method have the following format: "CallState:<STATE_STRING>" and are
* meant to be used for logging/debugging purposes.
*
* @return a string representation of this object.
*/
public String toString()
{
return getClass().getName() + ":" + getStateString();
}
}
|