ACS - Rooms - Unauthorized AND Forbidden

Alexandre Gurgel 60 Reputation points
2024-04-17T15:35:15.7166667+00:00

I have a context with 6 participants, all attendees. I can see the webcam feeds of everyone after calling callAgent.join(). However, I don't have the audio, even after adding the audioStream track to be used. Does callAgent.startCall() exclusively handle the audio?

I see that the audioLocal track is recognized; I insert it in the .join(<here>), should I insert it somewhere else? However, in the call.on("changedParticipant") I only receive mediaStream with the video. I also want to use the audio.


Even though I can see the participants' webcams, I'm receiving the following errors, especially when making a callAgent.startCall():

GET https://auth.relay.communication.microsoft.com/tokens 401 (Unauthorized)
POST https://api.flightproxy.skype.com/api/v2/cpconv 403 (Forbidden)

P.S.: The user token is correctly generated in my Azure Function and sent to the front end. Could you assist me with this?

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
680 questions
0 comments No comments
{count} votes

Accepted answer
  1. Grmacjon-MSFT 16,011 Reputation points
    2024-04-17T23:13:29.5+00:00

    @Alexandre Gurgel thanks for the question.

    1. To answer your first question, yes the callAgent.join() method should handle both audio and video streams. If you’re not getting audio, it could be due to a variety of reasons. It might be a problem with the audio device, or it could be that the audio stream is not being correctly added to the call. You should ensure that the audio track is correctly initialized and added to the call.
    2. The call.on('changedParticipant') event should trigger when there’s a change in the participants of the call. If you’re only receiving the video stream in this event, it might be because the audio stream is not being correctly initialized or added to the call. Here is a sample code:
         callAgent.join({ roomId }, options)
           .then(() => callAgent.startCall([])) // Start the call after joining
           .then(() => {
             call.on('changedParticipant', (participant) => {
               const mediaStream = participant.mediaStream;
               if (mediaStream) {
                 const audioTracks = mediaStream.audioTracks; // Check for audio tracks
                 const videoTracks = mediaStream.videoTracks;
                 // Handle both audio and video tracks here
               }
             });
           })
           .catch((error) => {
             console.error('Error joining or starting call:', error);
           });
         
      

    Based on this ACS troubleshooting documentation, the 401 Unauthorized error means there is an issue with the authentication token. The token might be expired, incorrectly formatted, or not correctly attached to the request. You should ensure that the token is correctly generated in your Azure Function and correctly attached to your requests.

    The 403 Forbidden error means the server understood the request but refuses to authorize it. This status is similar to 401 (Unauthorized), but indicates that the client must authenticate itself to get the requested response. A 403 response is not a guarantee that the client will be able to access the requested resource; a server that wishes to make public why the request has been forbidden can describe that reason in the response payload

    Make sure that your user token is correctly generated and that it has the necessary permissions to perform the actions you’re trying to perform

    hope this helps! If you have any other questions, please let us know

    -Grace

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful