Пример #1
0
        /// <summary>
        /// Sends or resends a transaction final response.
        /// </summary>
        /// <param name="transaction">The transaction to send the final response for.</param>
        /// <returns>The result of the send attempt.</returns>
        private Task <SocketError> SendTransactionFinalResponse(SIPTransaction transaction)
        {
            transaction.Retransmits  = transaction.Retransmits + 1;
            transaction.LastTransmit = DateTime.Now;

            if (transaction.InitialTransmit == DateTime.MinValue)
            {
                transaction.InitialTransmit = transaction.LastTransmit;
            }

            if (transaction.Retransmits > 1 && !DisableRetransmitSending)
            {
                transaction.OnRetransmitFinalResponse();
                SIPResponseRetransmitTraceEvent?.Invoke(transaction, transaction.TransactionFinalResponse, transaction.Retransmits);
            }

            if (transaction.Retransmits > 1 && DisableRetransmitSending)
            {
                return(Task.FromResult(SocketError.Success));
            }
            else
            {
                return(m_sipTransport.SendResponseAsync(transaction.TransactionFinalResponse));
            }
        }
Пример #2
0
        /// <summary>
        /// Sends or resends a transaction final response.
        /// </summary>
        /// <param name="transaction">The transaction to send the final response for.</param>
        /// <returns>The result of the send attempt.</returns>
        private Task <SocketError> SendTransactionFinalResponse(SIPTransaction transaction)
        {
            transaction.Retransmits  = transaction.Retransmits + 1;
            transaction.LastTransmit = DateTime.Now;

            if (transaction.InitialTransmit == DateTime.MinValue)
            {
                transaction.InitialTransmit = transaction.LastTransmit;
            }

            if (transaction.Retransmits > 1 && !DisableRetransmitSending)
            {
                transaction.OnRetransmitFinalResponse();
                SIPResponseRetransmitTraceEvent?.Invoke(transaction, transaction.TransactionFinalResponse, transaction.Retransmits);
            }

            if (transaction.Retransmits > 1 && DisableRetransmitSending)
            {
                return(Task.FromResult(SocketError.Success));
            }
            else
            {
                // If retransmits are disabled we must wait for DNS when sending. By default the DNS lookup mechanism
                // will silently do nothing if the lookup result is not in the cache and relies on the result
                // being ready for a subsequent SIP retransmit. This mechanism won't work if SIP retransmits are disabled.
                bool waitForDns = DisableRetransmitSending;

                return(m_sipTransport.SendResponseAsync(transaction.TransactionFinalResponse, waitForDns));
            }
        }
        /// <summary>
        /// Sends or resends a transaction final response.
        /// </summary>
        /// <param name="transaction">The transaction to send the final response for.</param>
        /// <returns>The result of the send attempt.</returns>
        private Task <SocketError> SendTransactionFinalResponse(SIPTransaction transaction)
        {
            transaction.Retransmits  = transaction.Retransmits + 1;
            transaction.LastTransmit = DateTime.Now;

            if (transaction.InitialTransmit == DateTime.MinValue)
            {
                transaction.InitialTransmit = transaction.LastTransmit;
            }

            if (transaction.Retransmits > 1)
            {
                transaction.OnRetransmitFinalResponse();
                SIPResponseRetransmitTraceEvent?.Invoke(transaction, transaction.TransactionFinalResponse, transaction.Retransmits);
            }
            return(m_sipTransport.SendResponseAsync(transaction.TransactionFinalResponse));
        }
        /// <summary>
        /// Sends or resends a Invite Server transaction provisional response. Only
        /// relevant reliable provisional responses as per RFC3262 are supported.
        /// </summary>
        /// <param name="transaction">The transaction to send the provisional response for.</param>
        /// <returns>The result of the send attempt.</returns>
        private Task <SocketError> SendTransactionProvisionalResponse(SIPTransaction transaction)
        {
            transaction.Retransmits  = transaction.Retransmits + 1;
            transaction.LastTransmit = DateTime.Now;

            if (transaction.InitialTransmit == DateTime.MinValue)
            {
                transaction.InitialTransmit = transaction.LastTransmit;
            }

            // Provisional response reliable for INVITE-UAS.
            if (transaction.Retransmits > 1)
            {
                transaction.OnRetransmitProvisionalResponse();
                SIPResponseRetransmitTraceEvent?.Invoke(transaction, transaction.ReliableProvisionalResponse, transaction.Retransmits);
            }

            return(m_sipTransport.SendResponseAsync(transaction.ReliableProvisionalResponse));
        }