[svn-commits] rmudgett: branch rmudgett/q931_fsm r2256 - /team/rmudgett/q931_fsm/doc/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 15 17:36:14 CDT 2011


Author: rmudgett
Date: Tue Mar 15 17:36:10 2011
New Revision: 2256

URL: http://svnview.digium.com/svn/libpri?view=rev&rev=2256
Log:
* Converted timers to use state Prolog/Epilog events.

* Fixed T301 handling not covered by SDL diagrams.

* Updated T309 processing.  Only Null(U0) and Active(U10) are stable
states.

Modified:
    team/rmudgett/q931_fsm/doc/q931_user.fsm

Modified: team/rmudgett/q931_fsm/doc/q931_user.fsm
URL: http://svnview.digium.com/svn/libpri/team/rmudgett/q931_fsm/doc/q931_user.fsm?view=diff&rev=2256&r1=2255&r2=2256
==============================================================================
--- team/rmudgett/q931_fsm/doc/q931_user.fsm (original)
+++ team/rmudgett/q931_fsm/doc/q931_user.fsm Tue Mar 15 17:36:10 2011
@@ -48,7 +48,6 @@
 			/* Need to pick a new call reference */
 			Action Pick_Call_Reference;
 			Action Send(RESUME(call_id));
-			Action Start_T318;
 			Next_State q931_user_resume_request;
 		}
 		Stimulus Q931_EV_MSG_SETUP {
@@ -59,7 +58,6 @@
 			/* Call reference already selected when call structure created. */
 			Action Pick_Call_Reference;
 			Action Send(SETUP);
-			Action Start_T303;
 			Next_State q931_user_call_initiated;
 		}
 		Stimulus Q931_EV_MSG_STATUS {
@@ -83,38 +81,33 @@
 	State q931_user_call_initiated {// aka U1
 		Prolog {
 			Action Set_State(Q931_CALL_STATE_CALL_INITIATED);
-		}
-		Init {
-		}
-		Epilog {
+			Action Start_T303;
+		}
+		Init {
+		}
+		Epilog {
+			Action Stop_T303;
 		}
 		Stimulus Q931_EV_MGMT_OVERLAP_DIGIT(digit) {
 			Action Save_Overlap_Digit(digit);
 		}
-		Stimulus Q931_EV_MGMT_DISCONNECT_REQUEST(cause) {
+		Stimulus Q931_EV_MGMT_DISCONNECT_REQ(cause) {
 			Action Send(DISCONNECT(cause));
-			Action Stop_T303;
-			Action Start_T305;
 			Next_State q931_user_disconnect_request;
 		}
 		Stimulus Q931_EV_MSG_SETUP_ACKNOWLEDGE {
-			Action Stop_T303;
 			if (Stored_Overlap_Digits) {
 				Action Send(INFORMATION(Stored_Overlap_Digits));
 			}
 			Action Post_Mgmt(SETUP_ACKNOWLEDGE);
-			Action Start_T304;
 			Next_State q931_user_overlap_sending;
 		}
 		Stimulus Q931_EV_MSG_RELEASE_COMPLETE {
-			Action Stop_T303;
 			Action Post_Mgmt(HANGUP(cause));
 			Action Release_Call_Reference;
 			Next_State q931_user_null;
 		}
 		Stimulus Q931_EV_MSG_PROCEEDING {
-			Action Stop_T303;
-			Action Start_T310;
 			Action Post_Mgmt(PROCEEDING);
 			Next_State q931_user_outgoing_call_proceeding;
 		}
@@ -129,12 +122,10 @@
 			}
 		}
 		Stimulus Q931_EV_MSG_ALERTING {
-			Action Stop_T303;
 			Action Post_Mgmt(ALERTING);
 			Next_State q931_user_call_delivered;
 		}
 		Stimulus Q931_EV_MSG_CONNECT {
-			Action Stop_T303;
 			Action Post_Mgmt(CONNECT);
 			if (Connect_Ack_Option) {
 				Action Send(CONNECT_ACKNOWLEDGE);
@@ -148,10 +139,16 @@
 	State q931_user_overlap_sending {// aka U2
 		Prolog {
 			Action Set_State(Q931_CALL_STATE_OVERLAP_SENDING);
-		}
-		Init {
-		}
-		Epilog {
+			/*
+			 * If T304 is -1(default) do not start it because the
+			 * upper layer is to enforce/implement the timer.
+			 */
+			Action Start_T304;
+		}
+		Init {
+		}
+		Epilog {
+			Action Stop_T304;
 		}
 		Stimulus Q931_EV_MGMT_OVERLAP_DIGIT(digit) {
 			Action Send(INFORMATION(digit));
@@ -159,13 +156,10 @@
 			Action Start_T304;
 		}
 		Stimulus Q931_EV_MSG_PROCEEDING {
-			Action Stop_T304;
-			Action Start_T310;
 			Action Post_Mgmt(PROCEEDING);
 			Next_State q931_user_outgoing_call_proceeding;
 		}
 		Stimulus Q931_EV_MSG_ALERTING {
-			Action Stop_T304;
 			Action Post_Mgmt(ALERTING);
 			Next_State q931_user_call_delivered;
 		}
@@ -177,7 +171,6 @@
 			Action Post_Mgmt(PROGRESS);
 		}
 		Stimulus Q931_EV_MSG_CONNECT {
-			Action Stop_T304;
 			Action Post_Mgmt(CONNECT);
 			if (Connect_Ack_Option) {
 				Action Send(CONNECT_ACKNOWLEDGE);
@@ -186,25 +179,20 @@
 		}
 		Stimulus Q931_EV_MGMT_RELEASE_REQ {
 			Action Send(RELEASE(PRI_CAUSE_CHANNEL_UNACCEPTABLE));
-			Action Stop_T304;
-			Action Start_T308;
 			Next_State q931_user_release_request;
 		}
 		Stimulus Q931_EV_TIMEOUT_T304 {
+			Action Send(DISCONNECT(PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE));
+			Action Post_Mgmt(HANGUP(PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE));
+			Next_State q931_user_disconnect_request;
+		}
+		Stimulus Q931_EV_DL_ESTABLISH_IND {
 			Action Send(DISCONNECT());
-			Action Start_T305;
 			Action Post_Mgmt(HANGUP(cause));
 			Next_State q931_user_disconnect_request;
 		}
-		Stimulus Q931_EV_DL_ESTABLISH_IND {
-			Action Send(DISCONNECT());
-			Action Start_T305;
-			Action Post_Mgmt(HANGUP(cause));
-			Next_State q931_user_disconnect_request;
-		}
 		Stimulus Q931_EV_DL_RELEASE_IND {
 			Action Post_Mgmt(HANGUP(PRI_CAUSE_NETWORK_OUT_OF_ORDER));
-			Action Stop_T304;
 			Action Release_Call_Reference;
 			Next_State q931_user_null;
 		}
@@ -215,52 +203,20 @@
 	State q931_user_outgoing_call_proceeding {// aka U3
 		Prolog {
 			Action Set_State(Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING);
-		}
-		Init {
-		}
-		Epilog {
+			Action Start_T310;
+		}
+		Init {
+		}
+		Epilog {
+			Action Stop_T310;
 		}
 		Stimulus Q931_EV_MSG_PROGRESS {
 			Action Stop_T310;
 			Action Post_Mgmt(PROGRESS);
 		}
 		Stimulus Q931_EV_MSG_ALERTING {
-			Action Stop_T310;
-			Action Start_T301;
 			Action Post_Mgmt(ALERTING);
 			Next_State q931_user_call_delivered;
-		}
-		Stimulus Q931_EV_MSG_CONNECT {
-			Action Stop_T310;
-			Action Post_Mgmt(CONNECT);
-			if (Connect_Ack_Option) {
-				Action Send(CONNECT_ACKNOWLEDGE);
-			}
-			Next_State q931_user_active;
-		}
-		Stimulus Q931_EV_TIMEOUT_T310 {
-			Action Send(DISCONNECT());
-			Action Start_T305;
-			Action Post_Mgmt(HANGUP(cause));
-			Next_State q931_user_disconnect_request;
-		}
-		Stimulus Q931_EV_MGMT_RELEASE_REQ {
-			Action Stop_T310;
-			Action Send(RELEASE(PRI_CAUSE_CHANNEL_UNACCEPTABLE));
-			Action Start_T308;
-			Next_State q931_user_release_request;
-		}
-	}
-
-/* ******************************************************************** */
-
-	State q931_user_call_delivered {// aka U4
-		Prolog {
-			Action Set_State(Q931_CALL_STATE_CALL_DELIVERED);
-		}
-		Init {
-		}
-		Epilog {
 		}
 		Stimulus Q931_EV_MSG_CONNECT {
 			Action Post_Mgmt(CONNECT);
@@ -269,6 +225,41 @@
 			}
 			Next_State q931_user_active;
 		}
+		Stimulus Q931_EV_TIMEOUT_T310 {
+			Action Send(DISCONNECT(PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE));
+			Action Post_Mgmt(HANGUP(PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE));
+			Next_State q931_user_disconnect_request;
+		}
+		Stimulus Q931_EV_MGMT_RELEASE_REQ {
+			Action Send(RELEASE(PRI_CAUSE_CHANNEL_UNACCEPTABLE));
+			Next_State q931_user_release_request;
+		}
+	}
+
+/* ******************************************************************** */
+
+	State q931_user_call_delivered {// aka U4
+		Prolog {
+			Action Set_State(Q931_CALL_STATE_CALL_DELIVERED);
+			Action Start_T301;
+		}
+		Init {
+		}
+		Epilog {
+			Action Stop_T301;
+		}
+		Stimulus Q931_EV_MSG_CONNECT {
+			Action Post_Mgmt(CONNECT);
+			if (Connect_Ack_Option) {
+				Action Send(CONNECT_ACKNOWLEDGE);
+			}
+			Next_State q931_user_active;
+		}
+		Stimulus Q931_EV_TIMEOUT_T301 {
+			Action Send(DISCONNECT(PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE));
+			Action Post_Mgmt(HANGUP(PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE));
+			Next_State q931_user_disconnect_request;
+		}
 	}
 
 /* ******************************************************************** */
@@ -283,16 +274,14 @@
 		}
 		Stimulus Q931_EV_MGMT_SETUP_ACKNOWLEDGE {
 			Action Send(SETUP_ACKNOWLEDGE);
-			Action Start_T302;
 			Next_State q931_user_overlap_receiving;
 		}
 		Stimulus Q931_EV_MGMT_ALERTING {
 			Action Send(ALERTING);
-			Next_State q931_user_call_delivered;
+			Next_State q931_user_call_received;
 		}
 		Stimulus Q931_EV_MGMT_CONNECT {
 			Action Send(CONNECT);
-			Action Start_T313;
 			Next_State q931_user_connect_request;
 		}
 		Stimulus Q931_EV_MGMT_REJECT_REQ(cause) {
@@ -330,29 +319,28 @@
 		}
 		Stimulus Q931_EV_MGMT_CONNECT {
 			Action Send(CONNECT);
+			Next_State q931_user_connect_request;
+		}
+	}
+
+/* ******************************************************************** */
+
+	State q931_user_connect_request {// aka U8
+		Prolog {
+			Action Set_State(Q931_CALL_STATE_CONNECT_REQUEST);
 			Action Start_T313;
-			Next_State q931_user_connect_request;
-		}
-	}
-
-/* ******************************************************************** */
-
-	State q931_user_connect_request {// aka U8
-		Prolog {
-			Action Set_State(Q931_CALL_STATE_CONNECT_REQUEST);
-		}
-		Init {
-		}
-		Epilog {
+		}
+		Init {
+		}
+		Epilog {
+			Action Stop_T313;
 		}
 		Stimulus Q931_EV_TIMEOUT_T313 {
-			Action Send(DISCONNECT);
-			Action Start_T305;
-			Action Post_Mgmt(HANGUP(cause));
+			Action Send(DISCONNECT(PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE));
+			Action Post_Mgmt(HANGUP(PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE));
 			Next_State q931_user_disconnect_request;
 		}
 		Stimulus Q931_EV_MSG_CONNECT_ACKNOWLEDGE {
-			Action Stop_T313;
 			Action Post_Mgmt(CONNECT_ACKNOWLEDGE);
 			Next_State q931_user_active;
 		}
@@ -370,7 +358,6 @@
 		}
 		Stimulus Q931_EV_MGMT_CONNECT {
 			Action Send(CONNECT);
-			Action Start_T313;
 			Next_State q931_user_connect_request;
 		}
 		Stimulus Q931_EV_MGMT_ALERTING {
@@ -394,7 +381,6 @@
 		}
 		Stimulus Q931_EV_MGMT_SUSPEND_REQ(call_id) {
 			Action Send(SUSPEND(call_id));
-			Action Start_T319;
 			Next_State q931_user_suspend_request;
 		}
 		Stimulus Q931_EV_MSG_NOTIFY {
@@ -403,6 +389,13 @@
 		Stimulus Q931_EV_MGMT_NOTIFY {
 			Action Send(NOTIFY);
 		}
+		Stimulus Q931_EV_DL_RELEASE_IND {
+			/* i.e. if T309 is not already running, start it. */
+			if (!Any_Timer_Running) {
+				Action Start_T309;
+			}
+			Action DL_Establish_Request;
+		}
 	}
 
 /* ******************************************************************** */
@@ -410,27 +403,25 @@
 	State q931_user_disconnect_request {// aka U11
 		Prolog {
 			Action Set_State(Q931_CALL_STATE_DISCONNECT_REQUEST);
-		}
-		Init {
-		}
-		Epilog {
+			Action Start_T305;
+		}
+		Init {
+		}
+		Epilog {
+			Action Stop_T305;
 		}
 		Stimulus Q931_EV_MSG_RELEASE {
-			Action Stop_T305;
 			Action Post_Mgmt(HANGUP(cause));
 			Action Send(RELEASE_COMPLETE(cause));
 			Action Release_Call_Reference;
 			Next_State q931_user_null;
 		}
 		Stimulus Q931_EV_MSG_DISCONNECT {
-			Action Stop_T305;
 			Action Send(RELEASE(cause));
-			Action Start_T308;
 			Next_State q931_user_release_request;
 		}
 		Stimulus Q931_EV_TIMEOUT_T305 {
 			Action Send(RELEASE(cause));
-			Action Start_T308;
 			Next_State q931_user_release_request;
 		}
 		Stimulus Q931_EV_MSG_NOTIFY {
@@ -462,7 +453,6 @@
 		}
 		Stimulus Q931_EV_MGMT_RELEASE_REQ {
 			Action Send(RELEASE(cause));
-			Action Start_T308;
 			Next_State q931_user_release_request;
 		}
 	}
@@ -472,29 +462,27 @@
 	State q931_user_suspend_request {// aka U15
 		Prolog {
 			Action Set_State(Q931_CALL_STATE_SUSPEND_REQUEST);
-		}
-		Init {
-		}
-		Epilog {
+			Action Start_T319;
+		}
+		Init {
+		}
+		Epilog {
+			Action Stop_T319;
 		}
 		Stimulus Q931_EV_MSG_SUSPEND_ACKNOWLEDGE {
-			Action Stop_T319;
 			Action Post_Mgmt(SUSPEND_ACKNOWLEDGE);
 			Action Release_Call_Reference;
 			Next_State q931_user_null;
 		}
 		Stimulus Q931_EV_MSG_SUSPEND_REJECT {
-			Action Stop_T319;
 			Action Post_Mgmt(SUSPEND_REJECT(cause));
 			Next_State q931_user_active;
 		}
 		Stimulus Q931_EV_MSG_DISCONNECT {
-			Action Stop_T319;
 			Action Post_Mgmt(HANGUP_REQ(cause));
 			Next_State q931_user_disconnect_indication;
 		}
 		Stimulus Q931_EV_MSG_RELEASE {
-			Action Stop_T319;
 			Action Post_Mgmt(HANGUP(cause));
 			Action Send(RELEASE_COMPLETE(cause));
 			Action Release_Call_Reference;
@@ -511,48 +499,47 @@
 	State q931_user_resume_request {// aka U17
 		Prolog {
 			Action Set_State(Q931_CALL_STATE_RESUME_REQUEST);
-		}
-		Init {
-		}
-		Epilog {
+			Action Start_T318;
+		}
+		Init {
+		}
+		Epilog {
+			Action Stop_T318;
 		}
 		Stimulus Q931_EV_MSG_RESUME_ACKNOWLEDGE {
-			Action Stop_T318;
 			Action Post_Mgmt(RESUME_ACKNOWLEDGE);
 			Next_State q931_user_active;
 		}
 		Stimulus Q931_EV_MSG_RESUME_REJECT {
-			Action Stop_T318;
 			Action Post_Mgmt(RESUME_REJECT(cause));
 			Action Release_Call_Reference;
 			Next_State q931_user_null;
 		}
 		Stimulus Q931_EV_TIMEOUT_T318 {
 			Action Post_Mgmt(RESUME_REJECT(timeout));
-			Action Send(RELEASE(cause));
+			Action Send(RELEASE(PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE));
+			Next_State q931_user_release_request;
+		}
+	}
+
+/* ******************************************************************** */
+
+	State q931_user_release_request {// aka U19
+		Prolog {
+			Action Set_State(Q931_CALL_STATE_RELEASE_REQUEST);
 			Action Start_T308;
-			Next_State q931_user_release_request;
-		}
-	}
-
-/* ******************************************************************** */
-
-	State q931_user_release_request {// aka U19
-		Prolog {
-			Action Set_State(Q931_CALL_STATE_RELEASE_REQUEST);
-		}
-		Init {
-		}
-		Epilog {
+		}
+		Init {
+		}
+		Epilog {
+			Action Stop_T308;
 		}
 		Stimulus Q931_EV_MSG_RELEASE_COMPLETE {
-			Action Stop_T308;
 			Action Post_Mgmt(HANGUP_ACKNOWLEDGE);
 			Action Release_Call_Reference;
 			Next_State q931_user_null;
 		}
 		Stimulus Q931_EV_MSG_RELEASE {
-			Action Stop_T308;
 			Action Post_Mgmt(HANGUP_ACKNOWLEDGE);
 			Action Release_Call_Reference;
 			Next_State q931_user_null;
@@ -582,10 +569,16 @@
 	State q931_user_overlap_receiving {// aka U25
 		Prolog {
 			Action Set_State(Q931_CALL_STATE_OVERLAP_RECEIVING);
-		}
-		Init {
-		}
-		Epilog {
+			/*
+			 * If T302 is -1(default) do not start it because the
+			 * upper layer is to enforce/implement the timer.
+			 */
+			Action Start_T302;
+		}
+		Init {
+		}
+		Epilog {
+			Action Stop_T302;
 		}
 		Stimulus Q931_EV_MSG_INFORMATION {
 			if (keypad_digits) {
@@ -596,40 +589,35 @@
 			if (display) {
 				Action Post_Mgmt(INFORMATION(display_text));
 			}
+			Action Stop_T302;
 			Action Start_T302;
 		}
 		Stimulus Q931_EV_MGMT_PROCEEDING {
-			Action Stop_T302;
 			Action Send(PROCEEDING);
 			Next_State q931_user_incoming_call_proceeding;
 		}
 		Stimulus Q931_EV_MGMT_ALERTING {
-			Action Stop_T302;
 			Action Send(ALERTING);
 			Next_State q931_user_call_received;
 		}
 		Stimulus Q931_EV_MGMT_CONNECT {
+			Action Send(CONNECT);
+			Next_State q931_user_connect_request;
+		}
+		Stimulus Q931_EV_TIMEOUT_T302 {
 			Action Stop_T302;
-			Action Send(CONNECT);
-			Action Start_T313;
-			Next_State q931_user_connect_request;
-		}
-		Stimulus Q931_EV_TIMEOUT_T302 {
 			Post_Mgmt(OVERLAP_TIMEOUT);
 		}
 		Stimulus Q931_EV_MGMT_PROGRESS {
 			Action Send(PROGRESS);
 		}
 		Stimulus Q931_EV_DL_ESTABLISH_IND {
-			Action Stop_T302;
 			Action Send(DISCONNECT());
-			Action Start_T305;
 			Action Post_Mgmt(HANGUP(cause));
 			Next_State q931_user_disconnect_request;
 		}
 		Stimulus Q931_EV_DL_RELEASE_IND {
 			Action Post_Mgmt(HANGUP(PRI_CAUSE_NETWORK_OUT_OF_ORDER));
-			Action Stop_T302;
 			Action Release_Call_Reference;
 			Next_State q931_user_null;
 		}
@@ -671,7 +659,8 @@
 			Action pri_error("Should never be used.");
 		}
 		Epilog {
-			Action Stop_All_Timers;
+			Action Stop_T309;
+			//Action Stop_All_Timers;
 			if (!upper_layer_knows_call_reference) {
 				Action Post_Event(Q931_EV_MGMT_DESTROY);
 			}
@@ -695,13 +684,13 @@
 			}
 		}
 		Stimulus Q931_EV_DL_RELEASE_IND {
-			if (!Any_Timer_Running) {
-				Action Start_T309;
-			}
-			Action DL_Establish_Request;
+			//Action Stop_All_Timers;
+			Action Post_Mgmt(HANGUP(PRI_CAUSE_NETWORK_OUT_OF_ORDER));
+			Action Release_Call_Reference;
+			Next_State q931_user_null;
 		}
 		Stimulus Q931_EV_DL_ESTABLISH_CONFIRM {
-       			Action Stop_T309;
+			Action Stop_T309;
 			Action Send(STATUS());
 		}
 		Stimulus Q931_EV_TIMEOUT_T309 {
@@ -735,7 +724,6 @@
 			if (cause == PRI_CAUSE_WRONG_CALL_STATE) {
 				Action Post_Mgmt(HANGUP(cause));
 				Action Send(DISCONNECT(cause));
-				Action Start_T305;
 				Next_State q931_user_disconnect_request;
 			}
 			#endif
@@ -785,7 +773,7 @@
 		Epilog {
 		}
 		Stimulus Q931_EV_MSG_RELEASE_COMPLETE {
-			Action Stop_All_Timers;
+			//Action Stop_All_Timers;
 			Action Post_Mgmt(HANGUP_ACK(cause));
 			Action Release_Call_Reference;
 			Next_State q931_user_null;
@@ -803,20 +791,19 @@
 		Epilog {
 		}
 		Stimulus Q931_EV_MSG_RELEASE {
-			Action Stop_All_Timers;
+			//Action Stop_All_Timers;
 			Action Post_Mgmt(HANGUP(cause));
 			Action Send(RELEASE_COMPLETE(cause));
 			Action Release_Call_Reference;
 			Next_State q931_user_null;
 		}
 		Stimulus Q931_EV_MSG_DISCONNECT {
-			Action Stop_All_Timers;
+			//Action Stop_All_Timers;
 			Action Post_Mgmt(HANGUP_REQ(cause));
 			Next_State q931_user_disconnect_indication;
 		}
-		Stimulus Q931_EV_MGMT_DISCONNECT_REQUEST(cause) {
+		Stimulus Q931_EV_MGMT_DISCONNECT_REQ(cause) {
 			Action Send(DISCONNECT(cause));
-			Action Start_T305;
 			Next_State q931_user_disconnect_request;
 		}
 	}




More information about the svn-commits mailing list