/// <summary> /// Calling constructor. /// </summary> /// <param name="stack">Reference to SIP stack.</param> /// <param name="sender">Initial INVITE sender.</param> /// <param name="session">Call RTP multimedia session.</param> /// <exception cref="ArgumentNullException">Is raised when <b>stack</b>,<b>sender</b> or <b>session</b> is null reference.</exception> internal SIP_Call(SIP_Stack stack, SIP_RequestSender sender, RTP_MultimediaSession session) { if (stack == null) { throw new ArgumentNullException("stack"); } if (sender == null) { throw new ArgumentNullException("sender"); } if (session == null) { throw new ArgumentNullException("session"); } m_pStack = stack; m_pInitialInviteSender = sender; m_pRtpMultimediaSession = session; m_pTags = new Dictionary <string, object>(); m_pInitialInviteSender.Completed += new EventHandler(delegate(object s, EventArgs e){ m_pInitialInviteSender = null; if (this.State == SIP_CallState.Terminating) { SetState(SIP_CallState.Terminated); } }); m_CallState = SIP_CallState.Calling; }
/// <summary> /// Raises <b>StateChanged</b> event. /// </summary> /// <param name="state">New call state.</param> private void OnStateChanged(SIP_CallState state) { if (this.StateChanged != null) { this.StateChanged(this, new EventArgs()); } }
/// <summary> /// Calling constructor. /// </summary> /// <param name="stack">Reference to SIP stack.</param> /// <param name="sender">Initial INVITE sender.</param> /// <param name="session">Call RTP multimedia session.</param> /// <exception cref="ArgumentNullException">Is raised when <b>stack</b>,<b>sender</b> or <b>session</b> is null reference.</exception> internal SIP_Call(SIP_Stack stack,SIP_RequestSender sender,RTP_MultimediaSession session) { if(stack == null){ throw new ArgumentNullException("stack"); } if(sender == null){ throw new ArgumentNullException("sender"); } if(session == null){ throw new ArgumentNullException("session"); } m_pStack = stack; m_pInitialInviteSender = sender; m_pRtpMultimediaSession = session; m_pTags = new Dictionary<string,object>(); m_pInitialInviteSender.Completed += new EventHandler(delegate(object s,EventArgs e){ m_pInitialInviteSender = null; if(this.State == SIP_CallState.Terminating){ SetState(SIP_CallState.Terminated); } }); m_CallState = SIP_CallState.Calling; }
/// <summary> /// Set call state. /// </summary> /// <param name="state">New call state.</param> private void SetState(SIP_CallState state) { // Disposed call may not change state. if (this.State == SIP_CallState.Disposed) { return; } m_CallState = state; OnStateChanged(state); if (state == SIP_CallState.Terminated) { Dispose(); } }