예제 #1
0
        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))
                {
                    this.AttachDisplays();
                }
            }
            else if (session.MediaType == MediaType.Chat && this.ChatSession != null)
            {
                this.ChatSession.Accept();
            }
        }
        private void SendFile(String filePath)
        {
            MyMsrpSession msrpSession = this.CreateOutgoingSession(MediaType.FileTransfer);

            lock (this.fileTransferSessions)
            {
                this.fileTransferSessions.Add(msrpSession);
            }
            msrpSession.mOnMsrpEvent += this.FileTransfer_onMsrpEvent;

            HistoryFileTransferEvent @event = new HistoryFileTransferEvent(this.remotePartyUri, filePath);

            @event.Status       = HistoryEvent.StatusType.Outgoing;
            @event.MsrpSession  = msrpSession;
            @event.SipSessionId = msrpSession.Id;
            this.AddMessagingEvent(@event);

            msrpSession.SendFile(filePath);
        }
예제 #3
0
        private void SendFile(String filePath)
        {
            MyMsrpSession msrpSession = this.CreateOutgoingSession(MediaType.FileTransfer);
            lock (this.fileTransferSessions)
            {
                this.fileTransferSessions.Add(msrpSession);
            }
            msrpSession.mOnMsrpEvent += this.FileTransfer_onMsrpEvent;

            HistoryFileTransferEvent @event = new HistoryFileTransferEvent(this.remotePartyUri, filePath);
            @event.Status = HistoryEvent.StatusType.Outgoing;
            @event.MsrpSession = msrpSession;
            @event.SipSessionId = msrpSession.Id;
            this.AddMessagingEvent(@event);

            msrpSession.SendFile(filePath);
        }
예제 #4
0
        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();
            }
        }