internal static void DefaultTest()
        {
            TSK_StateMachine stateMachine = new TSK_StateMachine((Int32)__S__.Started, (Int32)__S__.Terminated, test_fsm_onterminated, null);

            /*=======================
            * === Started ===
            */
            // Started -> (Send) -> Trying
            stateMachine.AddAlwaysEntry((Int32)__S__.Started, (Int32)__A__.Subscribe, (Int32)__S__.Trying, test_fsm_exec_Started_2_Trying_X_subscribe, "test_fsm_exec_Started_2_Trying_X_subscribe")
            // Started -> (Any) -> Started
            .AddAlwaysNothingEntry((Int32)__S__.Started, "test_fsm_exec_Started_2_Started_X_any")

            /*=======================
            * === Trying ===
            */
            // Trying -> (1xx) -> Trying
            .AddAlwaysEntry((Int32)__S__.Trying, (Int32)__A__.R1xx, (Int32)__S__.Trying, test_fsm_exec_Trying_2_Trying_X_1xx, "test_fsm_exec_Trying_2_Trying_X_1xx")
            // Trying -> (2xx) -> Terminated
            .AddEntry((Int32)__S__.Trying, (Int32)__A__.R2xx, test_fsm_cond_unsubscribing, (Int32)__S__.Terminated, test_fsm_exec_Trying_2_Terminated_X_2xx, "test_fsm_exec_Trying_2_Terminated_X_2xx")
            // Trying -> (2xx) -> Connected
            .AddEntry((Int32)__S__.Trying, (Int32)__A__.R2xx, test_fsm_cond_subscribing, (Int32)__S__.Connected, test_fsm_exec_Trying_2_Connected_X_2xx, "test_fsm_exec_Trying_2_Connected_X_2xx")

            /*=======================
            * === Connected ===
            */
            // Connected -> (SUBSCRIBE) -> Trying
            .AddAlwaysEntry((Int32)__S__.Connected, (Int32)__A__.Unsubscribe, (Int32)__S__.Trying, test_fsm_exec_Connected_2_Trying_X_unsubscribe, "test_fsm_exec_Connected_2_Trying_X_unsubscribe")

            /*=======================
            * === Any ===
            */
            // Any -> (error) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)__A__.Error, (Int32)__S__.Terminated, test_fsm_exec_Any_2_Terminated_X_Error, "test_fsm_exec_Any_2_Terminated_X_Error")

            // Fake to test ANY
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)__A__.Subscribe, (Int32)__S__.Trying, test_fsm_exec_Started_2_Trying_X_subscribe, "fakefakefakefakefakefakefakefakefakefake")
            ;

            stateMachine.IsDebugEnabled = true;

            stateMachine.ExecuteAction((Int32)__A__.Subscribe, null, null, null, null, null, null);
            stateMachine.ExecuteAction((Int32)__A__.R1xx, null, null, null, null, null, null);
            stateMachine.ExecuteAction((Int32)__A__.R2xx, null, null, null, null, null, null);

            stateMachine.ExecuteAction((Int32)__A__.Unsubscribe, null, null, null, null, null, null);
            stateMachine.ExecuteAction((Int32)__A__.R2xx, null, null, null, null, null, null);

            stateMachine.ExecuteAction((Int32)__A__.R2xx, null, null, null, null, null, null);
        }
        internal TSIP_TransacIST(Boolean reliable, Int32 cseq_value, String cseq_method, String callid, TSIP_Dialog dialog)
            : base(tsip_transac_type_t.IST, reliable, cseq_value, cseq_method, callid, dialog)
        {
            /* Initialize the state machine. */
            mFSM = new TSK_StateMachine((Int32)FSMState.Started, (Int32)FSMState.Terminated, OnTerminated, this);

            /*=======================
            * === Started ===
            */
            // Started -> (recv INVITE) -> Proceeding
            mFSM.AddAlwaysEntry((Int32)FSMState.Started, (Int32)FSMAction.RecvINVITE, (Int32)FSMState.Proceeding, Started_2_Proceeding_X_INVITE, "Started_2_Proceeding_X_INVITE")
            // Started -> (Any other) -> Started
            .AddAlwaysNothingEntry((Int32)FSMState.Started, "Started_2_Started_X_any")

            /*=======================
            * === Proceeding ===
            */
            // Proceeding -> (recv INVITE) -> Proceeding
            .AddAlwaysEntry((Int32)FSMState.Proceeding, (Int32)FSMAction.RecvINVITE, (Int32)FSMState.Proceeding, Proceeding_2_Proceeding_X_INVITE, "Proceeding_2_Proceeding_X_INVITE")
            // Proceeding -> (send 1xx) -> Proceeding
            .AddEntry((Int32)FSMState.Proceeding, (Int32)FSMAction.Send1xx, IsResp2INVITE, (Int32)FSMState.Proceeding, Proceeding_2_Proceeding_X_1xx, "Proceeding_2_Proceeding_X_1xx")
            // Proceeding -> (send 300to699) -> Completed
            .AddEntry((Int32)FSMState.Proceeding, (Int32)FSMAction.Send300_to_699, IsResp2INVITE, (Int32)FSMState.Completed, Proceeding_2_Completed_X_300_to_699, "Proceeding_2_Completed_X_300_to_699")
            // Proceeding -> (send 2xx) -> Accepted
            .AddEntry((Int32)FSMState.Proceeding, (Int32)FSMAction.Send2xx, IsResp2INVITE, (Int32)FSMState.Accepted, Proceeding_2_Accepted_X_2xx, "Proceeding_2_Accepted_X_2xx")

            /*=======================
            * === Completed ===
            */
            // Completed -> (recv INVITE) -> Completed
            .AddAlwaysEntry((Int32)FSMState.Completed, (Int32)FSMAction.RecvINVITE, (Int32)FSMState.Completed, Completed_2_Completed_INVITE, "Completed_2_Completed_INVITE")
            // Completed -> (timer G) -> Completed
            .AddAlwaysEntry((Int32)FSMState.Completed, (Int32)FSMAction.TimerG, (Int32)FSMState.Completed, Completed_2_Completed_timerG, "Completed_2_Completed_timerG")
            // Completed -> (timerH) -> Terminated
            .AddAlwaysEntry((Int32)FSMState.Completed, (Int32)FSMAction.TimerH, (Int32)FSMState.Terminated, Completed_2_Terminated_timerH, "Completed_2_Terminated_timerH")
            // Completed -> (recv ACK) -> Confirmed
            .AddAlwaysEntry((Int32)FSMState.Completed, (Int32)FSMAction.RecvACK, (Int32)FSMState.Confirmed, Completed_2_Confirmed_ACK, "Completed_2_Confirmed_ACK")

            /*=======================
            * === Accepted ===
            */
            // Accepted -> (recv INVITE) -> Accepted
            .AddAlwaysEntry((Int32)FSMState.Accepted, (Int32)FSMAction.RecvINVITE, (Int32)FSMState.Accepted, Accepted_2_Accepted_INVITE, "Accepted_2_Accepted_INVITE")
            // Accepted -> (send 2xx) -> Accepted
            .AddEntry((Int32)FSMState.Accepted, (Int32)FSMAction.Send2xx, IsResp2INVITE, (Int32)FSMState.Accepted, Accepted_2_Accepted_2xx, "Accepted_2_Accepted_2xx")
            // Accepted -> (recv ACK) -> Accepted
            .AddAlwaysEntry((Int32)FSMState.Accepted, (Int32)FSMAction.RecvACK, (Int32)FSMState.Accepted, Accepted_2_Accepted_iACK, "Accepted_2_Accepted_iACK")
            // Accepted -> (timerL) -> Terminated
            .AddAlwaysEntry((Int32)FSMState.Accepted, (Int32)FSMAction.TimerL, (Int32)FSMState.Terminated, Accepted_2_Terminated_timerL, "Accepted_2_Terminated_timerL")

            /*=======================
            * === Confirmed ===
            */
            // Confirmed -> (timerI) -> Terminated
            .AddAlwaysEntry((Int32)FSMState.Confirmed, (Int32)FSMAction.TimerI, (Int32)FSMState.Terminated, Confirmed_2_Terminated_timerI, "Confirmed_2_Terminated_timerI")

            /*=======================
            * === Any ===
            */
            // Any -> (transport error) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)FSMAction.TransportError, (Int32)FSMState.Terminated, Any_2_Terminated_X_transportError, "Any_2_Terminated_X_transportError")
            // Any -> (transport error) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)FSMAction.Error, (Int32)FSMState.Terminated, Any_2_Terminated_X_Error, "Any_2_Terminated_X_Error")
            // Any -> (cancel) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)FSMAction.Cancel, (Int32)FSMState.Terminated, Any_2_Terminated_X_cancel, "Any_2_Terminated_X_cancel");
        }
        internal TSIP_TransacICT(Boolean reliable, Int32 cseq_value, String cseq_method, String callid, TSIP_Dialog dialog)
            : base(tsip_transac_type_t.ICT, reliable, cseq_value, cseq_method, callid, dialog)
        {
            /* Initialize the state machine. */
            mFSM = new TSK_StateMachine((Int32)FSMState.Started, (Int32)FSMState.Terminated, OnTerminated, this);

            /*=======================
            * === Started ===
            */
            // Started -> (Send) -> Calling
            mFSM.AddAlwaysEntry((Int32)FSMState.Started, (Int32)FSMAction.Send, (Int32)FSMState.Calling, Started_2_Calling_X_send, "Started_2_Calling_X_send")
            // Started -> (Any) -> Started
            .AddAlwaysNothingEntry((Int32)FSMState.Started, "Started_2_Started_X_any")

            /*=======================
            * === Calling ===
            */
            // Calling -> (timerA) -> Calling
            .AddAlwaysEntry((Int32)FSMState.Calling, (Int32)FSMAction.TimerA, (Int32)FSMState.Calling, Calling_2_Calling_X_timerA, "Calling_2_Calling_X_timerA")
            // Calling -> (timerB) -> Terminated
            .AddAlwaysEntry((Int32)FSMState.Calling, (Int32)FSMAction.TimerB, (Int32)FSMState.Terminated, Calling_2_Terminated_X_timerB, "Calling_2_Terminated_X_timerB")
            // Calling -> (300-699) -> Completed
            .AddAlwaysEntry((Int32)FSMState.Calling, (Int32)FSMAction._300_to_699, (Int32)FSMState.Completed, Calling_2_Completed_X_300_to_699, "Calling_2_Completed_X_300_to_699")
            // Calling  -> (1xx) -> Proceeding
            .AddAlwaysEntry((Int32)FSMState.Calling, (Int32)FSMAction._1xx, (Int32)FSMState.Proceeding, Calling_2_Proceeding_X_1xx, "Calling_2_Proceeding_X_1xx")
            // Calling  -> (2xx) -> Accepted
            .AddAlwaysEntry((Int32)FSMState.Calling, (Int32)FSMAction._2xx, (Int32)FSMState.Accepted, Calling_2_Accepted_X_2xx, "Calling_2_Accepted_X_2xx")

            /*=======================
            * === Proceeding ===
            */
            // Proceeding -> (1xx) -> Proceeding
            .AddAlwaysEntry((Int32)FSMState.Proceeding, (Int32)FSMAction._1xx, (Int32)FSMState.Proceeding, Proceeding_2_Proceeding_X_1xx, "Proceeding_2_Proceeding_X_1xx")
            // Proceeding -> (300-699) -> Completed
            .AddAlwaysEntry((Int32)FSMState.Proceeding, (Int32)FSMAction._300_to_699, (Int32)FSMState.Completed, Proceeding_2_Completed_X_300_to_699, "Proceeding_2_Completed_X_300_to_699")
            // Proceeding -> (2xx) -> Accepted
            .AddAlwaysEntry((Int32)FSMState.Proceeding, (Int32)FSMAction._2xx, (Int32)FSMState.Accepted, Proceeding_2_Accepted_X_2xx, "Proceeding_2_Accepted_X_2xx")

            /*=======================
            * === Completed ===
            */
            // Completed -> (300-699) -> Completed
            .AddAlwaysEntry((Int32)FSMState.Completed, (Int32)FSMAction._300_to_699, (Int32)FSMState.Completed, Completed_2_Completed_X_300_to_699, "Completed_2_Completed_X_300_to_699")
            // Completed -> (timerD) -> Terminated
            .AddAlwaysEntry((Int32)FSMState.Completed, (Int32)FSMAction.TimerD, (Int32)FSMState.Terminated, Completed_2_Terminated_X_timerD, "Completed_2_Terminated_X_timerD")

            /*=======================
            * === Accepted ===
            */
            // Accepted -> (2xx) -> Accepted
            .AddAlwaysEntry((Int32)FSMState.Accepted, (Int32)FSMAction._2xx, (Int32)FSMState.Accepted, Accepted_2_Accepted_X_2xx, "Accepted_2_Accepted_X_2xx")
            // Accepted -> (timerM) -> Terminated
            .AddAlwaysEntry((Int32)FSMState.Accepted, (Int32)FSMAction.TimerM, (Int32)FSMState.Terminated, Accepted_2_Terminated_X_timerM, "Accepted_2_Terminated_X_timerM")

            /*=======================
            * === Any ===
            */
            // Any -> (transport error) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)FSMAction.TransportError, (Int32)FSMState.Terminated, Any_2_Terminated_X_transportError, "Any_2_Terminated_X_transportError")
            // Any -> (transport error) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)FSMAction.Error, (Int32)FSMState.Terminated, Any_2_Terminated_X_Error, "Any_2_Terminated_X_Error")
            // Any -> (cancel) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)FSMAction.Cancel, (Int32)FSMState.Terminated, Any_2_Terminated_X_cancel, "Any_2_Terminated_X_cancel");
        }
        internal TSIP_TransacNIST(Boolean reliable, Int32 cseq_value, String cseq_method, String callid, TSIP_Dialog dialog)
            : base(tsip_transac_type_t.NIST, reliable, cseq_value, cseq_method, callid, dialog)
        {
            /* Initialize the state machine. */
            mFSM = new TSK_StateMachine((Int32)FSMState.Started, (Int32)FSMState.Terminated, OnTerminated, this);

            /*=======================
            * === Started ===
            */
            // Started -> (receive request) -> Trying
            mFSM.AddAlwaysEntry((Int32)FSMState.Started, (Int32)FSMAction.Request, (Int32)FSMState.Trying, Started_2_Trying_X_request, "Started_2_Trying_X_request")
            // Started -> (Any other) -> Started
            .AddAlwaysNothingEntry((Int32)FSMState.Started, "Started_2_Started_X_any")

            /*=======================
            * === Trying ===
            */
            // Trying -> (send 1xx) -> Proceeding
            .AddAlwaysEntry((Int32)FSMState.Trying, (Int32)FSMAction.Send_1xx, (Int32)FSMState.Proceeding, Trying_2_Proceeding_X_send_1xx, "Trying_2_Proceeding_X_send_1xx")
            // Trying -> (send 200 to 699) -> Completed
            .AddAlwaysEntry((Int32)FSMState.Trying, (Int32)FSMAction.Send_200_to_699, (Int32)FSMState.Completed, Trying_2_Completed_X_send_200_to_699, "Trying_2_Completed_X_send_200_to_699")

            /*=======================
            * === Proceeding ===
            */
            // Proceeding -> (send 1xx) -> Proceeding
            .AddAlwaysEntry((Int32)FSMState.Proceeding, (Int32)FSMAction.Send_1xx, (Int32)FSMState.Proceeding, Proceeding_2_Proceeding_X_send_1xx, "Proceeding_2_Proceeding_X_send_1xx")
            // Proceeding -> (send 200 to 699) -> Completed
            .AddAlwaysEntry((Int32)FSMState.Proceeding, (Int32)FSMAction.Send_200_to_699, (Int32)FSMState.Completed, Proceeding_2_Completed_X_send_200_to_699, "Proceeding_2_Completed_X_send_200_to_699")
            // Proceeding -> (receive request) -> Proceeding
            .AddAlwaysEntry((Int32)FSMState.Proceeding, (Int32)FSMAction.Request, (Int32)FSMState.Proceeding, Proceeding_2_Proceeding_X_request, "Proceeding_2_Proceeding_X_request")

            /*=======================
            * === Completed ===
            */
            // Completed -> (receive request) -> Completed
            .AddAlwaysEntry((Int32)FSMState.Completed, (Int32)FSMAction.Request, (Int32)FSMState.Completed, Completed_2_Completed_X_request, "Completed_2_Completed_X_request")
            // Completed -> (timer J) -> Terminated
            .AddAlwaysEntry((Int32)FSMState.Completed, (Int32)FSMAction.TimerJ, (Int32)FSMState.Terminated, Completed_2_Terminated_X_tirmerJ, "Completed_2_Terminated_X_tirmerJ")

            /*=======================
            * === Any ===
            */
            // Any -> (transport error) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)FSMAction.TransportError, (Int32)FSMState.Terminated, Any_2_Terminated_X_transportError, "Any_2_Terminated_X_transportError")
            // Any -> (transport error) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)FSMAction.Error, (Int32)FSMState.Terminated, Any_2_Terminated_X_Error, "Any_2_Terminated_X_Error")
            // Any -> (cancel) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)FSMAction.Cancel, (Int32)FSMState.Terminated, Any_2_Terminated_X_cancel, "Any_2_Terminated_X_cancel");
        }
        internal TSIP_TransacNICT(Boolean reliable, Int32 cseq_value, String cseq_method, String callid, TSIP_Dialog dialog)
            : base(tsip_transac_type_t.NICT, reliable, cseq_value, cseq_method, callid, dialog)
        {
            /* Initialize the state machine. */
            mFSM = new TSK_StateMachine((Int32)FSMState.Started, (Int32)FSMState.Terminated, OnTerminated, this);
            mFSM.IsDebugEnabled = true;
            /*=======================
            * === Started ===
            */
                // Started -> (Send) -> Trying
            mFSM.AddAlwaysEntry((Int32)FSMState.Started, (Int32)FSMAction.Send, (Int32)FSMState.Trying, Started_2_Trying_X_send, "NICT_Started_2_Trying_X_send")
                // Started -> (Any) -> Started
            .AddAlwaysNothingEntry((Int32)FSMState.Started, "Started_2_Started_any")

            /*=======================
            * === Trying ===
            */
                // Trying -> (timerE) -> Trying
            .AddAlwaysEntry((Int32)FSMState.Trying, (Int32)FSMAction.TimerE, (Int32)FSMState.Trying, Trying_2_Trying_X_timerE, "NICT_Trying_2_Trying_X_timerE")
                // Trying -> (timerF) -> Terminated
            .AddAlwaysEntry((Int32)FSMState.Trying, (Int32)FSMAction.TimerF, (Int32)FSMState.Terminated, Trying_2_Terminated_X_timerF, "NICT_Trying_2_Terminated_X_timerF")
                // Trying -> (transport error) -> Terminated
            .AddAlwaysEntry((Int32)FSMState.Trying, (Int32)FSMAction.TransportError, (Int32)FSMState.Terminated, Trying_2_Terminated_X_transportError, "NICT_Trying_2_Terminated_X_transportError")
                // Trying  -> (1xx) -> Proceeding
            .AddAlwaysEntry((Int32)FSMState.Trying, (Int32)FSMAction._1xx, (Int32)FSMState.Proceeding, Trying_2_Proceedding_X_1xx, "NICT_Trying_2_Proceedding_X_1xx")
                // Trying  -> (200 to 699) -> Completed
            .AddAlwaysEntry((Int32)FSMState.Trying, (Int32)FSMAction._200_to_699, (Int32)FSMState.Completed, Trying_2_Completed_X_200_to_699, "NICT_Trying_2_Completed_X_200_to_699")

            /*=======================
            * === Proceeding ===
            */
                // Proceeding -> (timerE) -> Proceeding
            .AddAlwaysEntry((Int32)FSMState.Proceeding, (Int32)FSMAction.TimerE, (Int32)FSMState.Proceeding, Proceeding_2_Proceeding_X_timerE, "NICT_Proceeding_2_Proceeding_X_timerE")
                // Proceeding -> (timerF) -> Terminated
            .AddAlwaysEntry((Int32)FSMState.Proceeding, (Int32)FSMAction.TimerF, (Int32)FSMState.Terminated, Proceeding_2_Terminated_X_timerF, "NICT_Proceeding_2_Terminated_X_timerF")
                // Proceeding -> (transport error) -> Terminated
            .AddAlwaysEntry((Int32)FSMState.Proceeding, (Int32)FSMAction.TransportError, (Int32)FSMState.Terminated, Proceeding_2_Terminated_X_transportError, "NICT_Proceeding_2_Terminated_X_transportError")
                // Proceeding -> (1xx) -> Proceeding
            .AddAlwaysEntry((Int32)FSMState.Proceeding, (Int32)FSMAction._1xx, (Int32)FSMState.Proceeding, Proceeding_2_Proceeding_X_1xx, "NICT_Proceeding_2_Proceeding_X_1xx")
                // Proceeding -> (200 to 699) -> Completed
            .AddAlwaysEntry((Int32)FSMState.Proceeding, (Int32)FSMAction._200_to_699, (Int32)FSMState.Completed, Proceeding_2_Completed_X_200_to_699, "NICT_Proceeding_2_Completed_X_200_to_699")

            /*=======================
            * === Completed ===
            */
                // Completed -> (timer K) -> Terminated
            .AddAlwaysEntry((Int32)FSMState.Completed, (Int32)FSMAction.TimerK, (Int32)FSMState.Terminated, Completed_2_Terminated_X_timerK, "NICT_Completed_2_Terminated_X_timerK")

            /*=======================
            * === Any ===
            */
                // Any -> (transport error) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)FSMAction.TransportError, (Int32)FSMState.Terminated, Any_2_Terminated_X_transportError, "NICT_Any_2_Terminated_X_transportError")
                // Any -> (error) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)FSMAction.Error, (Int32)FSMState.Terminated, Any_2_Terminated_X_Error, "NICT_Any_2_Terminated_X_Error")
                // Any -> (cancel) -> Terminated
            .AddAlwaysEntry(TSK_StateMachine.STATE_ANY, (Int32)FSMAction.Cancel, (Int32)FSMState.Terminated, Any_2_Terminated_X_cancel, "NICT_Any_2_Terminated_X_cancel");

            base.Callback = this.OnCallbackEvent;
        }