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