Skip to content

Commit d09ca3f

Browse files
committed
Address comments
1 parent a59d737 commit d09ca3f

File tree

1 file changed

+47
-3
lines changed

1 file changed

+47
-3
lines changed

articles/communication-services/how-tos/calling-sdk/lobby-admit-and-reject.md

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ms.custom: template-how-to
1414
[!INCLUDE [Install SDK](../calling-sdk/includes/install-sdk/install-sdk-web.md)]
1515
Lobby admit and reject are the apis on `Call` or `TeamsCall`. It allows user to admit and reject participants from Teams meeting lobby.
1616

17-
# Manage participants in Teams meeting Lobby
17+
# Manage Teams meeting Lobby
1818

1919
In this article, you will learn how to admit and reject participants from Microsoft Teams meetings lobby by using Azure Communication Service calling SDKs.
2020

@@ -26,7 +26,7 @@ In this article, you will learn how to admit and reject participants from Micros
2626
- Optional: Complete the quickstart to [add voice calling to your application](../../quickstarts/voice-video-calling/getting-started-with-calling.md)
2727

2828
User ends up in the lobby depending on Microsoft Teams configuration. The controls are described here:
29-
[Learn more about Teams configuration ](https://learn.microsoft.com/en-us/azure/communication-services/concepts/interop/guest/teams-administration)
29+
[Learn more about Teams configuration ](../../concepts/interop/guest/teams-administration.md)
3030

3131
Microsoft 365 or Azure Communication Services users can admit or reject users from lobby, if they are connected to Teams meeting and have Organizer, Co-organizer, or Presenter meeting role.
3232
[Learn more about meeting roles](https://support.microsoft.com/office/roles-in-a-teams-meeting-c16fa7d0-1666-4dde-8686-0a0bfe16e019)
@@ -41,15 +41,58 @@ The first thing is to get the `Call` or `TeamsCall` object of admitter: [Learn h
4141

4242
To know who is in the lobby, you could check the state of a remote participant. The `remoteParticipant` with `InLobby` state indicates that remote participant is in lobby.
4343
To get the `remoteParticipants` collection:
44+
4445
```js
45-
call.remoteParticipants; // [remoteParticipant, remoteParticipant....]
46+
let remoteParticipants = call.remoteParticipants; // [remoteParticipant, remoteParticipant....]
4647
```
48+
4749
To get the state of a remote participant:
50+
4851
```js
4952
const state = remoteParticipant.state;
5053
```
5154

55+
You could check remote participant state in subscription method:
56+
57+
```js
58+
const subscribeToRemoteParticipant = (remoteParticipant: RemoteParticipant) => {
59+
try {
60+
// Inspect the initial remoteParticipant.state value.
61+
console.log(`Remote participant state: ${remoteParticipant.state}`);
62+
if(remoteParticipant.state === 'InLobby'){
63+
console.log(`${remoteParticipant._displayName} is in the lobby`);
64+
}
65+
// Subscribe to remoteParticipant's 'stateChanged' event for value changes.
66+
remoteParticipant.on('stateChanged', () => {
67+
console.log(`Remote participant state changed: ${remoteParticipant.state}`);
68+
if(remoteParticipant.state === 'InLobby'){
69+
console.log(`${remoteParticipant._displayName} is in the lobby`);
70+
}
71+
else if(remoteParticipant.state === 'Connected'){
72+
console.log(`${remoteParticipant._displayName} is in the meeting`);
73+
}
74+
});
75+
} catch (error) {
76+
console.error(error);
77+
}
78+
}
79+
80+
call.on('remoteParticipantsUpdated', args => {
81+
args.added.forEach(p => {
82+
subscribeToRemoteParticipant(p);
83+
});
84+
args.removed.forEach(p => {
85+
console.log(`${p._displayName} leave the meeting`);
86+
});
87+
});
88+
89+
call.remoteParticipants.forEach(p => {
90+
subscribeToRemoteParticipant(p);
91+
});
92+
```
93+
5294
Before admit or reject `remoteParticipant` with `InLobby` state, you could get the identifier for a remote participant:
95+
5396
```js
5497
const identifier = remoteParticipant.identifier;
5598
```
@@ -66,6 +109,7 @@ The `identifier` can be one of the following `CommunicationIdentifier` types:
66109
To admit, reject or admit all users from the lobby, you can use the `admit`, `rejectParticipant` and `admitAll` asynchronous APIs:
67110

68111
You can admit specific user to the Teams meeting from lobby by calling the method `admit` on the object `TeamsCall` or `Call`. The method accepts identifiers `MicrosoftTeamsUserIdentifier`, `CommunicationUserIdentifier`, `PhoneNumberIdentifier` or `UnknownIdentifier` as input.
112+
69113
```js
70114
await call.admit(identifier);
71115
```

0 commit comments

Comments
 (0)