/// <summary> /// Raise an incident. /// </summary> /// <param name="incidentRequestData">The incident data.</param> /// <returns>The task for await.</returns> public async Task <ICall> RaiseIncidentAsync(IncidentRequestData incidentRequestData) { // A tracking id for logging purposes. Helps identify this call in logs. var scenarioId = string.IsNullOrEmpty(incidentRequestData.ScenarioId) ? Guid.NewGuid() : new Guid(incidentRequestData.ScenarioId); string incidentId = Guid.NewGuid().ToString(); var incidentStatusData = new IncidentStatusData(incidentId, incidentRequestData); var incident = this.IncidentStatusManager.AddIncident(incidentId, incidentStatusData); var botMeetingCall = await this.JoinCallAsync(incidentRequestData, incidentId).ConfigureAwait(false); // Rehydrates and validates the group call. botMeetingCall = await this.RehydrateAndValidateGroupCallAsync(this.Client, botMeetingCall).ConfigureAwait(false); foreach (var objectId in incidentRequestData.ObjectIds) { var makeCallRequestData = new MakeCallRequestData( incidentRequestData.TenantId, objectId, "Application".Equals(incidentRequestData.ResponderType, StringComparison.OrdinalIgnoreCase)); var responderCall = await this.MakeCallAsync(makeCallRequestData, scenarioId).ConfigureAwait(false); this.AddCallToHandlers(responderCall, new IncidentCallContext(IncidentCallType.ResponderNotification, incidentId)); } return(botMeetingCall); }
/// <summary> /// Initializes a new instance of the <see cref="MeetingCallHandler"/> class. /// </summary> /// <param name="bot">The bot.</param> /// <param name="call">The call.</param> /// <param name="statusData">The incident status data.</param> public MeetingCallHandler(Bot bot, ICall call, IncidentStatusData statusData) : base(bot, call) { this.statusData = statusData; this.statusData?.UpdateBotMeetingCallId(call.Id, call.ScenarioId); }
/// <summary> /// Unknown Visitor incident. /// </summary> /// <param name="incidentRequestData">The incident data.</param> /// <returns>The task for await.</returns> public async Task <ICall> CallUnknownVisitorAsync(IncidentRequestData incidentRequestData) { // A tracking id for logging purposes. Helps identify this call in logs. var scenarioId = string.IsNullOrEmpty(incidentRequestData.ScenarioId) ? Guid.NewGuid() : new Guid(incidentRequestData.ScenarioId); string incidentId = Guid.NewGuid().ToString(); var incidentStatusData = new IncidentStatusData(incidentId, incidentRequestData); var incident = this.IncidentStatusManager.AddIncident(incidentId, incidentStatusData); var receptionObjectId = incidentRequestData.ObjectIds.First(); // call the receptionist var buildingObjectId = incidentRequestData.ObjectIds.Last(); // call the building var receptionTarget = new ParticipantInfo { Identity = new IdentitySet { User = new Identity { Id = receptionObjectId, }, }, }; var buildingTarget = new ParticipantInfo { Identity = new IdentitySet { User = new Identity { Id = buildingObjectId, }, }, }; var call = new Call { Targets = new[] { receptionTarget }, MediaConfig = new ServiceHostedMediaConfig { }, RequestedModalities = new List <Modality> { Modality.Video }, TenantId = incidentRequestData.TenantId, }; // call the receptionist var statefulCall = await this.Client.Calls().AddAsync(call, scenarioId: scenarioId).ConfigureAwait(false); // add the building var addParticipantRequestData = new AddParticipantRequestData() { ObjectId = buildingObjectId, }; await this.MyAddParticipantAsync(statefulCall.Id, addParticipantRequestData).ConfigureAwait(false); this.graphLogger.Info($"Call creation complete: {statefulCall.Id}"); // return botMeetingCall; return(null); }
/// <summary> /// Initializes a new instance of the <see cref="ResponderCallHandler"/> class. /// </summary> /// <param name="bot">The bot.</param> /// <param name="call">The call.</param> /// <param name="responderId">The responder id.</param> /// <param name="statusData">The incident status data.</param> public ResponderCallHandler(Bot bot, ICall call, string responderId, IncidentStatusData statusData) : base(bot, call) { this.responderId = responderId; this.statusData = statusData; this.statusData?.UpdateResponderNotificationCallId(this.responderId, call.Id, call.ScenarioId); }