Exemple #1
0
 /// <summary>
 /// Delegate that is called when an incoming InstantMessagingCall arrives.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void InstantMessagingCall_Received(object sender, CallReceivedEventArgs <InstantMessagingCall> e)
 {
     Task.Factory.StartNew(() =>
     {
         try
         {
             if (_activeConversationSessions.ContainsKey(e.Call.Conversation))
             {
                 _activeConversationSessions[e.Call.Conversation].AddIMIncomingCall(e);
             }
             else if (e.IsNewConversation)
             {
                 Conversation c = e.Call.Conversation;
                 TranscriptRecorderSession t          = new TranscriptRecorderSession(e);
                 t.TranscriptRecorderSessionChanged  += this.TranscriptRecorder_OnTranscriptRecorderSessionChanged;
                 t.TranscriptRecorderSessionShutdown += this.TranscriptRecorder_OnTranscriptRecorderSessionShutdown;
                 _activeConversationSessions.Add(c, t);
             }
             else if (e.IsConferenceDialOut)
             {
                 // TODO: Join Conference then accept IM call
                 throw new NotImplementedException("InstantMessagingCall_Received with ConferenceDialOut AudioVideoCall is not yet supported.");
             }
         }
         catch (Exception ex)
         {
             NonBlockingConsole.WriteLine("Error: Exception thrown in InstantMessagingCall_Received: " + ex.ToString());
         }
         finally
         {
             _waitForTranscriptSessionStarted.Set();
         }
     });
 }
Exemple #2
0
 /// <summary>
 /// Delegate that is called when an incoming ConferenceInvite is received.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void UserEndpoint_ConferenceInvitationReceived(object sender, ConferenceInvitationReceivedEventArgs e)
 {
     Task.Factory.StartNew(() =>
     {
         try
         {
             ConferenceInvitation invite = e.Invitation;
             Conversation conversation   = invite.Conversation;
             // TODO: indexing by conv id doesn't work for "public meeting recording" scenario
             if (_activeConversationSessions.ContainsKey(conversation))
             {
                 _activeConversationSessions[conversation].AddIncomingInvitedConference(e);
             }
             else
             {
                 TranscriptRecorderSession t = new TranscriptRecorderSession(e);
                 _activeConversationSessions.Add(conversation, t);
             }
         }
         catch (Exception ex)
         {
             NonBlockingConsole.WriteLine("Error: Exception thrown in UserEndpoint_ConferenceInvitationReceived: " + ex.ToString());
         }
         finally
         {
             _waitForTranscriptSessionStarted.Set();
         }
     });
 }
 public TranscriptRecorderSessionShutdownEventArgs(TranscriptRecorderSession trs)
 {
     _conference = trs.Conference;
     _conversation = trs.Conversation;
     _transcriptRecorderSession = trs;
     _sessionId = trs.SessionId;
     _messages = trs.Messages;
 }
Exemple #4
0
 public TranscriptRecorderSessionShutdownEventArgs(TranscriptRecorderSession trs)
 {
     _conference   = trs.Conference;
     _conversation = trs.Conversation;
     _transcriptRecorderSession = trs;
     _sessionId = trs.SessionId;
     _messages  = trs.Messages;
 }
Exemple #5
0
        private void SaveTranscript(TranscriptRecorderSession trs)
        {
            NonBlockingConsole.WriteLine("SaveTranscript - Entry");

            string filename = "LyncMeetingTranscript.txt";

            using (FileStream fs = new FileStream(filename, FileMode.OpenOrCreate))
            {
                using (BinaryWriter w = new BinaryWriter(fs))
                {
                    w.Write(trs.GetFullTranscript());
                }
            }

            NonBlockingConsole.WriteLine("SaveTranscript - Exit");
        }
