private void StartAttributeWatch()
        {
            ErrorMessage = String.Empty;

            if (String.IsNullOrEmpty(_callId))
            {
                return;
            }

            try
            {
                Interaction interaction = InteractionsManager.GetInstance(_session).CreateInteraction(new InteractionId(_callId));
                if (interaction == null)
                {
                    return;
                }
                _watchedInteraction = interaction;
                _watchedInteraction.AttributesChanged += OnInteractionAttributesChanged;
                _watchedInteraction.Deallocated       += OnInteractionDeallocated;
                _watchedInteraction.StartWatching(_attributeNames.ToArray());
            }
            catch (Exception ex)
            {
                ErrorMessage = ex.Message;
            }
        }
Esempio n. 2
0
        private void SetInteractionQueue()
        {
            if (InteractionQueue == null)
            {
                InteractionQueue = new InteractionQueue(InteractionsManager.GetInstance(Session),
                                                        new QueueId(QueueType.MyInteractions, Session.UserId));
            }

            InteractionQueue.InteractionAdded             += InteractionQueueInteractionAdded;
            InteractionQueue.InteractionChanged           += InteractionQueueInteractionChanged;
            InteractionQueue.InteractionRemoved           += InteractionQueueInteractionRemoved;
            InteractionQueue.ConferenceInteractionAdded   += InteractionQueueConferenceInteractionAdded;
            InteractionQueue.ConferenceInteractionChanged += InteractionQueueConferenceInteractionChanged;
            InteractionQueue.ConferenceInteractionRemoved += InteractionQueueConferenceInteractionRemoved;

            List <string> RequiredAttributes = new List <string>();

            RequiredAttributes.Add(InteractionAttributeName.CallIdKey.ToString());
            RequiredAttributes.Add(InteractionAttributeName.RemoteName.ToString());
            RequiredAttributes.Add(InteractionAttributeName.RemoteAddress.ToString());
            RequiredAttributes.Add(InteractionAttributeName.State.ToString());
            //RequiredAttributes.Add(InteractionAttributeName.SupervisorRecorders.ToString());
            //RequiredAttributes.Add(InteractionAttributeName.Recorders.ToString());
            RequiredAttributes.Add(InteractionAttributeName.Muted.ToString());
            InteractionQueue.StartWatchingAsync(RequiredAttributes.ToArray(), UpdateInteractionList, null);
        }
Esempio n. 3
0
 public void Load(Session session)
 {
     _interactionsManager = InteractionsManager.GetInstance(session);
     _peopleManager       = PeopleManager.GetInstance(session);
     _queues          = new Collection <InteractionQueue>();
     _logging         = Logging.GetInstance();
     _lastReset       = DateTime.Now;
     _agentsAvailable = -1;
     _isResetting     = false;
 }
Esempio n. 4
0
        public void Initialize(Session session, IInteractionSelector interactionSelector)
        {
            using (Trace.Main.scope())
            {
                try
                {
                    Trace.Main.always("Initializing VidyoPanelViewModel");

                    // Set things
                    if (_session == null)
                    {
                        // Only do these things the first time around
                        _session = session;
                        _session.ConnectionStateChanged += SessionOnConnectionStateChanged;
                    }

                    _interactionSelector = interactionSelector;

                    _customNotification = new CustomNotification(_session);
                    MyInteractions      = new InteractionQueue(InteractionsManager.GetInstance(_session),
                                                               new QueueId(QueueType.User, _session.UserId));

                    // Watch queue
                    MyInteractions.InteractionAdded   += MyInteractionsOnInteractionAdded;
                    MyInteractions.InteractionChanged += MyInteractionsOnInteractionChanged;
                    MyInteractions.InteractionRemoved += MyInteractionsOnInteractionRemoved;
                    MyInteractions.StartWatching(_watchedAttrs.ToArray());

                    // Watch for custom notifications
                    _customNotification.CustomNotificationReceived += OnCustomNotificationReceived;
                    WatchCustomNotifications();

                    // Get the Vidyo service client base URL
                    SendCustomNotification(CustomMessageType.ApplicationRequest, VidyoServiceClientBaseUrlRequestOid,
                                           VidyoServiceClientBaseUrlRequestEid, _session.UserId.ToLower());

                    // Let everyone know we're ready
                    IsInitialized = true;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    Trace.Main.exception(ex, ex.Message);
                    //MessageBox.Show(
                    //    "There was an error intializing the Vidyo addin. Please contact your system administrator.",
                    //    "Vidyo Addin - critical error");
                    throw;
                }
            }
        }
Esempio n. 5
0
 private ChatInteraction GetChat(long interactionId)
 {
     using (Trace.Main.scope())
     {
         try
         {
             return
                 (InteractionsManager.GetInstance(_session).CreateInteraction(new InteractionId(interactionId)) as
                  ChatInteraction);
         }
         catch (Exception ex)
         {
             Trace.Main.exception(ex);
             return(null);
         }
     }
 }
        private void Dial_Executed(object sender, ExecutedRoutedEventArgs executedRoutedEventArgs)
        {
            try
            {
                if (!CanDial)
                {
                    return;
                }

                MainViewModel.Instance.LogMessage("Executing action: Dial (" + DialString + ")");
                InteractionsManager.GetInstance(_session)
                .MakeCall(new CallInteractionParameters(DialString, CallMadeStage.None));

                //DialString = "";
            }
            catch (Exception ex)
            {
                MainViewModel.Instance.LogMessage(ex);
            }
        }
        private void Conference_Executed(object sender, ExecutedRoutedEventArgs executedRoutedEventArgs)
        {
            try
            {
                if (!CanConference)
                {
                    return;
                }

                var interactionsForConference = SelectedInteractions.ToArray();
                //var interactionsForConference = Interactions.Where(i => !i.IsDisconnected).Select(i=>i.Interaction).ToArray();
                MainViewModel.Instance.LogMessage("Making a conference with interactions: " +
                                                  interactionsForConference.Select(i => i.InteractionId.Id.ToString())
                                                  .Aggregate((current, next) => current + ", " + next));
                InteractionsManager.GetInstance(_session).MakeNewConference(interactionsForConference);
            }
            catch (Exception ex)
            {
                MainViewModel.Instance.LogMessage(ex);
            }
        }
 public void Load(Session session)
 {
     _interactionsManager = InteractionsManager.GetInstance(session);
     _logging             = Logging.GetInstance();
     StartOrRefreshWatchingInteractions();
 }
