/// <summary> /// Joins the call asynchronously. /// </summary> /// <param name="joinCallBody">The join call body.</param> /// <param name="incidentId">Incident Id.</param> /// <returns>The <see cref="ICall"/> that was requested to join.</returns> public async Task <ICall> JoinCallAsync(JoinCallRequestData joinCallBody, string incidentId = "") { // A tracking id for logging purposes. Helps identify this call in logs. var scenarioId = string.IsNullOrEmpty(joinCallBody.ScenarioId) ? Guid.NewGuid() : new Guid(joinCallBody.ScenarioId); Microsoft.Graph.MeetingInfo meetingInfo; ChatInfo chatInfo; (chatInfo, meetingInfo) = JoinInfo.ParseJoinURL(joinCallBody.JoinURL); var tenantId = joinCallBody.TenantId ?? (meetingInfo as OrganizerMeetingInfo)?.Organizer.GetPrimaryIdentity()?.GetTenantId(); var mediaToPrefetch = new List <MediaInfo>(); foreach (var m in this.MediaMap) { mediaToPrefetch.Add(m.Value.MediaInfo); } var joinParams = new JoinMeetingParameters(chatInfo, meetingInfo, new[] { Modality.Audio }, mediaToPrefetch) { TenantId = tenantId, }; var statefulCall = await this.Client.Calls().AddAsync(joinParams, scenarioId).ConfigureAwait(false); this.AddCallToHandlers(statefulCall, "BotMeeting"); this.graphLogger.Info($"Join Call complete: {statefulCall.Id}"); return(statefulCall); }
/// <summary> /// Joins the call asynchronously. /// </summary> /// <param name="joinCallBody">The join call body.</param> /// <returns>The <see cref="ICall" /> that was requested to join.</returns> public async Task <ICall> JoinCallAsync(JoinCallBody joinCallBody) { // A tracking id for logging purposes. Helps identify this call in logs. var scenarioId = Guid.NewGuid(); var(chatInfo, meetingInfo) = JoinInfo.ParseJoinURL(joinCallBody.JoinURL); var tenantId = (meetingInfo as OrganizerMeetingInfo).Organizer.GetPrimaryIdentity().GetTenantId(); var mediaSession = this.CreateLocalMediaSession(); var joinParams = new JoinMeetingParameters(chatInfo, meetingInfo, mediaSession) { TenantId = tenantId, }; if (!string.IsNullOrWhiteSpace(joinCallBody.DisplayName)) { // Teams client does not allow changing of ones own display name. // If display name is specified, we join as anonymous (guest) user // with the specified display name. This will put bot into lobby // unless lobby bypass is disabled. joinParams.GuestIdentity = new Identity { Id = Guid.NewGuid().ToString(), DisplayName = joinCallBody.DisplayName, }; } var statefulCall = await this.Client.Calls().AddAsync(joinParams, scenarioId).ConfigureAwait(false); statefulCall.GraphLogger.Info($"Call creation complete: {statefulCall.Id}"); return(statefulCall); }
/// <summary> /// Joins the call asynchronously. /// </summary> /// <param name="joinCallBody">The join call body.</param> /// <returns>The <see cref="ICall"/> that was requested to join.</returns> public async Task <ICall> JoinCallAsync(JoinCallController.JoinCallBody joinCallBody) { // A tracking id for logging purposes. Helps identify this call in logs. var correlationId = Guid.NewGuid(); MeetingInfo meetingInfo; ChatInfo chatInfo; if (!string.IsNullOrWhiteSpace(joinCallBody.MeetingId)) { // Meeting id is a cloud-video-interop numeric meeting id. var onlineMeeting = await this.OnlineMeetings .GetOnlineMeetingAsync(joinCallBody.TenantId, joinCallBody.MeetingId, correlationId) .ConfigureAwait(false); meetingInfo = new OrganizerMeetingInfo { Organizer = onlineMeeting.Participants.Organizer.Identity, }; chatInfo = onlineMeeting.ChatInfo; //// meetingInfo.AllowConversationWithoutHost = joinCallBody.AllowConversationWithoutHost; } else { (chatInfo, meetingInfo) = JoinInfo.ParseJoinURL(joinCallBody.JoinURL); } var tenantId = joinCallBody.TenantId ?? (meetingInfo as OrganizerMeetingInfo)?.Organizer.GetPrimaryIdentity()?.GetTenantId(); ILocalMediaSession mediaSession = this.CreateLocalMediaSession(); var joinParams = new JoinMeetingParameters(chatInfo, meetingInfo, mediaSession) { RemoveFromDefaultAudioRoutingGroup = joinCallBody.RemoveFromDefaultRoutingGroup, TenantId = tenantId, CorrelationId = correlationId, }; if (!string.IsNullOrWhiteSpace(joinCallBody.DisplayName)) { // Teams client does not allow changing of ones own display name. // If display name is specified, we join as anonymous (guest) user // with the specified display name. This will put bot into lobby // unless lobby bypass is disabled. joinParams.GuestIdentity = new Identity { Id = Guid.NewGuid().ToString(), DisplayName = joinCallBody.DisplayName, }; } var statefulCall = await this.Client.Calls().AddAsync(joinParams).ConfigureAwait(false); this.logger.Info($"Call creation complete: {statefulCall.Id}"); return(statefulCall); }
/// <summary> /// Joins the call asynchronously. /// </summary> /// <param name="joinCallBody">The join call body.</param> /// <param name="incidentId">Incident Id.</param> /// <returns>The <see cref="ICall"/> that was requested to join.</returns> public async Task <ICall> JoinCallAsync(JoinCallRequestData joinCallBody, string incidentId = "") { // A tracking id for logging purposes. Helps identify this call in logs. var correlationId = string.IsNullOrEmpty(joinCallBody.CorrelationId) ? Guid.NewGuid() : new Guid(joinCallBody.CorrelationId); Microsoft.Graph.MeetingInfo meetingInfo; ChatInfo chatInfo; if (!string.IsNullOrWhiteSpace(joinCallBody.MeetingId)) { // Meeting id is a cloud-video-interop numeric meeting id. var onlineMeeting = await this.OnlineMeetings .GetOnlineMeetingAsync(joinCallBody.TenantId, joinCallBody.MeetingId, correlationId) .ConfigureAwait(false); meetingInfo = new OrganizerMeetingInfo { Organizer = onlineMeeting.Participants.Organizer.Identity, }; meetingInfo.AllowConversationWithoutHost = joinCallBody.AllowConversationWithoutHost; chatInfo = onlineMeeting.ChatInfo; } else { (chatInfo, meetingInfo) = JoinInfo.ParseJoinURL(joinCallBody.JoinURL); meetingInfo.AllowConversationWithoutHost = joinCallBody.AllowConversationWithoutHost; } var tenantId = joinCallBody.TenantId ?? (meetingInfo as OrganizerMeetingInfo)?.Organizer.GetPrimaryIdentity()?.GetTenantId(); var mediaToPrefetch = new List <MediaInfo>(); foreach (var m in this.MediaMap) { mediaToPrefetch.Add(m.Value.MediaInfo); } var joinParams = new JoinMeetingParameters(chatInfo, meetingInfo, new[] { Modality.Audio }, mediaToPrefetch) { RemoveFromDefaultAudioRoutingGroup = joinCallBody.RemoveFromDefaultRoutingGroup, TenantId = tenantId, CorrelationId = correlationId, }; var statefulCall = await this.Client.Calls().AddAsync(joinParams).ConfigureAwait(false); this.AddCallToHandlers(statefulCall, new IncidentCallContext(IncidentCallType.BotMeeting, incidentId)); this.graphLogger.Info($"Join Call complete: {statefulCall.Id}"); return(statefulCall); }
/// <summary> /// Joins the call asynchronously. /// </summary> /// <param name="joinCallBody">The join call body.</param> /// <returns>The <see cref="ICall"/> that was requested to join.</returns> public async Task <ICall> JoinCallAsync(JoinCallController.JoinCallBody joinCallBody) { // A tracking id for logging purposes. Helps identify this call in logs. var correlationId = Guid.NewGuid(); MeetingInfo meetingInfo; ChatInfo chatInfo; if (!string.IsNullOrWhiteSpace(joinCallBody.MeetingId)) { var onlineMeeting = await this.OnlineMeetings .GetOnlineMeetingAsync(joinCallBody.TenantId, joinCallBody.MeetingId, correlationId) .ConfigureAwait(false); meetingInfo = onlineMeeting.MeetingInfo; chatInfo = onlineMeeting.ChatInfo; } else { (chatInfo, meetingInfo) = JoinInfo.ParseJoinURL(joinCallBody.JoinURL); } var mediaSession = this.CreateLocalMediaSession(correlationId); var joinCallParameters = new JoinMeetingParameters( chatInfo, meetingInfo, mediaSession) { TenantId = joinCallBody.TenantId, CorrelationId = correlationId, }; if (!string.IsNullOrWhiteSpace(joinCallBody.DisplayName)) { // Teams client does not allow changing of ones own display name. // If display name is specified, we join as anonymous (guest) user // with the specified display name. This will put bot into lobby // unless lobby bypass is disabled. joinCallParameters.GuestIdentity = new Identity { Id = Guid.NewGuid().ToString(), DisplayName = joinCallBody.DisplayName, }; } var statefulCall = await this.Client.Calls().AddAsync(joinCallParameters).ConfigureAwait(false); statefulCall.GraphLogger.Info($"Call creation complete: {statefulCall.Id}"); return(statefulCall); }
/// <summary> /// Joins the call asynchronously. /// </summary> /// <param name="joinCallBody">The join call body.</param> /// <param name="incidentId">Incident Id.</param> /// <returns>The <see cref="ICall"/> that was requested to join.</returns> public async Task <ICall> JoinCallAsync(JoinCallRequestData joinCallBody, string incidentId = "") { // A tracking id for logging purposes. Helps identify this call in logs. var scenarioId = string.IsNullOrEmpty(joinCallBody.ScenarioId) ? Guid.NewGuid() : new Guid(joinCallBody.ScenarioId); MeetingInfo meetingInfo; ChatInfo chatInfo; if (!string.IsNullOrWhiteSpace(joinCallBody.VideoTeleconferenceId)) { // Meeting id is a cloud-video-interop numeric meeting id. var onlineMeeting = await OnlineMeetings .GetOnlineMeetingAsync(joinCallBody.TenantId, joinCallBody.VideoTeleconferenceId, scenarioId) .ConfigureAwait(false); meetingInfo = new OrganizerMeetingInfo { Organizer = onlineMeeting.Participants.Organizer.Identity, }; chatInfo = onlineMeeting.ChatInfo; } else { (chatInfo, meetingInfo) = JoinInfo.ParseJoinURL(joinCallBody.JoinUrl); } var tenantId = joinCallBody.TenantId ?? (meetingInfo as OrganizerMeetingInfo)?.Organizer.GetPrimaryIdentity()?.GetTenantId(); var mediaToPrefetch = new List <MediaInfo>(); foreach (var m in MediaMap) { mediaToPrefetch.Add(m.Value.MediaInfo); } var joinParams = new JoinMeetingParameters(chatInfo, meetingInfo, new[] { Modality.Audio }, mediaToPrefetch) { TenantId = tenantId, }; var statefulCall = await Client.Calls().AddAsync(joinParams, scenarioId).ConfigureAwait(false); AddCallToHandlers(statefulCall, new IncidentCallContext(IncidentCallType.BotMeeting, incidentId)); graphLogger.Info($"Join Call complete: {statefulCall.Id}"); return(statefulCall); }