예제 #1
0
        internal void RaiseTranscriptRecorderSessionShutdown(TranscriptRecorderSessionShutdownEventArgs args)
        {
            NonBlockingConsole.WriteLine("Raising TranscriptRecorderSessionShutdown event. SessionId: {0}. ConversationId: {1}. ConferenceUri: {2}",
                                         args.SessionId.ToString(), (args.Conversation == null) ? "null" : args.Conversation.Id,
                                         (args.Conference == null) ? "null" : args.Conference.ConferenceUri);

            Message m = new Message("Raising TranscriptRecorderSessionShutdown event. SessionId: " + _sessionId + ".",
                                    MessageType.Info,
                                    (args.Conversation == null) ? "null" : args.Conversation.Id,
                                    (args.Conference == null) ? "null" : args.Conference.ConferenceUri);

            this.OnMessageReceived(m);

            try
            {
                if (this.TranscriptRecorderSessionShutdown != null)
                {
                    this.TranscriptRecorderSessionShutdown.Invoke(this, args);
                }
            }
            catch (Exception e)
            {
                NonBlockingConsole.WriteLine("Error: Exception occured in RaiseTranscriptRecorderSessionShutdown(): {0}.",
                                             e.ToString());
            }
        }
예제 #2
0
        public void Shutdown()
        {
            if (_state == TranscriptRecorderState.Terminated)
            {
                return;
            }
            _state = TranscriptRecorderState.Terminated;

            TranscriptRecorderSessionShutdownEventArgs shutdownArgs = null;

            lock (_transcriptRecorders)
            {
                foreach (MediaTranscriptRecorder m in _transcriptRecorders)
                {
                    m.Shutdown();
                }
                _transcriptRecorders.Clear();
            }

            try
            {
                Message shutdownMessage = new Message("TranscriptRecorderSession is shutting down. SessionId: ", _sessionId.ToString());
                this.OnMessageReceived(shutdownMessage);

                shutdownArgs = new TranscriptRecorderSessionShutdownEventArgs(this);

                if (_conversation != null &&
                    ((_conversation.State != ConversationState.Terminating) || (_conversation.State != ConversationState.Terminated)))
                {
                    Message m = new Message("Conversation shutting down.", _conversation.LocalParticipant.DisplayName,
                                            _conversation.LocalParticipant.UserAtHost, _conversation.LocalParticipant.Uri, DateTime.Now,
                                            _conversation.Id, (this.Conference == null) ? "null" : this.Conference.ConferenceUri,
                                            MessageType.ConversationInfo, MessageDirection.Outgoing);
                    this.OnMessageReceived(m);

                    _conversation.BeginTerminate(EndTerminateConversation, _conversation);
                    //_waitForConversationTerminated.WaitOne();
                    _conversation = null;
                }
                else
                {
                    _waitForConversationTerminated.Set();
                }

                ShutdownConversationContext();
            }
            catch (Exception e)
            {
                NonBlockingConsole.WriteLine("TranscriptRecorderSession.Shutdown(). Exception occured during conversation shutdown: {0}",
                                             e.ToString());
            }
            finally
            {
                // Raise Shutdown event to MeetingTranscriptSessionManager
                this.RaiseTranscriptRecorderSessionShutdown(shutdownArgs);
            }
        }