Exemple #6
0
        void TranscriptRecorder_OnTranscriptRecorderSessionChanged(object sender, TranscriptRecorderSessionChangedEventArgs e)
        {
            NonBlockingConsole.WriteLine("TranscriptRecorder_OnTranscriptRecorderSessionChanged event. SessionId: {0}. ConversationId: {1}. ConferenceId: {2}",
                                         e.SessionId.ToString(),
                                         (e.Conversation == null) ? "null" : e.Conversation.Id,
                                         (e.Conference == null) ? "null" : e.Conference.ConferenceUri);

            TranscriptRecorderSession session = null;

            if ((e.Conversation != null) && (e.Conference != null) &&
                _activeConversationSessions.TryGetValue(e.Conversation, out session))
            {
                // Add TranscriptRecorderSession to conference table (if no entry for this Conference already exists)
                lock (s_lock)
                {
                    if (!_activeConferenceSessions.ContainsKey(e.Conference))
                    {
                        NonBlockingConsole.WriteLine("TranscriptRecorder_OnTranscriptRecorderSessionChanged: Adding TranscriptRecorderSession for Conference entry: {0}.",
                                                     e.Conference.ConferenceUri);
                        _activeConferenceSessions.Add(e.Conference, session);

                        // If successfully added TranscriptRecorderSession to conference table, remove from conversation table
                        if (_activeConversationSessions.ContainsKey(e.Conversation))
                        {
                            NonBlockingConsole.WriteLine("TranscriptRecorder_OnTranscriptRecorderSessionChanged: Removing TranscriptRecorderSession for Conversation entry: {0}.",
                                                         e.Conversation.Id);

                            _activeConversationSessions.Remove(e.Conversation);
                        }
                    }
                } // lock
            }
            else
            {
                NonBlockingConsole.WriteLine("[Warn] TranscriptRecorder_OnTranscriptRecorderSessionChanged called on invalid Conversation or Conference. Ignoring event.");
            }
        }
 public TranscriptRecorderSessionChangedEventArgs(TranscriptRecorderSession trs)
 {
     _conference = trs.Conference;
     _conversation = trs.Conversation;
     _sessionId = trs.SessionId;
 }
Exemple #8
0
 public TranscriptRecorderSessionChangedEventArgs(TranscriptRecorderSession trs)
 {
     _conference   = trs.Conference;
     _conversation = trs.Conversation;
     _sessionId    = trs.SessionId;
 }
Exemple #9
0
        private async Task StopTranscriptRecorderSessionAsync(Guid sessionId, bool shutdownSession = true)
        {
            NonBlockingConsole.WriteLine("StopTranscriptRecorderSession - Entry. SessionId: {0}.", sessionId.ToString());
            TranscriptRecorderSession sessionToStop = null;
            bool shutdownManager = false;

            lock (s_lock)
            {
                if (_state == TranscriptSessionManagerState.Active)
                {
                    foreach (TranscriptRecorderSession trs in _activeConversationSessions.Values)
                    {
                        if (trs.SessionId.Equals(sessionId))
                        {
                            sessionToStop = trs;
                            break;
                        }
                    }

                    if (sessionToStop != null)
                    {
                        _activeConversationSessions.Remove(sessionToStop.Conversation);

                        if ((sessionToStop.Conference != null) && _activeConferenceSessions.ContainsKey(sessionToStop.Conference))
                        {
                            _activeConferenceSessions.Remove(sessionToStop.Conference);
                        }
                    }
                    else
                    {
                        foreach (TranscriptRecorderSession trs in _activeConferenceSessions.Values)
                        {
                            if (trs.SessionId.Equals(sessionId))
                            {
                                sessionToStop = trs;
                                break;
                            }
                        }

                        if (sessionToStop != null)
                        {
                            _activeConferenceSessions.Remove(sessionToStop.Conference);
                        }
                    }

                    if ((_activeConferenceSessions.Count + _activeConversationSessions.Count) == 0)
                    {
                        shutdownManager = true;
                    }
                } // (_state == TranscriptSessionManagerState.Active)
            }     // lock

            // Only need to shutdown TranscriptRecorderSession once (if found)
            if (sessionToStop != null)
            {
                Task task = new Task(() =>
                {
                    SaveTranscript(sessionToStop);
                    SendTranscript(sessionToStop);

                    if (shutdownSession)
                    {
                        sessionToStop.Shutdown();
                    }
                });

                List <Task> tasks = new List <Task>()
                {
                    task
                };
                task.Start();
                await Task.WhenAll(tasks);

                if (shutdownManager)
                {
                    await this.ShutdownAsync();
                }
            }
            else
            {
                NonBlockingConsole.WriteLine("StopTranscriptRecorderSession: TranscriptRecorderSession {0} doesn't exist or was already shutdown",
                                             sessionId.ToString());
            }

            NonBlockingConsole.WriteLine("StopTranscriptRecorderSession - Exit. SessionId: {0}.", sessionId.ToString());
        }
