예제 #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();
            }
        }
예제 #2
0
        internal static void ReceiveCall(MyInviteSession session)
        {
            SessionWindow window = null;

            lock (SessionWindow.Windows)
            {
                window = SessionWindow.Windows.FirstOrDefault(w => w.CanReceiveCall(session));
            }
            if (window == null)
            {
                window = new SessionWindow(session.RemotePartyUri);
            }
            window.ReceiveCall(session);
        }
예제 #3
0
 public bool CanReceiveCall(MyInviteSession session)
 {
     if (String.Equals(this.remotePartyUri, session.RemotePartyUri))
     {
         if (session is MyMsrpSession)
         {
             if (session.MediaType == MediaType.Chat)
             {
                 return(this.ChatSession == null);
             }
             else
             {
                 // Can always receive file transfer session as long as it's from the same remote uri
                 return(true);
             }
         }
         else if (session is MyAVSession)
         {
             return(this.AVSession == null);
         }
     }
     return(false);
 }