コード例 #1
0
 /// <summary>
 /// Constructs B2BUA event arguments.
 /// </summary>
 /// <param name="core">The <see cref="SipCore" /> that raised the event.</param>
 /// <param name="b2bUserAgent">The <see cref="SipB2BUserAgent{TState}" /> that raised the event.</param>
 /// <param name="session">The <see cref="SipB2BUASession{TState}" /> associated with the event.</param>
 internal SipB2BUAEventArgs(SipCore core,
                            SipB2BUserAgent <TState> b2bUserAgent,
                            SipB2BUASession <TState> session)
 {
     this.Core         = core;
     this.B2BUserAgent = b2bUserAgent;
     this.Session      = session;
 }
コード例 #2
0
        /// <summary>
        /// Constructs B2BUA event arguments for a received <see cref="SipResponse" />.
        /// </summary>
        /// <param name="core">The <see cref="SipCore" /> that raised the event.</param>
        /// <param name="b2bUserAgent">The <see cref="SipB2BUserAgent{TState}" /> that raised the event.</param>
        /// <param name="session">The <see cref="SipB2BUASession{TState}" /> associated with the event.</param>
        /// <param name="receivedResponse">The received <see cref="SipResponse" />.</param>
        /// <param name="response">The proposed <see cref="SipResponse" /> to be forwarded.</param>
        internal SipB2BUAEventArgs(SipCore core,
                                   SipB2BUserAgent <TState> b2bUserAgent,
                                   SipB2BUASession <TState> session,
                                   SipResponse receivedResponse,
                                   SipResponse response)
        {
            Assertion.Test(receivedResponse != null);
            Assertion.Test(response != null);

            this.Core             = core;
            this.B2BUserAgent     = b2bUserAgent;
            this.Session          = session;
            this.ReceivedResponse = receivedResponse;
            this.Response         = response;
        }
コード例 #3
0
        /// <summary>
        /// Initializes a <see cref="SipDialog" /> instance.
        /// </summary>
        /// <param name="core">The <see cref="SipCore" /> that owns this dialog.</param>
        /// <param name="inviteRequest">The INVITE <see cref="SipRequest" /> received by the accepting dialog or being sent by the initiating dialog.</param>
        /// <param name="localContact">The <see cref="SipContactValue" /> for the local side of the dialog.</param>
        /// <param name="acceptingTransaction">
        /// The initial transaction for INVITE requests received by accepting dialogs or <c>null</c> for
        /// initiating dialogs.
        /// </param>
        /// <param name="state">Derived class specific state (or <c>null</c>).</param>
        /// <remarks>
        /// <para>
        /// Derived classes can override this method to intialize any internal state using information
        /// from the derived class specific <paramref name="state" /> parameter.
        /// </para>
        /// <para>
        /// For accepting dialog requests, this method expects the <paramref name="inviteRequest" /> to already
        /// have reasonable <b>Call-ID</b>, <b>To</b>, <b>From</b>, and <b>CSeq</b> headers and the
        /// <b>From</b> header must have a <b>tag</b> parameter.
        /// </para>
        /// <para>
        /// For initiating dialog requests,this method expects the <paramref name="inviteRequest" /> to already
        /// have reasonable <b>To</b>, <b>From</b> and headers but the method will generate and assign
        /// the <b>From</b> header's <b>tag</b> parameter.  The method will set a <b>Call-ID</b> header
        /// if necessary and will always set a new <b>CSeq</b> header.
        /// </para>
        /// <para>
        /// <paramref name="acceptingTransaction"/> must be passed as the server transaction the INVITE
        /// was received on for accepting dialogs.  This will be passed as <c>null</c> for initiating
        /// dialogs (note that the <see cref="SipClientAgent" /> will eventually set the <see cref="SipDialog.InitiatingTransaction" />
        /// property to the initial <see cref="SipClientTransaction" /> just before the transaction
        /// is started).
        /// </para>
        /// <note>
        /// The derived class MUST call the base <see cref="Initialize" /> method passing the parameters
        /// before returning.
        /// </note>
        /// </remarks>
        public override void Initialize(SipCore core, SipRequest inviteRequest, SipContactValue localContact, SipServerTransaction acceptingTransaction, object state)
        {
            base.Initialize(core, inviteRequest, localContact, acceptingTransaction, state);

            // $hack(jeff.lill):
            //
            // This is a bit of a hack that initializes the downstream dialog to the
            // server's Session property and also initializes the session's ServerDialog
            // property.  I'm relying on the fact that state is passed as non-null
            // only when the B2BUA creates the downstream dialog.

            SipB2BUASession <TState> session = state as SipB2BUASession <TState>;

            if (session != null)
            {
                this.session         = session;
                session.ServerDialog = this;
            }
        }