/// <summary>
        /// add current responder to incident meeting as participant.
        /// </summary>
        private void TransferToIncidentMeeting()
        {
            Task.Run(async() =>
            {
                try
                {
                    var incidentMeetingCallId = statusData?.BotMeetingCallId;
                    var responderStatusData   = statusData?.GetResponder(responderId);

                    if (incidentMeetingCallId != null && responderStatusData != null)
                    {
                        var addParticipantRequestData = new AddParticipantRequestData()
                        {
                            ObjectId       = responderStatusData.ObjectId,
                            ReplacesCallId = responderStatusData.NotificationCallId,
                        };

                        await Bot.AddParticipantAsync(incidentMeetingCallId, addParticipantRequestData).ConfigureAwait(false);

                        GraphLogger.Info("Finished to transfer to incident meeting. ");
                    }
                    else
                    {
                        GraphLogger.Warn(
                            $"Tried to transfer to incident meeting but needed info are not valid. Meeting call-id: {incidentMeetingCallId}; status data: {responderStatusData}");
                    }
                }
                catch (Exception ex)
                {
                    GraphLogger.Error(ex, "Failed to transfer to incident meeting.");
                    throw;
                }
            });
        }
Example #2
0
        /// <inheritdoc/>
        protected override void ParticipantsOnUpdated(IParticipantCollection sender, CollectionEventArgs <IParticipant> args)
        {
            foreach (var participant in args.AddedResources)
            {
                var responderId = participant.Resource?.Info?.Identity?.User?.Id;

                if (responderId == null)
                {
                    // the participant have no user ID (ex. it is a bot).
                    continue;
                }

                statusData?.UpdateResponderMeetingCallId(responderId, Call.Id, Call.ScenarioId);

                statusData?.UpdateResponderMeetingStatus(responderId, IncidentResponderMeetingStatus.Added);

                var responderCallId = statusData?.GetResponder(responderId)?.NotificationCallId;

                if (responderCallId != null)
                {
                    TryDeleteCall(responderCallId);
                }
            }

            foreach (var participant in args.RemovedResources)
            {
                var responderId = participant.Resource?.Info?.Identity?.User?.Id;

                if (responderId == null)
                {
                    // the participant have no user ID (ex. it is a bot).
                    continue;
                }

                statusData?.UpdateResponderMeetingStatus(responderId, IncidentResponderMeetingStatus.Removed);
            }
        }