예제 #1
0
        protected virtual void SendFinalResponse(SIPResponse finalResponse)
        {
            m_transactionFinalResponse = finalResponse;

            if (TransactionState != SIPTransactionStatesEnum.Cancelled)
            {
                UpdateTransactionState(SIPTransactionStatesEnum.Completed);
            }

            // Reset transaction state variables to reset any provisional reliable responses.
            InitialTransmit = DateTime.MinValue;
            Retransmits     = 0;
            DeliveryPending = true;
            DeliveryFailed  = false;
            HasTimedOut     = false;

            TransactionTraceMessage?.Invoke(this, $"Transaction send final response {finalResponse.ShortDescription}");

            m_sipTransport.AddTransaction(this);
        }
        public SIPNonInviteTransaction(SIPTransport sipTransport, SIPRequest sipRequest, SIPEndPoint outboundProxy)
            : base(sipTransport, sipRequest, outboundProxy)
        {
            TransactionType                         = SIPTransactionTypesEnum.NonInvite;
            TransactionRequestReceived             += SIPNonInviteTransaction_TransactionRequestReceived;
            TransactionInformationResponseReceived += SIPNonInviteTransaction_TransactionInformationResponseReceived;
            TransactionFinalResponseReceived       += SIPNonInviteTransaction_TransactionFinalResponseReceived;
            TransactionTimedOut                    += SIPNonInviteTransaction_TransactionTimedOut;
            TransactionRemoved                     += SIPNonInviteTransaction_TransactionRemoved;
            TransactionRequestRetransmit           += SIPNonInviteTransaction_TransactionRequestRetransmit;

            sipTransport.AddTransaction(this);
        }
예제 #3
0
        public UASInviteTransaction(
            SIPTransport sipTransport,
            SIPRequest sipRequest,
            SIPEndPoint outboundProxy,
            bool noCDR = false)
            : base(sipTransport, sipRequest, outboundProxy)
        {
            TransactionType = SIPTransactionTypesEnum.InviteServer;
            m_remoteTag     = sipRequest.Header.From.FromTag;

            if (sipRequest.Header.To.ToTag == null)
            {
                // This UAS needs to set the To Tag.
                m_localTag = CallProperties.CreateNewTag();
            }
            else
            {
                // This is a re-INVITE.
                m_localTag = sipRequest.Header.To.ToTag;
            }

            //logger.LogDebug("New UASTransaction (" + TransactionId + ") for " + TransactionRequest.URI.ToString() + " to " + RemoteEndPoint + ".");
            SIPEndPoint localEP =
                SIPEndPoint.TryParse(sipRequest.Header.ProxyReceivedOn) ?? sipRequest.LocalSIPEndPoint;
            SIPEndPoint remoteEP = SIPEndPoint.TryParse(sipRequest.Header.ProxyReceivedFrom) ??
                                   sipRequest.RemoteSIPEndPoint;

            if (!noCDR)
            {
                CDR = new SIPCDR(SIPCallDirection.In, sipRequest.URI, sipRequest.Header.From, sipRequest.Header.CallId,
                                 localEP, remoteEP);
            }

            TransactionRequestReceived             += UASInviteTransaction_TransactionRequestReceived;
            TransactionInformationResponseReceived += UASInviteTransaction_TransactionResponseReceived;
            TransactionFinalResponseReceived       += UASInviteTransaction_TransactionResponseReceived;
            TransactionTimedOut  += UASInviteTransaction_TransactionTimedOut;
            TransactionRemoved   += UASInviteTransaction_TransactionRemoved;
            OnAckRequestReceived += UASInviteTransaction_OnAckRequestReceived;

            sipTransport.AddTransaction(this);
        }
        internal bool m_sentPrack;                  // Records whether the PRACK request was sent.

        /// <summary>
        /// Default constructor for user agent client INVITE transaction.
        /// </summary>
        /// <param name="sendOkAckManually">If set an ACK request for the 2xx response will NOT be sent and it will be up to
        /// the application to explicitly call the SendACK request.</param>
        /// <param name="disablePrackSupport">If set to true then PRACK support will not be set in the initial INVITE request.</param>
        internal UACInviteTransaction(SIPTransport sipTransport,
                                      SIPRequest sipRequest,
                                      SIPEndPoint outboundProxy,
                                      bool sendOkAckManually   = false,
                                      bool disablePrackSupport = false)
            : base(sipTransport, sipRequest, outboundProxy)
        {
            TransactionType      = SIPTransactionTypesEnum.InviteClient;
            m_localTag           = sipRequest.Header.From.FromTag;
            CDR                  = new SIPCDR(SIPCallDirection.Out, sipRequest.URI, sipRequest.Header.From, sipRequest.Header.CallId, sipRequest.LocalSIPEndPoint, sipRequest.RemoteSIPEndPoint);
            _sendOkAckManually   = sendOkAckManually;
            _disablePrackSupport = disablePrackSupport;

            TransactionFinalResponseReceived       += UACInviteTransaction_TransactionFinalResponseReceived;
            TransactionInformationResponseReceived += UACInviteTransaction_TransactionInformationResponseReceived;
            TransactionTimedOut        += UACInviteTransaction_TransactionTimedOut;
            TransactionRequestReceived += UACInviteTransaction_TransactionRequestReceived;
            TransactionRemoved         += UACInviteTransaction_TransactionRemoved;

            sipTransport.AddTransaction(this);
        }
        public SIPNonInviteTransaction(SIPTransport sipTransport, SIPRequest sipRequest, SIPEndPoint outboundProxy)
            : base(sipTransport, sipRequest, outboundProxy)
        {
            TransactionType                         = SIPTransactionTypesEnum.NonInvite;
            TransactionRequestReceived             += SIPNonInviteTransaction_TransactionRequestReceived;
            TransactionInformationResponseReceived += SIPNonInviteTransaction_TransactionInformationResponseReceived;
            TransactionFinalResponseReceived       += SIPNonInviteTransaction_TransactionFinalResponseReceived;
            TransactionTimedOut                    += SIPNonInviteTransaction_TransactionTimedOut;
            TransactionRemoved                     += SIPNonInviteTransaction_TransactionRemoved;
            TransactionRequestRetransmit           += SIPNonInviteTransaction_TransactionRequestRetransmit;

            if (sipRequest.RemoteSIPEndPoint != null)
            {
                // This transaction type can be used to represent two different things:
                // - a tx that the application wants to use to send a request reliably,
                // - a tx for a request that has been received from a remote end point and that duplicates need
                //   to be detected for.
                // This block is for the second case. The tx request has been received and the tx engine
                // needs to be signalled that it is now at the request processing stage.
                base.UpdateTransactionState(SIPTransactionStatesEnum.Proceeding);
            }

            sipTransport.AddTransaction(this);
        }