/// <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> /// <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); }