Esempio n. 9
0
        public ChatBotService()
        {
            using (Trace.Main.scope())
            {
                try
                {
                    var useWindowsAuth = false;

                    // Parse some settings
                    bool.TryParse(ConfigurationManager.AppSettings["CicUseWindowsAuth"], out useWindowsAuth);
                    bool.TryParse(ConfigurationManager.AppSettings["EnableCommands"], out _enableCommands);

                    // Connect IceLib
                    if (useWindowsAuth)
                    {
                        _session.Connect(new SessionSettings(),
                                         new HostSettings(new HostEndpoint(ConfigurationManager.AppSettings["CicServer"])),
                                         new WindowsAuthSettings(),
                                         new StationlessSettings());
                    }
                    else
                    {
                        _session.Connect(new SessionSettings(),
                                         new HostSettings(new HostEndpoint(ConfigurationManager.AppSettings["CicServer"])),
                                         new ICAuthSettings(ConfigurationManager.AppSettings["CicUser"],
                                                            ConfigurationManager.AppSettings["CicPassword"]),
                                         new StationlessSettings());
                    }

                    // Set up bot manager
                    _botManager = new BotManager(new ServiceProviderDelegates
                    {
                        GetAttributeMethod    = GetAttribute,
                        GetAttributesMethod   = GetAttributes,
                        SetAttributeMethod    = SetAttribute,
                        SetAttributesMethod   = SetAttributes,
                        SendChatMessageMethod = SendChatMessage,
                        ReassignChatMethod    = ReassignChat
                    });
                    _botManager.LoadBots();

                    // Watch queues
                    var queueNames = ConfigurationManager.AppSettings["QueueList"].Split(new[] { '|' });
                    foreach (var queueName in queueNames)
                    {
                        try
                        {
                            Console.WriteLine("Watching queue " + queueName);
                            var queue = new InteractionQueue(InteractionsManager.GetInstance(_session),
                                                             new QueueId(QueueType.Workgroup, queueName));
                            queue.QueueContentsChanged += QueueOnQueueContentsChanged;
                            queue.StartWatching(_queueAttributes);
                            _queues.Add(queue);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex);
                            Trace.Main.exception(ex);
                        }
                    }

                    // Make sure we have some queues
                    if (_queues.Count == 0)
                    {
                        throw new Exception("Not watching any queues after initialization!");
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    Trace.Main.exception(ex);
                    throw;
                }
            }
        }
        public QueueViewModel(Session session)
        {
            try
            {
                // Initialize objects
                //Interactions = new ObservableCollection<InteractionViewModel>();

                // Set command bindings
                CommandBindings.Add(new CommandBinding(UiCommands.PickUpCommand,
                                                       PickUp_Executed,
                                                       (sender, e) =>
                {
                    e.CanExecute = true;
                    e.Handled    = true;
                }));
                CommandBindings.Add(new CommandBinding(UiCommands.DisconnectCommand,
                                                       Disconnect_Executed,
                                                       (sender, e) =>
                {
                    e.CanExecute = true;
                    e.Handled    = true;
                }));
                CommandBindings.Add(new CommandBinding(UiCommands.MuteCommand,
                                                       Mute_Executed,
                                                       (sender, e) =>
                {
                    e.CanExecute = true;
                    e.Handled    = true;
                }));
                CommandBindings.Add(new CommandBinding(UiCommands.HoldCommand,
                                                       Hold_Executed,
                                                       (sender, e) =>
                {
                    e.CanExecute = true;
                    e.Handled    = true;
                }));
                CommandBindings.Add(new CommandBinding(UiCommands.ConferenceCommand,
                                                       Conference_Executed,
                                                       (sender, e) =>
                {
                    e.CanExecute = true;
                    e.Handled    = true;
                }));
                CommandBindings.Add(new CommandBinding(UiCommands.DialCommand,
                                                       Dial_Executed,
                                                       (sender, e) =>
                {
                    e.CanExecute = true;
                    e.Handled    = true;
                }));

                // Set objects
                _session = session;
                _queue   = new InteractionQueue(InteractionsManager.GetInstance(_session),
                                                new QueueId(QueueType.MyInteractions, _session.UserId));
                _queue.QueueContentsChanged += QueueOnQueueContentsChanged;
                _queue.StartWatching(_queueAttributes);
            }
            catch (Exception ex)
            {
                MainViewModel.Instance.LogMessage(ex);
            }
        }
Esempio n. 11
0
 public void MakeCall(string RemoteAddress)
 {
     InteractionsManager.GetInstance(Session).MakeCallAsync(
         new CallInteractionParameters(RemoteAddress, CallMadeStage.Allocated), MakeCallCompleted, null);
 }