예제 #1
0
        private void ShutdownUserEndpoint(AsyncTask task, object state)
        {
            UserEndpoint userEndpoint = state as UserEndpoint;

            if (userEndpoint == null)
            {
                task.Complete(null);
                return;
            }
            task.DoOneStep(
                delegate()
            {
                Logger.Log(Logger.LogLevel.Info, "Terminating UserEndpoint." + userEndpoint.OwnerUri);
                userEndpoint.BeginTerminate(
                    delegate(IAsyncResult ar)
                {
                    task.DoFinalStep(
                        delegate()
                    {
                        userEndpoint.EndTerminate(ar);
                        Logger.Log(Logger.LogLevel.Info, "Terminated UserEndpoint." + userEndpoint.OwnerUri);
                    });
                },
                    null);
            });
        }
        public static void DisconnectOfficeCommunicationServer(UserEndpoint userEndpoint)
        {
            Console.WriteLine("Disconnecting from OCS...");

            userEndpoint.EndTerminate(userEndpoint.BeginTerminate(null, null));

            CollaborationPlatform platform = userEndpoint.Platform;

            platform.EndShutdown(platform.BeginShutdown(null, null));

            Console.WriteLine("\tSuccess");
        }
예제 #3
0
        public void EndTerminateUserEndpoint(IAsyncResult result)
        {
            UserEndpoint endpoint = (UserEndpoint)result.AsyncState;

            try
            {
                endpoint.EndTerminate(result);
            }
            finally
            {
                _userEndpoint = null;
                this._waitForUserEndpointTerminated.Set();
            }
        }
예제 #4
0
        /// <summary>
        /// Tear down the endpoint gracefully
        /// </summary>
        private void CleanupMCS()
        {
            shutdownLock.AcquireWriterLock(Timeout.Infinite);
            shutdownLock.ReleaseWriterLock();

            // Clean-up the browser
            this.CleanupBrowser();
            // Clean-up the call
            this.CleanupCall();

            if (endpoint != null)
            {
                endpoint.EndTerminate(endpoint.BeginTerminate(null, null));
            }
        }
예제 #5
0
        public void SetPresence(User user, PreferredUserStatus status)
        {
            if (!LyncCollaboration.HasStarted)
            {
                LyncCollaboration.Start();
            }

            var state = PresenceState.UserAway;

            switch (status)
            {
            case PreferredUserStatus.BeRightBack:
                state = PresenceState.UserBeRightBack;
                break;

            case PreferredUserStatus.Busy:
                state = PresenceState.UserBusy;
                break;

            case PreferredUserStatus.DoNotDisturb:
                state = PresenceState.UserDoNotDisturb;
                break;

            case PreferredUserStatus.Offwork:
                state = PresenceState.UserOffWork;
                break;

            case PreferredUserStatus.Online:
                state = PresenceState.UserAvailable;
                break;
            }

            user.ClearPresence();

            var host     = Plugin.LyncPlugin.Configuration.GetString("host");
            var appPort  = Plugin.LyncPlugin.Configuration.GetInt("appPort");
            var sip      = "sip:" + user.SipUri();
            var endpoint = new UserEndpoint(LyncCollaboration.Platform, new UserEndpointSettings(sip, host, appPort));

            endpoint.EndEstablish(endpoint.BeginEstablish(null, null));
            endpoint.LocalOwnerPresence.EndSubscribe(endpoint.LocalOwnerPresence.BeginSubscribe(null, null));
            endpoint.LocalOwnerPresence.EndPublishPresence(endpoint.LocalOwnerPresence.BeginPublishPresence(new PresenceCategory[] { state }, null, null));
            endpoint.EndTerminate(endpoint.BeginTerminate(null, null));
        }