1/* 2 * FSM pseudo code used in the design/implementation of the CC PTP agent. 3 */ 4FSM CC_PTP_Agent 5{ 6 State CC_STATE_IDLE { 7 Stimulus CC_EVENT_AVAILABLE { 8 Next_State CC_STATE_PENDING_AVAILABLE; 9 } 10 Stimulus CC_EVENT_CANCEL { 11 Action Set_Selfdestruct; 12 } 13 } 14 State CC_STATE_PENDING_AVAILABLE { 15 Stimulus CC_EVENT_MSG_ALERTING { 16 Action Send_CC_Available(Q931_ALERTING); 17 Next_State CC_STATE_AVAILABLE; 18 } 19 Stimulus CC_EVENT_MSG_DISCONNECT { 20 Action Send_CC_Available(Q931_DISCONNECT); 21 Next_State CC_STATE_AVAILABLE; 22 } 23 Stimulus CC_EVENT_INTERNAL_CLEARING { 24 Action Pass_Up_CC_Cancel; 25 Action Set_Selfdestruct; 26 Next_State CC_STATE_IDLE; 27 } 28 Stimulus CC_EVENT_CANCEL { 29 Action Set_Selfdestruct; 30 Next_State CC_STATE_IDLE; 31 } 32 } 33 State CC_STATE_AVAILABLE { 34 /* 35 * For PTP mode the T_RETENTION timer is not defined. However, 36 * we will use it anyway in this state to protect our resources 37 * from leaks caused by user A not requesting CC. This timer 38 * should be set much longer than the PTMP network link to 39 * allow for variations in user A's CC offer timer. 40 */ 41 Stimulus CC_EVENT_MSG_RELEASE { 42 Action Stop_T_RETENTION; 43 Action Start_T_RETENTION; 44 } 45 Stimulus CC_EVENT_MSG_RELEASE_COMPLETE { 46 Action Stop_T_RETENTION; 47 Action Start_T_RETENTION; 48 } 49 Stimulus CC_EVENT_CC_REQUEST { 50 Action Pass_Up_CC_Request; 51 Action Stop_T_RETENTION; 52 Next_State CC_STATE_REQUESTED; 53 } 54 Stimulus CC_EVENT_INTERNAL_CLEARING { 55 Action Stop_T_RETENTION; 56 Action Start_T_RETENTION; 57 } 58 Stimulus CC_EVENT_TIMEOUT_T_RETENTION { 59 Action Pass_Up_CC_Cancel; 60 Action Stop_T_RETENTION; 61 Action Set_Selfdestruct; 62 Next_State CC_STATE_IDLE; 63 } 64 Stimulus CC_EVENT_CANCEL { 65 Action Stop_T_RETENTION; 66 Action Set_Selfdestruct; 67 Next_State CC_STATE_IDLE; 68 } 69 } 70 State CC_STATE_REQUESTED { 71 Stimulus CC_EVENT_CC_REQUEST_ACCEPT { 72 /* Start T_CCBS5/T_CCNR5 depending upon CC mode. */ 73 Action Start_T_SUPERVISION; 74 Action Reset_A_Status; 75 Next_State CC_STATE_ACTIVATED; 76 } 77 Stimulus CC_EVENT_SIGNALING_GONE { 78 /* Signaling link cleared. */ 79 Action Pass_Up_CC_Cancel; 80 Action Set_Selfdestruct; 81 Next_State CC_STATE_IDLE; 82 } 83 Stimulus CC_EVENT_CANCEL { 84 Action Hangup_Signaling_Link; 85 Action Set_Selfdestruct; 86 Next_State CC_STATE_IDLE; 87 } 88 } 89 State CC_STATE_ACTIVATED { 90 Stimulus CC_EVENT_REMOTE_USER_FREE { 91 Action Pass_Up_A_Status_Indirect; 92 Test = Get_A_Status; 93 Test == Busy { 94 Next_State CC_STATE_SUSPENDED; 95 } 96 Action Send_RemoteUserFree; 97 Next_State CC_STATE_WAIT_CALLBACK; 98 } 99 Stimulus CC_EVENT_SUSPEND { 100 /* Received CCBS_T_Suspend */ 101 Action Set_A_Status_Busy; 102 } 103 Stimulus CC_EVENT_RESUME { 104 /* Received CCBS_T_Resume */ 105 Action Reset_A_Status; 106 } 107 Stimulus CC_EVENT_RECALL { 108 /* Received CCBS_T_Call */ 109 Action Pass_Up_CC_Call; 110 Action Set_Original_Call_Parameters; 111 } 112 Stimulus CC_EVENT_TIMEOUT_T_SUPERVISION { 113 Action Pass_Up_CC_Cancel; 114 Action Hangup_Signaling_Link; 115 Action Stop_T_SUPERVISION; 116 Action Set_Selfdestruct; 117 Next_State CC_STATE_IDLE; 118 } 119 Stimulus CC_EVENT_SIGNALING_GONE { 120 /* Signaling link cleared. */ 121 Action Pass_Up_CC_Cancel; 122 Action Stop_T_SUPERVISION; 123 Action Set_Selfdestruct; 124 Next_State CC_STATE_IDLE; 125 } 126 Stimulus CC_EVENT_CANCEL { 127 Action Hangup_Signaling_Link; 128 Action Stop_T_SUPERVISION; 129 Action Set_Selfdestruct; 130 Next_State CC_STATE_IDLE; 131 } 132 } 133 State CC_STATE_WAIT_CALLBACK { 134 Stimulus CC_EVENT_SUSPEND { 135 /* Received CCBS_T_Suspend */ 136 Action Set_A_Status_Busy; 137 Action Pass_Up_A_Status; 138 Next_State CC_STATE_SUSPENDED; 139 } 140 Stimulus CC_EVENT_RECALL { 141 /* Received CCBS_T_Call */ 142 Action Pass_Up_CC_Call; 143 Action Set_Original_Call_Parameters; 144 } 145 Stimulus CC_EVENT_TIMEOUT_T_SUPERVISION { 146 Action Pass_Up_CC_Cancel; 147 Action Hangup_Signaling_Link; 148 Action Stop_T_SUPERVISION; 149 Action Set_Selfdestruct; 150 Next_State CC_STATE_IDLE; 151 } 152 Stimulus CC_EVENT_SIGNALING_GONE { 153 /* Signaling link cleared. */ 154 Action Pass_Up_CC_Cancel; 155 Action Stop_T_SUPERVISION; 156 Action Set_Selfdestruct; 157 Next_State CC_STATE_IDLE; 158 } 159 Stimulus CC_EVENT_CANCEL { 160 Action Hangup_Signaling_Link; 161 Action Stop_T_SUPERVISION; 162 Action Set_Selfdestruct; 163 Next_State CC_STATE_IDLE; 164 } 165 } 166 State CC_STATE_SUSPENDED { 167 Stimulus CC_EVENT_RESUME { 168 /* Received CCBS_T_Resume */ 169 Action Set_A_Status_Free; 170 Action Pass_Up_A_Status; 171 Action Reset_A_Status; 172 Next_State CC_STATE_ACTIVATED; 173 } 174 Stimulus CC_EVENT_RECALL { 175 /* Received CCBS_T_Call */ 176 Action Pass_Up_CC_Call; 177 Action Set_Original_Call_Parameters; 178 } 179 Stimulus CC_EVENT_TIMEOUT_T_SUPERVISION { 180 Action Pass_Up_CC_Cancel; 181 Action Hangup_Signaling_Link; 182 Action Stop_T_SUPERVISION; 183 Action Set_Selfdestruct; 184 Next_State CC_STATE_IDLE; 185 } 186 Stimulus CC_EVENT_SIGNALING_GONE { 187 /* Signaling link cleared. */ 188 Action Pass_Up_CC_Cancel; 189 Action Stop_T_SUPERVISION; 190 Action Set_Selfdestruct; 191 Next_State CC_STATE_IDLE; 192 } 193 Stimulus CC_EVENT_CANCEL { 194 Action Hangup_Signaling_Link; 195 Action Stop_T_SUPERVISION; 196 Action Set_Selfdestruct; 197 Next_State CC_STATE_IDLE; 198 } 199 } 200} 201