MS Teams application-hosted calling bot: Bot disconnects from the Teams call when amount of users with enabled video more than 8

Alexey Doronin 1 Reputation point
2020-10-15T09:20:04.49+00:00

Hi all,
We are using Microsoft Calling Bot Framework based on the sample https://github.com/microsoftgraph/microsoft-graph-comms-samples (AudioVideoPlaybackBot). Bot handles the MS Teams call, retrieves audio and video streams and restream that data to external application for real-time processing. Everything was Ok while the moment we had tested our app with few users. When the amount of simultaneously connected to the same Teams call users with enabled video camera more than 8, then bot disconnects from the call. It seems that the problem related to video sockets because without video everything is ok.
We tried to subscribe only to current participant video when OnDominantSpeakerChanged notification is got and unsubscribe from previous speaker video and therefore using only 1 video socket but that didn’t help.

private void OnDominantSpeakerChanged(object sender, DominantSpeakerChangedEventArgs e)
        {
            this.GraphLogger.Error($"[{this.Call.Id}:OnDominantSpeakerChanged(DominantSpeaker={e.CurrentDominantSpeaker}, LastSpeaker = {e.DominantSpeakerHistory.LastOrDefault()})]");

            if (e.CurrentDominantSpeaker != DominantSpeakerNone)
            {
                IParticipant participant = this.GetParticipantFromMSI(e.CurrentDominantSpeaker);
                var participantDetails = participant?.Resource?.Info?.Identity?.User;

                var oldParticipantMsi = e.DominantSpeakerHistory.LastOrDefault();
                IParticipant oldParticipant = this.GetParticipantFromMSI(oldParticipantMsi);


                GraphLogger.Log(TraceLevel.Info, $"OnDominantSpeakerChanged.  participant?.Resource?.Info?.Identity?.User?.Id is {participantDetails?.Id}. oldParticipantUserId is {oldParticipant?.Resource?.Info?.Identity?.User?.Id}");
                if (participantDetails != null && participantDetails?.Id != _currentUserId)
                {
                    _currentUserId = participant?.Resource?.Info?.Identity?.User?.Id;
                    // we want to force the video subscription on dominant speaker events
                    this.SubscribeToParticipantVideo(participant, forceSubscribe: true);
                    GraphLogger.Log(TraceLevel.Info, $"OnDominantSpeakerChanged. UnsubscribeFromParticipantVideo. oldParticipantMsi = {oldParticipantMsi}, e.CurrentDominantSpeaker = {e.CurrentDominantSpeaker}");

                    if (oldParticipant != default && oldParticipantMsi != e.CurrentDominantSpeaker)
                    {
                        GraphLogger.Log(TraceLevel.Info,$"OnDominantSpeakerChanged. UnsubscribeFromParticipantVideo. ");
                        this.UnsubscribeFromParticipantVideo(oldParticipant);
                    }
                }
            }
        }

We are expecting that the bot will not disconnect from the call with more than 8 users with enabled video. Also, we need only one video stream from the current dominant speaker. Logs didn't show any errors or exceptions before bot disconnected.

Logs didn't show any errors or exceptions while the bot disconnecting. He just disconnected without any log message.

Does the constraint of the 8 video streams relate to the Bot Framework? Or we did some mistakes in the code? It’s very important for us because that problem is stopping us from going to production. Please let me know if it needs more details. Thank you!

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
745 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,838 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Trinetra-MSFT 111 Reputation points
    2020-10-16T09:03:36.937+00:00

    @Alexey Doronin , For audio and video call the limit is 20 let me confirm this with our engineering team if we have any limitations for videos in calling and meeting bots


  2. Alexey Doronin 1 Reputation point
    2020-10-21T19:00:54.17+00:00

    @TrinetraKumarZen3InfosolutionsPriv-1469 Thank you for the answer! We already have modified our solution to keep 40 users per call (we have tested on this count but I 90% pretty sure that it will work for any users count). We assume that 20/10 users limitation related to the available video sockets but we found the solution that uses only 1 video socket for any call regardless of the count of users.

    0 comments No comments