internal TSIP_Dialog CreateDialog(TSIP_Dialog.tsip_dialog_type_t type, TSip_Session sipSession)
        {
            TSIP_Dialog dialog = null;

            switch (type)
            {
                case TSIP_Dialog.tsip_dialog_type_t.REGISTER:
                    {
                        dialog = new TSIP_DialogRegister(sipSession as TSIP_SessionRegister);
                        break;
                    }

                default:
                    {
                        TSK_Debug.Error("{0} not support as dialog type", type);
                        break;
                    }
            }

            if (dialog != null && !mDialogs.ContainsKey(dialog.Id))
            {
                mMutex.WaitOne();
                mDialogs.Add(dialog.Id, dialog);
                mMutex.ReleaseMutex();
            }

            return dialog;
        }
        /// <summary>
        /// cancel all transactions related to this dialog
        /// </summary>
        /// <param name="dialogId"></param>
        /// <returns></returns>
        internal Boolean CancelTransactionByDialogId(Int64 dialogId)
        {
            TSIP_Dialog dialog = mSipStack.LayerDialog.FindDialogById(dialogId);

            if (dialog == null)
            {
                return(false);
            }

            mMutex.WaitOne();
again:
            foreach (TSIP_Transac transac in mTransactions.Values)
            {
                if (TSIP_Dialog.Compare(dialog, transac.Dialog) == 0)
                {
                    if (!(transac.ExecuteAction((Int32)TSIP_Action.tsip_action_type_t.tsip_atype_cancel, null)))
                    {
                        /* break */
                    }
                    else
                    {
                        /* we cannot continue because an item has been removed from the list while we are looping through  */
                        goto again;
                    }
                }
            }

            mMutex.ReleaseMutex();

            return(true);
        }
Example #3
0
 protected TSIP_Transac(tsip_transac_type_t type, Boolean reliable, Int32 cseq_value, String cseq_method, String callid, TSIP_Dialog dialog)
 {
     mId         = sUniqueId++;
     mType       = type;
     mReliable   = reliable;
     mCSeqValue  = cseq_value;
     mCSeqMethod = cseq_method;
     mCallId     = callid;
     mDialog     = dialog;
 }
        internal TSIP_Transac CreateTransac(Boolean isClient, TSIP_Message message, TSIP_Dialog dialog)
        {
            TSIP_Transac transac = null;

            if (message != null && message.IsRequest)
            {
                if (isClient)/* Client transaction */
                {
                    if (message.IsINVITE)
                    {
                        // INVITE Client transaction (ICT)
                        TSK_Debug.Error("CreateTransac - not implemented");
                    }
                    else
                    {
                        // NON-INVITE Client transaction (NICT)
                        transac = new TSIP_TransacNICT(mReliable, (Int32)message.CSeq.CSeq, message.CSeq.Method, message.CallId.Value, dialog);
                    }
                }
                else/* Server transaction */
                {
                    if (message.IsINVITE)
                    {
                        // INVITE Server transaction (IST)
                        TSK_Debug.Error("CreateTransac - not implemented");
                    }
                    else
                    {
                        // NON-INVITE Server transaction (NIST)
                        TSK_Debug.Error("CreateTransac - not implemented");
                    }

                    if (transac != null)
                    {
                        /* Copy branch from the message */
                        transac.Branch = message.FirstVia.Branch;
                    }
                }
            }


            mMutex.WaitOne();

            if (transac != null)
            {
                /* Add new transaction */
                mTransactions.Add(transac.Id, transac);
            }

            mMutex.ReleaseMutex();

            return(transac);
        }
        internal TSIP_Transac CreateTransac(Boolean isClient, TSIP_Message message, TSIP_Dialog dialog)
        {
            TSIP_Transac transac = null;

            if (message != null && message.IsRequest)
            {
                if (isClient)/* Client transaction */
                {
                    if (message.IsINVITE)
                    {
                        // INVITE Client transaction (ICT)
                        TSK_Debug.Error("CreateTransac - not implemented");
                    }
                    else
                    {
                        // NON-INVITE Client transaction (NICT)
                        transac = new TSIP_TransacNICT(mReliable, (Int32)message.CSeq.CSeq, message.CSeq.Method, message.CallId.Value, dialog);
                    }
                }
                else/* Server transaction */
                {
                    if (message.IsINVITE)
                    {
                        // INVITE Server transaction (IST)
                        TSK_Debug.Error("CreateTransac - not implemented");
                    }
                    else
                    {
                        // NON-INVITE Server transaction (NIST)
                        TSK_Debug.Error("CreateTransac - not implemented");
                    }

                    if (transac != null)
                    {
                        /* Copy branch from the message */
                        transac.Branch = message.FirstVia.Branch;
                    }
                }
            }

            mMutex.WaitOne();

            if (transac != null)
            {
                /* Add new transaction */
                mTransactions.Add(transac.Id, transac);
            }

            mMutex.ReleaseMutex();

            return transac;
        }
        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_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");
        }
Example #9
0
        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;
        }
        private void AddDialog(TSIP_Dialog dialog)
        {
            if (dialog != null)
            {
                mMutex.WaitOne();

                mDialogs.Add(dialog.Id, dialog);

                mMutex.ReleaseMutex();
            }
        }
        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_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;
        }
        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");
        }