@Ramakrishna Samanta Thanks for asking question!
Remote participants in a call are represented by the RemoteParticipant
type. These participants can be accessed through the remoteParticipants
collection in a call instance.
Listing Participants in a Call:
To retrieve the list of remote participants in a call, use the getRemoteParticipants
method on the call instance. This method returns a list of RemoteParticipant
objects.
List<RemoteParticipant> remoteParticipants = call.getRemoteParticipants(); // [remoteParticipant, remoteParticipant....]
This code snippet fetches all remote participants in the call and stores them in a list.
Adding a Participant to a Call-
To add a new participant to a call, whether it's a user or a phone number, use the addParticipant
method. This method will synchronously return the instance of the newly added remote participant.
- Adding participant and Phone Number-
Here, a user identified by their Azure Communication Services (ACS) user ID is added to the call. In this example, a participant is added to the call using a phone number. Additional options can be specified usingconst acsUser = new CommunicationUserIdentifier("<acs user id>"); const acsPhone = new PhoneNumberIdentifier("<phone number>"); RemoteParticipant remoteParticipant1 = call.addParticipant(acsUser); AddPhoneNumberOptions addPhoneNumberOptions = new AddPhoneNumberOptions(new PhoneNumberIdentifier("<alternate phone number>")); RemoteParticipant remoteParticipant2 = call.addParticipant(acsPhone, addPhoneNumberOptions);
AddPhoneNumberOptions
.
Hope this helps, please let us know if issue remains!