Ejemplo n.º 1
0
        public void CreateUserEndpoint(string userURI)
        {
            UserEndpointSettings settings = new UserEndpointSettings(userURI);

            user = new UserEndpoint(collabPlatform, settings);
            user.EndEstablish(user.BeginEstablish(null, null));
            if (user.State != LocalEndpointState.Established)
            {
                throw new Exception("Local endpoint state is not established");
            }

            alertNotification = null;
        }
Ejemplo n.º 2
0
        void LocalOwnerPresence_PresenceNotificationReceived(object sender, LocalPresentityNotificationEventArgs e)
        {
            user.LocalOwnerPresence.PresenceNotificationReceived -= LocalOwnerPresence_PresenceNotificationReceived;

            foreach (PresenceCategoryWithMetaData category in e.SelfUsageCategories)
            {
                if (category.Name.ToLowerInvariant() == "alerts")
                {
                    alertNotification = category;
                    break;
                }
            }

            waitForAlertNotificationUpdate.Set();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// PublishPresenceToWebCustomers is a method that indicates Web Users different levels of Presence based on
        /// the average queue time, or whether the portal is getting drained.
        /// </summary>
        private void PublishPresenceToWebCustomers()
        {
            //Limitation: Note that this publication only makes sense if only one instance of the Application is in service.
            // If multiple instances of the application were running at the same time, one shall consider using a database to coordinate the publication
            // of the information.

            PresenceState aggregateState;

            if (_portalState == PortalState.Started ||
                _portalState == PortalState.Draining)
            {
                if (_portalState == ContactCenter.PortalState.Started)
                {
                    TimeSpan averageWaitTime = _agentHunter.AverageQueueTime.Value;
                    if (averageWaitTime <= AcdPortal.OneMinuteSpan)
                    {
                        var presenceActivity = new PresenceActivity(new LocalizedString(1033, String.Format("Expected Wait Time is \r\n {0} min and {1} sec",
                                                                                                            averageWaitTime.Minutes,
                                                                                                            averageWaitTime.Seconds)));

                        presenceActivity.SetAvailabilityRange(3500, 3500);
                        aggregateState = new PresenceState(PresenceStateType.AggregateState,
                                                           3500,
                                                           presenceActivity);
                    }
                    else if (averageWaitTime <= AcdPortal.FiveMinuteSpan)
                    {
                        var presenceActivity = new PresenceActivity(new LocalizedString(1033, String.Format("Expected Wait Time is \r\n {0} min and {1} sec",
                                                                                                            averageWaitTime.Minutes,
                                                                                                            averageWaitTime.Seconds)));
                        presenceActivity.SetAvailabilityRange(6500, 6500);

                        aggregateState = new PresenceState(PresenceStateType.AggregateState,
                                                           6500,
                                                           presenceActivity);
                    }
                    else
                    {
                        string activityString = null;
                        if (averageWaitTime.Hours > 0)
                        {
                            activityString = String.Format("Expect Long Wait Time; \r\n currently {0} hour {1} min and {2} sec", averageWaitTime.Hours, averageWaitTime.Minutes, averageWaitTime.Seconds);
                        }
                        else
                        {
                            activityString = String.Format("Expect Long Wait Time; \r\n currently {0} min and {1} sec", averageWaitTime.Minutes, averageWaitTime.Seconds);
                        }

                        var presenceActivity = new PresenceActivity(new LocalizedString(1033, activityString));
                        presenceActivity.SetAvailabilityRange(6500, 6500);

                        aggregateState = new PresenceState(PresenceStateType.AggregateState,
                                                           6500,
                                                           presenceActivity);
                    }
                }
                else
                {
                    var presenceActivity = new PresenceActivity(new LocalizedString(1033, "This service is not available at this time; please call again later."));
                    presenceActivity.SetAvailabilityRange(9500, 9500);
                    aggregateState = new PresenceState(PresenceStateType.AggregateState,
                                                       9500,
                                                       presenceActivity);
                }

                PresenceCategoryWithMetaData averageQueueTimePublication = new PresenceCategoryWithMetaData(1,
                                                                                                            ContainerIDForWebUsers,
                                                                                                            aggregateState);

                try
                {
                    _endpoint.LocalOwnerPresence.BeginPublishPresence(new List <PresenceCategoryWithMetaData>()
                    {
                        averageQueueTimePublication
                    },
                                                                      pub =>
                    {
                        try
                        {
                            _endpoint.LocalOwnerPresence.EndPublishPresence(pub);
                        }

                        catch (OperationFailureException ofex)
                        {
                            _logger.Log("AcdPortal failed to end publish average queue time", ofex);
                        }
                        catch (PublishSubscribeException psex)
                        {
                            _logger.Log("AcdPortal failed to end publish average queue time", psex);
                        }
                        catch (RealTimeException rtex)
                        {
                            _logger.Log("AcdPortal failed to end publish average queue time", rtex);
                        }
                    },
                                                                      null);
                }
                catch (InvalidOperationException ivoex)
                {
                    _logger.Log("AcdPortal failed to begin publish average queue time", ivoex);
                }
            }
        }