2
* FSM pseudo code used in the design/implementation of the CC PTMP monitor.
4
* The CCBSStatusRequest messages are handled independently from this FSM.
6
* The CCBSInterrogate/CCNRInterrogate messages are initiated by a dialplan
7
* application/AMI/CLI (future) and are handled outside of this FSM.
12
Stimulus CC_EVENT_AVAILABLE {
14
* Before event is posted:
15
* Received CallInfoRetain
19
Action Pass_Up_CC_Available;
20
Next_State CC_STATE_AVAILABLE;
22
Stimulus CC_EVENT_CANCEL {
23
Action Set_Selfdestruct;
26
State CC_STATE_AVAILABLE {
28
* The upper layer is responsible for canceling the CC available
29
* offering as a safeguard in case the network cable is disconnected.
30
* The timer should be set much longer than the network T_RETENTION
31
* timer so normally the CC records will be cleaned up by network
34
Stimulus CC_EVENT_CC_REQUEST {
35
/* cc_record->is_ccnr is set before event posted. */
36
Action Queue_CC_Request;
37
Action Start_T_ACTIVATE;
38
Next_State CC_STATE_REQUESTED;
40
Stimulus CC_EVENT_TIMEOUT_T_RETENTION {
42
* Received EraseCallLinkageID
43
* T_RETENTION expired on the network side so we will pretend
44
* that it expired on our side.
46
Action Pass_Up_CC_Cancel;
47
Action Set_Selfdestruct;
48
Next_State CC_STATE_IDLE;
50
Stimulus CC_EVENT_CANCEL {
51
Action Set_Selfdestruct;
52
Next_State CC_STATE_IDLE;
55
State CC_STATE_REQUESTED {
56
Stimulus CC_EVENT_CC_REQUEST_ACCEPT {
58
* Before event is posted:
59
* Received CCBSRequest/CCNRRequest response
63
Action Pass_Up_CC_Req_Rsp_Success;
64
Action Stop_T_ACTIVATE;
66
* Start T_CCBS2 or T_CCNR2 depending upon CC mode.
67
* For PTMP TE mode these timers are not defined. However,
68
* we will use them anyway to protect our resources from leaks
69
* caused by the network cable being disconnected. These
70
* timers should be set much longer than the network
71
* so normally the CC records will be cleaned up by network
74
Action Start_T_SUPERVISION;
75
Next_State CC_STATE_ACTIVATED;
77
Stimulus CC_EVENT_CC_REQUEST_FAIL {
78
Action Pass_Up_CC_Req_Rsp_Fail(error/reject, code);
79
Action Pass_Up_CC_Cancel;
80
Action Stop_T_ACTIVATE;
81
Action Set_Selfdestruct;
82
Next_State CC_STATE_IDLE;
84
Stimulus CC_EVENT_TIMEOUT_T_ACTIVATE {
85
Action Pass_Up_CC_Req_Rsp_Timeout;
86
Action Pass_Up_CC_Cancel;
87
Action Stop_T_ACTIVATE;
88
Action Set_Selfdestruct;
89
Next_State CC_STATE_IDLE;
91
Stimulus CC_EVENT_LINK_CANCEL {
92
/* Received CCBSErase */
93
/* Claim it was a timeout */
94
Action Pass_Up_CC_Req_Rsp_Timeout;
95
Action Pass_Up_CC_Cancel;
96
Action Stop_T_ACTIVATE;
97
Action Set_Selfdestruct;
98
Next_State CC_STATE_IDLE;
100
Stimulus CC_EVENT_CANCEL {
101
Next_State CC_STATE_WAIT_DESTRUCTION;
104
State CC_STATE_WAIT_DESTRUCTION {
105
/* We were in the middle of a cc-request when we were asked to cancel. */
106
Stimulus CC_EVENT_CC_REQUEST_ACCEPT {
108
* Before event is posted:
109
* Received CCBSRequest/CCNRRequest response
110
* Saved CCBSReference
112
Action Send_CC_Deactivate_Req;
113
Action Stop_T_ACTIVATE;
114
Action Set_Selfdestruct;
115
Next_State CC_STATE_IDLE;
117
Stimulus CC_EVENT_CC_REQUEST_FAIL {
118
Action Stop_T_ACTIVATE;
119
Action Set_Selfdestruct;
120
Next_State CC_STATE_IDLE;
122
Stimulus CC_EVENT_TIMEOUT_T_ACTIVATE {
123
Action Stop_T_ACTIVATE;
124
Action Set_Selfdestruct;
125
Next_State CC_STATE_IDLE;
127
Stimulus CC_EVENT_LINK_CANCEL {
128
/* Received CCBSErase */
129
Action Stop_T_ACTIVATE;
130
Action Set_Selfdestruct;
131
Next_State CC_STATE_IDLE;
134
State CC_STATE_ACTIVATED {
135
Stimulus CC_EVENT_B_FREE {
136
/* Received CCBSBFree */
137
Action Pass_Up_B_Free;
139
Stimulus CC_EVENT_REMOTE_USER_FREE {
140
/* Received CCBSRemoteUserFree */
141
Action Pass_Up_Remote_User_Free;
142
Next_State CC_STATE_WAIT_CALLBACK;
144
Stimulus CC_EVENT_TIMEOUT_T_SUPERVISION {
145
Action Send_CC_Deactivate_Req;
146
Action Pass_Up_CC_Cancel;
147
Action Stop_T_SUPERVISION;
148
Action Set_Selfdestruct;
149
Next_State CC_STATE_IDLE;
151
Stimulus CC_EVENT_LINK_CANCEL {
152
/* Received CCBSErase */
153
Action Pass_Up_CC_Cancel;
154
Action Stop_T_SUPERVISION;
155
Action Set_Selfdestruct;
156
Next_State CC_STATE_IDLE;
158
Stimulus CC_EVENT_CANCEL {
159
Action Send_CC_Deactivate_Req;
160
Action Stop_T_SUPERVISION;
161
Action Set_Selfdestruct;
162
Next_State CC_STATE_IDLE;
165
State CC_STATE_WAIT_CALLBACK {
166
Stimulus CC_EVENT_STOP_ALERTING {
167
Action Pass_Up_Stop_Alerting;
168
Next_State CC_STATE_ACTIVATED;
170
Stimulus CC_EVENT_RECALL {
171
/* The original call parameters have already been set. */
172
Action Queue_SETUP_Recall;
173
Next_State CC_STATE_CALLBACK;
175
Stimulus CC_EVENT_TIMEOUT_T_SUPERVISION {
176
Action Send_CC_Deactivate_Req;
177
Action Pass_Up_CC_Cancel;
178
Action Stop_T_SUPERVISION;
179
Action Set_Selfdestruct;
180
Next_State CC_STATE_IDLE;
182
Stimulus CC_EVENT_LINK_CANCEL {
183
/* Received CCBSErase */
184
Action Pass_Up_CC_Cancel;
185
Action Stop_T_SUPERVISION;
186
Action Set_Selfdestruct;
187
Next_State CC_STATE_IDLE;
189
Stimulus CC_EVENT_CANCEL {
190
Action Send_CC_Deactivate_Req;
191
Action Stop_T_SUPERVISION;
192
Action Set_Selfdestruct;
193
Next_State CC_STATE_IDLE;
196
State CC_STATE_CALLBACK {
198
* We are waiting for the CC records to be torn down because
200
* This state is mainly to block CC_EVENT_STOP_ALERTING since
201
* we are the one doing the CC recall so we do not need to stop
204
Stimulus CC_EVENT_TIMEOUT_T_SUPERVISION {
205
Action Send_CC_Deactivate_Req;
206
Action Pass_Up_CC_Cancel;
207
Action Stop_T_SUPERVISION;
208
Action Set_Selfdestruct;
209
Next_State CC_STATE_IDLE;
211
Stimulus CC_EVENT_LINK_CANCEL {
212
/* Received CCBSErase */
213
Action Pass_Up_CC_Cancel;
214
Action Stop_T_SUPERVISION;
215
Action Set_Selfdestruct;
216
Next_State CC_STATE_IDLE;
218
Stimulus CC_EVENT_CANCEL {
219
Action Send_CC_Deactivate_Req;
220
Action Stop_T_SUPERVISION;
221
Action Set_Selfdestruct;
222
Next_State CC_STATE_IDLE;