Exemplo n.º 1
0
        private void ItemShortMessage_ValueLoaded(object sender, EventArgs e)
        {
            HistoryShortMessageEvent messageEventValue = this.Value;

            if (messageEventValue == null)
            {
                return;
            }

            switch (messageEventValue.Status)
            {
            case HistoryEvent.StatusType.Incoming:
                this.labelDescription.Content = String.Format("{0} says", UriUtils.GetDisplayName(messageEventValue.RemoteParty));
                this.gradientStop.Color       = Colors.Bisque;
                break;

            case HistoryEvent.StatusType.Outgoing:
                this.labelDescription.Content = "I say";
                this.gradientStop.Color       = Colors.SkyBlue;
                break;

            case HistoryEvent.StatusType.Failed:
            default:
                this.gradientStop.Color = Colors.Red;
                break;
            }

            this.labelDate.Content = BaseItem <HistoryShortMessageEvent> .GetFriendlyDateString(messageEventValue.Date);

            this.labelContent.Content = messageEventValue.Content;
        }
 private void InitializeView()
 {
     if (this.AVSession != null)
     {
         lock (this.AVSession)
         {
             this.Title = String.Format("{0} {1}", Strings.Text_TalkingWith, this.AVSession.RemotePartyDisplayName);
             this.UpdateControls();
         }
     }
     else
     {
         this.Title = String.Format("{0} {1}", Strings.Text_TalkingWith, UriUtils.GetDisplayName(this.remotePartyUri));
     }
 }
Exemplo n.º 3
0
        private void ItemWatcher_ValueLoaded(object sender, EventArgs e)
        {
            this.@event = this.Value;

            this.labelUriString.Content = String.Format(CultureInfo.CurrentUICulture, "{0} ({1})", UriUtils.GetDisplayName([email protected]), [email protected]);
            this.labelPackage.Content   = String.Format(CultureInfo.CurrentUICulture, "Package ({0})", [email protected]);
            this.labelStatus.Content    = String.Format(CultureInfo.CurrentUICulture, "{0} ({1})", ItemWatcher.GetAsString([email protected]), ItemWatcher.GetAsString([email protected]));

            switch ([email protected])
            {
            case watcherStatus.active:
                this.imageStatus.Source      = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_green_16);
                this.ctxMenu_Allow.IsEnabled = false;
                break;

            case watcherStatus.pending:
                this.imageStatus.Source = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_yellow_16);
                break;

            case watcherStatus.waiting:
                this.imageStatus.Source = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_grey_16);
                break;

            case watcherStatus.terminated:
                this.imageStatus.Source       = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_red_16);
                this.ctxMenu_Allow.IsEnabled  = false;
                this.ctxMenu_Block.IsEnabled  = false;
                this.ctxMenu_Revoke.IsEnabled = false;
                break;
            }
        }
 internal Participant(String sipUri, confStatus status)
 {
     this.sipUri      = sipUri;
     this.status      = status;
     this.displayName = UriUtils.GetDisplayName(this.sipUri);
 }
