Skip to content

Latest commit

 

History

History
104 lines (82 loc) · 5.83 KB

File metadata and controls

104 lines (82 loc) · 5.83 KB

Azure Communication Rooms client library for .NET

This package contains a C# SDK for the Rooms Service of Azure Communication Services.

Rooms overview Azure Communication Services (ACS) Rooms is a set of APIs, used by Contoso server applications to create a server-managed conversation space with fixed set of lifetime and participants, pre-defining rules from server-tier both who and when can communicate (like scheduled meeting creation).

With the Public Preview release of ACS Rooms, Contoso will be able to: create a meeting space with known time coordinates (start/end time), join voice/video calls within that meeting space using the ACS web calling SDK or native mobile calling SDKs, add participants to a room, assign pre-defined roles to room participants, set rooms call join policies (e.g., open or closed room), and consume Event Grid notifications for calling events. The server-side functionalities can be accessed via a refreshed API and a full set of SDKs (.NET, Java, Python, JavaScript/TypeScript).

The main scenarios where Rooms can best be used: Virtual Visits (e.g., telemedicine, remote financial advisor, virtual classroom, etc...) Virtual Events (e.g., live event, company all-hands, live concert, etc...) Champion scenarios

[Source code][source] | [Package (NuGet)][package] | Product documentation

Getting started

Install the package

Install the Azure Communication Rooms client library for .NET with NuGet:

dotnet add package Azure.Communication.Rooms --prerelease

Prerequisites

You need an Azure subscription and a Communication Service Resource to use this package.

To create a new Communication Service, you can use the Azure Portal, the Azure PowerShell, or the .NET management client library.

Key concepts

RoomsClient provides the functionality to create room, update room, get room, delete room, add participants, remove participant, update participant and get participants.

Using statements

using Azure.Communication.Rooms

Authenticate the client

Rooms clients can be authenticated using the connection string acquired from an Azure Communication Resource in the Azure Portal.

var connectionString = Environment.GetEnvironmentVariable("connection_string") // Find your Communication Services resource in the Azure portal
RoomsClient client = new RoomsClient(connectionString);

Examples

The following sections provide several code snippets covering some of the most common tasks, which is available at Sample1_RoomsRequests.md

Troubleshooting

Service Responses

A RequestFailedException is thrown as a service response for any unsuccessful requests. The exception contains information about what response code was returned from the service.

try
{
    CommunicationIdentityClient communicationIdentityClient = CreateInstrumentedCommunicationIdentityClient();
    var communicationUser1 = communicationIdentityClient.CreateUserAsync().Result.Value.Id;
    var communicationUser2 = communicationIdentityClient.CreateUserAsync().Result.Value.Id;
    var validFrom = DateTime.UtcNow;
    var validUntil = validFrom.AddDays(1);
    List<RoomParticipant> createRoomParticipants = new List<RoomParticipant>();
    RoomParticipant participant1 = new RoomParticipant(new CommunicationUserIdentifier(communicationUser1), RoleType.Presenter);
    RoomParticipant participant2 = new RoomParticipant(new CommunicationUserIdentifier(communicationUser2), RoleType.Attendee);
    Response<CommunicationRoom> createRoomResponse = await roomsClient.CreateRoomAsync(validFrom, validUntil, RoomJoinPolicy.InviteOnly, createRoomParticipants);
    CommunicationRoom createRoomResult = createRoomResponse.Value;
}
catch (RequestFailedException ex)
{
    Console.WriteLine(ex.Message);
}

Next steps

  • [Read more about Rooms in Azure Communication Services][nextsteps]

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit cla.microsoft.com.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Update the sample code links once the sdk is published