Exemple #10
0
 private void SendTranscript(TranscriptRecorderSession trs)
 {
     // TODO
     NonBlockingConsole.WriteLine("SendTranscript - Entry");
     NonBlockingConsole.WriteLine("SendTranscript - Exit");
 }
 /// <summary>
 /// Delegate that is called when an incoming ConferenceInvite is received.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void UserEndpoint_ConferenceInvitationReceived(object sender, ConferenceInvitationReceivedEventArgs e)
 {
     Task.Factory.StartNew(() =>
     {
         try
         {
             ConferenceInvitation invite = e.Invitation;
             Conversation conversation = invite.Conversation;
             // TODO: indexing by conv id doesn't work for "public meeting recording" scenario
             if (_activeConversationSessions.ContainsKey(conversation))
             {
                 _activeConversationSessions[conversation].AddIncomingInvitedConference(e);
             }
             else
             {
                 TranscriptRecorderSession t = new TranscriptRecorderSession(e);
                 _activeConversationSessions.Add(conversation, t);
             }
         }
         catch (Exception ex)
         {
             NonBlockingConsole.WriteLine("Error: Exception thrown in UserEndpoint_ConferenceInvitationReceived: " + ex.ToString());
         }
         finally
         {
             _waitForTranscriptSessionStarted.Set();
         }
     });
 }
 /// <summary>
 /// Delegate that is called when an incoming InstantMessagingCall arrives.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void InstantMessagingCall_Received(object sender, CallReceivedEventArgs<InstantMessagingCall> e)
 {
     Task.Factory.StartNew(()=>
         {
         try
         {
             if (_activeConversationSessions.ContainsKey(e.Call.Conversation))
             {
                 _activeConversationSessions[e.Call.Conversation].AddIMIncomingCall(e);
             }
             else if (e.IsNewConversation)
             {
                 Conversation c = e.Call.Conversation;
                 TranscriptRecorderSession t = new TranscriptRecorderSession(e);
                 t.TranscriptRecorderSessionChanged += this.TranscriptRecorder_OnTranscriptRecorderSessionChanged;
                 t.TranscriptRecorderSessionShutdown += this.TranscriptRecorder_OnTranscriptRecorderSessionShutdown;
                 _activeConversationSessions.Add(c, t);
             }
             else if (e.IsConferenceDialOut)
             {
                 // TODO: Join Conference then accept IM call
                 throw new NotImplementedException("InstantMessagingCall_Received with ConferenceDialOut AudioVideoCall is not yet supported.");
             }
         }
         catch (Exception ex)
         {
             NonBlockingConsole.WriteLine("Error: Exception thrown in InstantMessagingCall_Received: " + ex.ToString());
         }
         finally
         {
             _waitForTranscriptSessionStarted.Set();
         }
     });
 }
 private void SendTranscript(TranscriptRecorderSession trs)
 {
     // TODO
     NonBlockingConsole.WriteLine("SendTranscript - Entry");
     NonBlockingConsole.WriteLine("SendTranscript - Exit");
 }
        private void SaveTranscript(TranscriptRecorderSession trs)
        {
            NonBlockingConsole.WriteLine("SaveTranscript - Entry");

            string filename = "LyncMeetingTranscript.txt";
            using (FileStream fs = new FileStream(filename, FileMode.OpenOrCreate))
            {
                using (BinaryWriter w = new BinaryWriter(fs))
                {
                    w.Write(trs.GetFullTranscript());
                }
            }

            NonBlockingConsole.WriteLine("SaveTranscript - Exit");
        }