Exemple #1
0
        //Just to record the state transitions in the console.
        void Conversation_ParticipantEndpointAttendanceChanged(object sender,
                                                               ParticipantAttendanceChangedEventArgs e)
        {
            Conversation conv = sender as Conversation;

            // Log each participant as s/he gets added/deleted from the Conversation's roster.
            foreach (ConversationParticipant p in e.Added)
            {
                NonBlockingConsole.WriteLine("{0} is notified of participant joining the conversation: {1}",
                                             conv.LocalParticipant.UserAtHost,
                                             p.UserAtHost);

                Message m = new Message("Participant joined conversation.", p.DisplayName, p.UserAtHost,
                                        p.Uri, MessageType.ConversationInfo, _conversation.Id, MessageDirection.Incoming);
                _transcriptRecorder.OnMessageReceived(m);
            }

            foreach (ConversationParticipant p in e.Removed)
            {
                NonBlockingConsole.WriteLine("{0} is notified of participant leaving the conversation: {1}",
                                             conv.LocalParticipant.UserAtHost,
                                             p.UserAtHost);

                Message m = new Message("Participant left conversation.", p.DisplayName, p.UserAtHost,
                                        p.Uri, MessageType.ConversationInfo, _conversation.Id, MessageDirection.Incoming);
                _transcriptRecorder.OnMessageReceived(m);
            }

            NonBlockingConsole.WriteLine("");
        }
        private void ProcessAllowedParticipants(Object sender, ParticipantAttendanceChangedEventArgs args)
        {
            List <ConversationParticipant> listOfParticipants = new List <ConversationParticipant>(args.Added);

            listOfParticipants.ForEach(cp => {
                lock (_syncRoot)
                {
                    _listOfPresenters.ForEach(p =>
                    {
                        if (SipUriCompare.Equals(p, cp.Uri))
                        {
                            if (cp.Role != ConferencingRole.Leader)
                            {
                                try
                                {
                                    _conversation.ConferenceSession.BeginModifyRole(cp,
                                                                                    ConferencingRole.Leader,
                                                                                    mr =>
                                    {
                                        try
                                        {
                                            _conversation.ConferenceSession.EndModifyRole(mr);
                                        }
                                        catch (RealTimeException rtex)
                                        {
                                            this._logger.Log("ModifyRole failed", rtex);
                                        }
                                    },
                                                                                    null);
                                }
                                catch (InvalidOperationException ivoex)
                                {
                                    _logger.Log("ModifyRole failed", ivoex);
                                }
                            }
                        }
                    });
                }
            });
        }
        //Just to record the state transitions in the console.
        void Conversation_ParticipantEndpointAttendanceChanged(object sender,
            ParticipantAttendanceChangedEventArgs e)
        {
            Conversation conv = sender as Conversation;

            // Log each participant as s/he gets added/deleted from the Conversation's roster.
            foreach (ConversationParticipant p in e.Added)
            {
                NonBlockingConsole.WriteLine("{0} is notified of participant joining the conversation: {1}",
                    conv.LocalParticipant.UserAtHost,
                    p.UserAtHost);

                Message m = new Message("Participant joined conversation.", p.DisplayName, p.UserAtHost,
                    p.Uri, MessageType.ConversationInfo, _conversation.Id, MessageDirection.Incoming);
                _transcriptRecorder.OnMessageReceived(m);
            }

            foreach (ConversationParticipant p in e.Removed)
            {
                NonBlockingConsole.WriteLine("{0} is notified of participant leaving the conversation: {1}",
                    conv.LocalParticipant.UserAtHost,
                    p.UserAtHost);

                Message m = new Message("Participant left conversation.", p.DisplayName, p.UserAtHost,
                    p.Uri, MessageType.ConversationInfo, _conversation.Id, MessageDirection.Incoming);
                _transcriptRecorder.OnMessageReceived(m);
            }

            NonBlockingConsole.WriteLine("");
        }
Exemple #4
0
        /// <summary>
        /// Attendance changed monitor.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TrustedConversation_RemoteParticipantAttendanceChanged(object sender, ParticipantAttendanceChangedEventArgs e)
        {
            // If any participant leaves we tear down the conversation.
            if (e.Removed.Count > 0)
            {
                bool needTermination = false;
                foreach (var participant in e.Removed)
                {
                    if (participant.RosterVisibility == ConferencingRosterVisibility.Visible)
                    {
                        needTermination = true;
                        break;
                    }
                }

                if (needTermination)
                {
                    this.BeginTerminate((asyncResult) =>
                    {
                        this.EndTerminate(asyncResult);
                    },
                                        null);
                }
            }
        }