BogheApp.SessionWindow.ReceiveCall C# (CSharp) Method

ReceiveCall() public method

public ReceiveCall ( BogheCore.Sip.MyInviteSession session ) : void
session BogheCore.Sip.MyInviteSession
return void
        public void ReceiveCall(MyInviteSession session)
        {
            bool isAV = (session is MyAVSession);

            if(isAV)
            {
                System.Diagnostics.Debug.Assert(this.AVSession == null);

                this.AVSession = session as MyAVSession;
                this.avHistoryEvent = new HistoryAVCallEvent(((session.MediaType & MediaType.Video) == MediaType.Video), session.RemotePartyUri);
                this.avHistoryEvent.SipSessionId = session.Id;
                this.avHistoryEvent.Status = HistoryEvent.StatusType.Missed;

            }
            else if (session is MyMsrpSession)
            {
                MyMsrpSession msrpSession = session as MyMsrpSession;
                msrpSession.SuccessReport = this.MsrpSuccessReport;
                msrpSession.FailureReport = this.MsrpFailureReport;
                msrpSession.OmaFinalDeliveryReport = this.MsrpOmaFinalDeliveryReport;

                if (session.MediaType == MediaType.Chat)
                {
                    System.Diagnostics.Debug.Assert(this.ChatSession == null);

                     this.ChatSession = msrpSession;
                }
                else if (session.MediaType == MediaType.FileTransfer)
                {
                    HistoryFileTransferEvent @event = new HistoryFileTransferEvent(this.remotePartyUri, msrpSession.FilePath);
                    @event.Status = HistoryEvent.StatusType.Incoming;
                    @event.SipSessionId = session.Id;
                    @event.MsrpSession = msrpSession;
                    this.AddMessagingEvent(@event);
                }
                else
                {
                    throw new Exception("Unsupported session Type");
                }
            }
            else
            {
                throw new Exception("Unsupported session Type");
            }

            this.InitializeView();
            this.Show();

            if (isAV)
            {
                if ((session.MediaType & MediaType.Video) == MediaType.Video || (session.MediaType & MediaType.Videobfcp) == MediaType.Videobfcp)
                {
                    this.AttachDisplays();
                }
                this.soundService.PlayRingTone();
            }
            else if (session.MediaType == MediaType.Chat && this.ChatSession != null)
            {
                this.ChatSession.Accept();
            }
        }