SIPSorcery.SIP.SIPTransaction.SIPTransaction C# (CSharp) Method

SIPTransaction() protected method

Creates a new SIP transaction and adds it to the list of in progress transactions.
protected SIPTransaction ( SIPTransport sipTransport, SIPRequest transactionRequest, SIPEndPoint dstEndPoint, SIPEndPoint localSIPEndPoint, SIPEndPoint outboundProxy ) : NUnit.Framework
sipTransport SIPTransport The SIP Transport layer that is to be used with the transaction.
transactionRequest SIPRequest The SIP Request on which the transaction is based.
dstEndPoint SIPEndPoint The socket the at the remote end of the transaction and which transaction messages will be sent to.
localSIPEndPoint SIPEndPoint The socket that should be used as the send from socket for communications on this transaction. Typically this will /// be the socket the initial request was received on.
outboundProxy SIPEndPoint
return NUnit.Framework
        protected SIPTransaction(
            SIPTransport sipTransport,
            SIPRequest transactionRequest,
            SIPEndPoint dstEndPoint,
            SIPEndPoint localSIPEndPoint,
            SIPEndPoint outboundProxy)
        {
            try
            {
                if (sipTransport == null)
                {
                    throw new ArgumentNullException("A SIPTransport object is required when creating a SIPTransaction.");
                }
                else if (transactionRequest == null)
                {
                    throw new ArgumentNullException("A SIPRequest object must be supplied when creating a SIPTransaction.");
                }
                /*else if (dstEndPoint == null && outboundProxy == null)
                {
                    throw new ArgumentNullException("The remote SIP end point or outbound proxy must be set when creating a SIPTransaction.");
                }*/
                else if (localSIPEndPoint == null)
                {
                    throw new ArgumentNullException("The local SIP end point must be set when creating a SIPTransaction.");
                }
                else if (transactionRequest.Header.Vias.TopViaHeader == null)
                {
                    throw new ArgumentNullException("The SIP request must have a Via header when creating a SIPTransaction.");
                }

                TransactionsCreated++;

                m_sipTransport = sipTransport;
                m_transactionId = GetRequestTransactionId(transactionRequest.Header.Vias.TopViaHeader.Branch, transactionRequest.Header.CSeqMethod);
                HasTimedOut = false;

                m_transactionRequest = transactionRequest;
                m_branchId = transactionRequest.Header.Vias.TopViaHeader.Branch;
                m_callId = transactionRequest.Header.CallId;
                m_sentBy = transactionRequest.Header.Vias.TopViaHeader.ContactAddress;
                RemoteEndPoint = dstEndPoint;
                LocalSIPEndPoint = localSIPEndPoint;
                OutboundProxy = outboundProxy;
            }
            catch (Exception excp)
            {
                logger.Error("Exception SIPTransaction (ctor). " + excp.Message);
                throw excp;
            }
        }