Exemplo n.º 5
0
        private void sipService_onInviteEvent(object sender, InviteEventArgs e)
        {
            if (this.AVSession == null || (this.AVSession.Id != e.SessionId && e.Type != InviteEventTypes.REMOTE_TRANSFER_INPROGESS))
            {
                /* Messaging */
                if (e.Type == InviteEventTypes.DISCONNECTED)
                {
                    if (this.historyDataSource.Any(x => x.SipSessionId == e.SessionId))
                    {
                        this.Dispatcher.Invoke((System.Threading.ThreadStart) delegate
                        {
                            HistoryEvent @event = this.historyDataSource.FirstOrDefault(x => x.SipSessionId == e.SessionId);
                            if (@event != null)
                            {
                                this.historyService.AddEvent(@event);
                            }
                        }, null);
                    }
                    else if (this.ChatSession != null && this.ChatSession.Id == e.SessionId)
                    {
                        this.Dispatcher.Invoke((System.Threading.ThreadStart) delegate
                        {
                            this.ChatSession = null;
                        });
                    }
                }
                return;
            }

            /* Audio/Video */

            if (this.Dispatcher.Thread != Thread.CurrentThread)
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new EventHandler <InviteEventArgs>(this.sipService_onInviteEvent), sender, new object[] { e });
                return;
            }

            this.UpdateControls();

            switch (e.Type)
            {
            case InviteEventTypes.INCOMING:
            {
                this.labelInfo.Content     = String.Format("{0} {1}", Strings.Text_IncomingCall, this.AVSession.RemotePartyDisplayName);
                this.avHistoryEvent        = new HistoryAVCallEvent(this.AVSession.MediaType != BogheCore.MediaType.Audio, this.AVSession.RemotePartyUri);
                this.avHistoryEvent.Status = HistoryEvent.StatusType.Missed;
                break;
            }

            case InviteEventTypes.INPROGRESS:
            {
                // History Event
                this.labelInfo.Content = String.Format("{0}...", Strings.Text_CallInProgress);
                bool isVideo = ((this.AVSession.MediaType & MediaType.Video) == MediaType.Video || (this.AVSession.MediaType & MediaType.Videobfcp) == MediaType.Videobfcp);
                this.avHistoryEvent        = new HistoryAVCallEvent(isVideo, this.AVSession.RemotePartyUri);
                this.avHistoryEvent.Status = HistoryEvent.StatusType.Outgoing;
                if (isVideo)
                {
                    // Video Displays
                    this.AttachDisplays();
                }

                break;
            }

            case InviteEventTypes.RINGING:
            {
                this.labelInfo.Content = Strings.Text_Ringing;
                this.soundService.PlayRingBackTone();
                break;
            }

            case InviteEventTypes.EARLY_MEDIA:
            {
                this.labelInfo.Content = Strings.Text_EarlyMediaStarted;
                this.soundService.StopRingBackTone();
                this.soundService.StopRingTone();
                break;
            }

            case InviteEventTypes.MEDIA_UPDATING:
            {
                this.labelInfo.Content = "Trying to update media...";
                break;
            }

            case InviteEventTypes.MEDIA_UPDATED:
            {
                bool isVideo = ((this.AVSession.MediaType & MediaType.Video) == MediaType.Video || (this.AVSession.MediaType & MediaType.Videobfcp) == MediaType.Videobfcp);
                this.labelInfo.Content = String.Format("Media Updated - {0}", isVideo ? "Video" : "Audio");
                if (isVideo)
                {
                    this.AttachDisplays();
                }
                break;
            }

            case InviteEventTypes.CONNECTED:
            {
                this.labelInfo.Content = Strings.Text_InCall;
                this.soundService.StopRingBackTone();
                this.soundService.StopRingTone();

                this.videoDisplayLocal.Visibility          = ((this.AVSession.MediaType & MediaType.Video) == MediaType.Video) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
                this.videoDisplayScrenCastLocal.Visibility = ((this.AVSession.MediaType & MediaType.Videobfcp) == MediaType.Videobfcp) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
                this.videoDisplayRemote.Visibility         = ((this.AVSession.MediaType & MediaType.Video) == MediaType.Video) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
                this.labelQuality.Visibility = ((this.AVSession.MediaType & MediaType.Video) == MediaType.Video) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;

                this.timerCall.Start();
                if (this.avHistoryEvent != null)
                {
                    if (this.avHistoryEvent.Status == HistoryEvent.StatusType.Missed)
                    {
                        this.avHistoryEvent.Status = HistoryEvent.StatusType.Incoming;
                    }
                    this.avHistoryEvent.StartTime = DateTime.Now;
                    this.avHistoryEvent.EndTime   = this.avHistoryEvent.StartTime;
                }

                if (this.labelQuality.Visibility == System.Windows.Visibility.Visible)
                {
                    this.labelQuality.Content = "Quality: 100%";
                    this.timerQuality.Start();
                }

                break;
            }

            case InviteEventTypes.DISCONNECTED:
            case InviteEventTypes.TERMWAIT:
            {
                if (runningAppsWindow != null)
                {
                    runningAppsWindow.Close();
                    runningAppsWindow = null;
                }

                if (this.qosWindow != null)
                {
                    this.qosWindow.Close();
                    this.qosWindow = null;
                }

                this.labelInfo.Content = e.Type == InviteEventTypes.TERMWAIT ? Strings.Text_CallTerminated : e.Phrase;

                this.timerCall.Stop();
                this.timerQuality.Stop();
                this.soundService.StopRingBackTone();
                this.soundService.StopRingTone();

                if (this.avHistoryEvent != null)
                {
                    lock (this.avHistoryEvent)
                    {
                        this.avHistoryEvent.EndTime = DateTime.Now;
                        this.historyService.AddEvent(this.avHistoryEvent);
                        this.avHistoryEvent = null;
                    }
                }

                this.videoDisplayLocal.Visibility          = System.Windows.Visibility.Hidden;
                this.videoDisplayRemote.Visibility         = System.Windows.Visibility.Hidden;
                this.videoDisplayScrenCastLocal.Visibility = System.Windows.Visibility.Hidden;
                this.labelQuality.Visibility = System.Windows.Visibility.Hidden;
                this.AVSession.PreDispose();
                this.AVSession = null;
                break;
            }

            case InviteEventTypes.LOCAL_HOLD_OK:
            {
                if (this.isTransfering)
                {
                    this.isTransfering = false;
                    this.AVSession.TransferCall(this.transferUri);
                }
                this.labelInfo.Content = Strings.Text_CallPlacedOnHold;
                this.IsHeld            = true;
                break;
            }

            case InviteEventTypes.LOCAL_HOLD_NOK:
            {
                this.isTransfering     = false;
                this.labelInfo.Content = Strings.Text_FailedToPlaceRemotePartyOnHold;
                break;
            }

            case InviteEventTypes.LOCAL_RESUME_OK:
            {
                this.isTransfering     = false;
                this.labelInfo.Content = Strings.Text_CallTakenOffHold;
                this.IsHeld            = false;
                break;
            }

            case InviteEventTypes.LOCAL_RESUME_NOK:
            {
                this.isTransfering     = false;
                this.labelInfo.Content = Strings.Text_FailedToUnholdCall;
                break;
            }

            case InviteEventTypes.REMOTE_HOLD:
            {
                this.labelInfo.Content = Strings.Text_PlacedOnHoldByRemoteParty;
                break;
            }

            case InviteEventTypes.REMOTE_RESUME:
            {
                this.labelInfo.Content = Strings.Text_TakenOffHoldByRemoteParty;
                break;
            }


            case InviteEventTypes.LOCAL_TRANSFER_TRYING:
            {
                this.labelInfo.Content = String.Format("{0}: {1}", Strings.Text_CallTransfer, Strings.Text_Initiated);
                break;
            }

            case InviteEventTypes.LOCAL_TRANSFER_FAILED:
            {
                this.labelInfo.Content = String.Format("{0}: {1}", Strings.Text_CallTransfer, Strings.Text_Failed);
                break;
            }

            case InviteEventTypes.LOCAL_TRANSFER_ACCEPTED:
            {
                this.labelInfo.Content = String.Format("{0}: {1}", Strings.Text_CallTransfer, Strings.Text_Accepted);
                break;
            }

            case InviteEventTypes.LOCAL_TRANSFER_COMPLETED:
            {
                this.labelInfo.Content = String.Format("{0}: {1}", Strings.Text_CallTransfer, Strings.Text_Completed);
                break;
            }

            case InviteEventTypes.LOCAL_TRANSFER_NOTIFY:
            case InviteEventTypes.REMOTE_TRANSFER_NOTIFY:
            {
                short?code = e.GetExtra(InviteEventArgs.EXTRA_SIP_CODE) as short?;
                this.labelInfo.Content = String.Format("{0}: {1} {2}", Strings.Text_CallTransfer, code.HasValue ? code.Value : -1, e.Phrase);
                if (code.HasValue)
                {
                    if (code.Value >= 300 && this.IsHeld)
                    {
                        this.AVSession.ResumeCall();
                    }
                }
                break;
            }

            case InviteEventTypes.REMOTE_TRANSFER_REQUESTED:
            {
                new Thread((System.Threading.ParameterizedThreadStart) delegate(object _e)
                    {
                        this.Dispatcher.Invoke((System.Threading.ThreadStart) delegate
                        {
                            InviteEventArgs args = _e as InviteEventArgs;
                            if (args != null)
                            {
                                String referToUri  = args.GetExtra(InviteEventArgs.EXTRA_REFERTO_URI) as String;
                                String referToName = UriUtils.GetDisplayName(referToUri);
                                DialogResult ret   = MessageBox.Show(String.Format("Call Transfer to {0} requested. Do you accept?", referToName), "Call Transfer Request", MessageBoxButtons.YesNo);
                                if (this.AVSession != null)
                                {
                                    if (ret == System.Windows.Forms.DialogResult.Yes)
                                    {
                                        this.AVSession.AcceptCallTransfer();
                                    }
                                    else
                                    {
                                        this.AVSession.RejectCallTransfer();
                                    }
                                }
                            }
                        });
                    })
                .Start(e);
                break;
            }

            case InviteEventTypes.REMOTE_TRANSFER_INPROGESS:
            {
                this.AVTransfSession = e.GetExtra(InviteEventArgs.EXTRA_SESSION) as MyAVSession;
                break;
            }

            case InviteEventTypes.REMOTE_TRANSFER_FAILED:
            {
                this.AVTransfSession = null;
                break;
            }

            case InviteEventTypes.REMOTE_TRANSFER_COMPLETED:
            {
                if (this.AVTransfSession != null)
                {
                    this.AVSession       = this.AVTransfSession;
                    this.AVTransfSession = null;
                    this.InitializeView();
                    this.UpdateControls();
                }
                break;
            }
            }
        }
