Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article, you learn how users that joined Teams meetings or Room can learn the currently assigned role and manage role change.
Prerequisites
- An Azure account with an active subscription. Create an account for free.
- A deployed Communication Services resource. Create a Communication Services resource.
- A user access token to enable the calling client. For more information, see Create and manage access tokens.
- Optional: Complete the quickstart to add voice calling to your application.
Join Teams meeting
The following code describes how to create CallClient
and CallAgent
, which are necessary for the next steps. Then we join the Teams meeting, which creates a Call
instance.
const { CallClient } = require('@azure/communication-calling');
const { AzureCommunicationTokenCredential} = require('@azure/communication-common');
const userToken = '<USER_TOKEN>';
callClient = new CallClient();
const tokenCredential = new AzureCommunicationTokenCredential(userToken);
const callAgent = await callClient.createCallAgent(tokenCredential);
const deviceManager = await callClient.getDeviceManager();
const meetingCall = callAgent.join({ meetingLink: '<MEETING_LINK>' });
Learn the current role
You create a Call
instance when you join the Teams meeting or Room with calling SDK. This object has a property role
that can have one of the following values:
- Unknown
- Attendee
- Presenter
- Organizer
- Consumer
- Collaborator
For more information about the roles and capabilities in Rooms, see Rooms API for structured meetings.
const role = meetingCall.role;
Note
Collaborator is only available for Azure Communication Services Calling Web SDK.
Subscribe to role changes
During the Teams meeting or Room, your role can be changed. To learn about the change, subscribe to an event, roleChanged
, on the Call
object.
meetingCall.on('roleChanged', args => {
role = meetingCall.role;
// Update UI
}