예제 #3
0
        void TranscriptRecorder_OnTranscriptRecorderSessionShutdown(object sender, TranscriptRecorderSessionShutdownEventArgs e)
        {
            NonBlockingConsole.WriteLine("TranscriptRecorder_OnTranscriptRecorderSessionShutdown event. SessionId: {0}. ConversationId: {1}. ConferenceId: {2}",
                                         e.SessionId.ToString(),
                                         (e.Conversation == null) ? "null" : e.Conversation.Id,
                                         (e.Conference == null) ? "null" : e.Conference.ConferenceUri);

            Task task = StopTranscriptRecorderSessionAsync(e.SessionId, false);

            if (task != null)
            {
                task.Wait();
            }
        }
        internal void RaiseTranscriptRecorderSessionShutdown(TranscriptRecorderSessionShutdownEventArgs args)
        {
            NonBlockingConsole.WriteLine("Raising TranscriptRecorderSessionShutdown event. SessionId: {0}. ConversationId: {1}. ConferenceUri: {2}",
                args.SessionId.ToString(), (args.Conversation == null) ? "null" : args.Conversation.Id, 
                (args.Conference == null) ? "null" : args.Conference.ConferenceUri);

            Message m = new Message("Raising TranscriptRecorderSessionShutdown event. SessionId: " + _sessionId + ".",
                MessageType.Info,
                (args.Conversation == null) ? "null" : args.Conversation.Id,
                (args.Conference == null) ? "null" : args.Conference.ConferenceUri);
            this.OnMessageReceived(m);

            try
            {
                if (this.TranscriptRecorderSessionShutdown != null)
                {
                    this.TranscriptRecorderSessionShutdown.Invoke(this, args);
                }
            }
            catch (Exception e)
            {
                NonBlockingConsole.WriteLine("Error: Exception occured in RaiseTranscriptRecorderSessionShutdown(): {0}.",
                    e.ToString());
            }
        }
        public void Shutdown()
        {
            if (_state == TranscriptRecorderState.Terminated)
            {
                return;
            }
            _state = TranscriptRecorderState.Terminated;

            TranscriptRecorderSessionShutdownEventArgs shutdownArgs = null;
            lock (_transcriptRecorders)
            {
                foreach (MediaTranscriptRecorder m in _transcriptRecorders)
                {
                    m.Shutdown();
                }
                _transcriptRecorders.Clear();
            }

            try
            {
                Message shutdownMessage = new Message("TranscriptRecorderSession is shutting down. SessionId: ", _sessionId.ToString());           
                this.OnMessageReceived(shutdownMessage);

                shutdownArgs = new TranscriptRecorderSessionShutdownEventArgs(this);

                if (_conversation != null &&
                    ((_conversation.State != ConversationState.Terminating) || (_conversation.State != ConversationState.Terminated)))
                {
                    Message m = new Message("Conversation shutting down.", _conversation.LocalParticipant.DisplayName,
                        _conversation.LocalParticipant.UserAtHost, _conversation.LocalParticipant.Uri, DateTime.Now,
                        _conversation.Id, (this.Conference == null) ? "null" : this.Conference.ConferenceUri,
                        MessageType.ConversationInfo, MessageDirection.Outgoing);
                   this.OnMessageReceived(m);

                    _conversation.BeginTerminate(EndTerminateConversation, _conversation);
                    //_waitForConversationTerminated.WaitOne();
                    _conversation = null;
                }
                else
                {
                    _waitForConversationTerminated.Set();
                }

                ShutdownConversationContext();
            }
            catch (Exception e)
            {
                NonBlockingConsole.WriteLine("TranscriptRecorderSession.Shutdown(). Exception occured during conversation shutdown: {0}",
                    e.ToString());
            }
            finally
            {
                // Raise Shutdown event to MeetingTranscriptSessionManager
                this.RaiseTranscriptRecorderSessionShutdown(shutdownArgs);
            }
        }
        void TranscriptRecorder_OnTranscriptRecorderSessionShutdown(object sender, TranscriptRecorderSessionShutdownEventArgs e)
        {
            NonBlockingConsole.WriteLine("TranscriptRecorder_OnTranscriptRecorderSessionShutdown event. SessionId: {0}. ConversationId: {1}. ConferenceId: {2}",
                e.SessionId.ToString(),
                (e.Conversation == null) ? "null" : e.Conversation.Id,
                (e.Conference == null) ? "null" : e.Conference.ConferenceUri);

            Task task = StopTranscriptRecorderSessionAsync(e.SessionId, false);
            if (task != null)
            {
                task.Wait();
            }
        }