Exemplo n.º 6
0
        private void ItemFileTransfer_ValueLoaded(object sender, EventArgs e)
        {
            this.@event = this.Value;
            if (this.@event == null)
            {
                LOG.Error("Event is null");
                return;
            }

            if ([email protected] == null)
            {
                LOG.Error("No MSRP session associated to this event");
                return;
            }

            [email protected] += this.MsrpSession_onMsrpEvent;

            switch ([email protected])
            {
            case HistoryEvent.StatusType.Incoming:
                this.labelDescription.Content = String.Format("Receiving from {0}...", UriUtils.GetDisplayName([email protected]));
                this.buttonAccept.Content     = "accept";
                this.buttonDecline.Content    = "decline";
                this.gradientStop.Color       = Colors.Bisque;
                break;

            case HistoryEvent.StatusType.Outgoing:
                this.labelDescription.Content = "Sending...";
                this.buttonAccept.Visibility  = Visibility.Collapsed;
                this.buttonDecline.Content    = "abort";
                this.gradientStop.Color       = Colors.SkyBlue;
                break;

            case HistoryEvent.StatusType.Failed:
            default:
                this.gradientStop.Color = Colors.Red;
                break;
            }

            this.labelDate.Content = BaseItem <HistoryFileTransferEvent> .GetFriendlyDateString([email protected]);

            this.fileName           = new FileInfo([email protected]).Name;
            this.textBlockName.Text = this.fileName;
            if (File.Exists([email protected]))
            {
                using (System.Drawing.Icon icon = System.Drawing.Icon.ExtractAssociatedIcon([email protected]))
                {
                    this.imageIcon.Source = MyImageConverter.FromIcon(icon);
                }
            }
        }
Exemplo n.º 7
0
 private void InitializeView()
 {
     this.Title = String.Format("Talking with {0}", UriUtils.GetDisplayName(this.remotePartyUri));
 }
Exemplo n.º 8
0
 private void InitializeView()
 {
     this.Title = String.Format("{0} {1}", Strings.Text_TalkingWith, UriUtils.GetDisplayName(this.remotePartyUri));
 }