Pages Menu
TwitterRssFacebook

Posted by on Sep 23, 2020 in Development, Microsoft Teams

Azure Communication Services: what it is, how you use it, and why it’s AMAZING!

Azure Communication Services: what it is, how you use it, and why it’s AMAZING!

Microsoft publicly took the wraps of Azure Communication Services at Microsoft Ignite 2020. It was in the keynote sessions, and there was a session dedicated to it. Here’s what I found interesting from the session Innovate with Azure Communication Services, delivered by Mary Anne Noskowski and Bob Serr.

What is Azure Communication Services

At a high-level, it’s a new Azure service, built on top of the same technology stack that powers Microsoft Teams. It gives developers an easy way to enable video, voice and chat services in their applications (including screen sharing). Because it uses the same stack as Teams, you can be confident it’s enterprise-grade and ready for scale. It can be used on apps, websites and mobile devices.

“it’s a new developer platform to plug directly into the underlying tech that powers Teams. That’s pretty exciting.”

Essentially, it’s a new developer platform to plug directly into the underlying tech that powers Teams. That’s pretty exciting.

4 Communication Services

There are 4 main ways to use Azure Communication Services: Phone Number, SMS Text Messaging, Voice and Video over IP, and Group Meetings and Chat:

What I found really interesting, was that Azure Communications Service was presented as being the layer that directly powers Teams, rather than something alongside it which uses the same technology. This means that developer-created applications have direct parity with Microsoft Teams, not a restricted access set. It should also give confidence around compliance and security for organisations that have already signed off on using Microsoft Teams:

How do you set it up & get started with Azure Communication Services?

You can now add a Communication Services resource from the Azure Portal:

When you do, you’ll be asked to provide a Resource Group and a Name. That’s it! it’s important to know that right now you only select United States as the data location:

Just like any other Azure resource, once it’s created I’m taken to the familiar management interface:

This is where I’ll be able to provision phone numbers for PSTN calls and SMS messages. This is coming on October 6th.

The Keys blade contains the Connection String information developers need to light up any ACS code.

Sending a SMS

You can use the ACS SDK to send a SMS message. It’s super simple – just a few lines of code:

const string connectionString = "YOUR_CONNECTION_STRING";
var smsClient = new SmsClient(connectionString);
var response = smsClient.Send(
from: new PhoneNumber("+1YOUR-PHONE-NUMBER"),
to: new PhoneNumber("+12222222222"),
message: "Hello <img draggable="false" data-mce-resize="false" data-mce-placeholder="1" data-wp-emoji="1" class="emoji" alt="👋🏻" src="https://s.w.org/images/core/emoji/11/svg/1f44b-1f3fb.svg">");

Or, there is even a Logic App Connector you can use for a no-code solution:

Performing a peer-to-peer VOIP Call

Azure Communication Services has a Web SDK which uses WebRTC for any web applications. There are also native iOS and Android SDKs for a more native integration.

You can bring your own identity provider if you have one as well, by using the SDK to create an identity in the ACS environment dynamically, and issue them access tokens:

Response&lt;CommunicationUser&gt; userResponse = await _client.CreateUserAsync();
CommunicationUser user = userResponse.Value;
Response&lt;CommunicationUserToken&gt; tokenResponse = await _client.IssueTokenAsync(user, scopes: new[] { CommunicationTokenScope.VoIP });
string token = tokenResponse.Value.Token;
return this.Ok(tokenResponse);

Actually setting up and placing a call is a little involved, but by no means complicated. The SDK nicely abstracts the complicated stuff, providing nice methods like “getCameraList” or “call” and events for things like incoming calls. Setting up a web-based client for calling involves registering for incoming calls, and providing the ability to get and set devices, so there’s a bit of code, but nothing crazy. Maybe 50 lines or less.

Note – this is NOT embedding a large media control for the call you can’t change. This will give you the ability to customise every part of the calling experience! The stream is rendered for you by the SDK, you just tell it which div to render the stream into. Buttons and layout are all up to you.

Integration with other Azure components

Out of the box, ACS can integrate with other Azure resources, via Event Grid. It can be a source of Event Grid events. This is really powerful and will enable developers to build serverless applications quickly and easily.

 

You can create a subscription for a variety of events, such as SMS Received, Chat Message Received, Member added to Thread etc. and then trigger an event handler to receive these events. That might be an Azure Function, a Web Hook, an Event Hub or anything else which supports Event Grid. There’s enough information passed in the Event to enable you to re-hydrate a ACS instance on the receiving entity – meaning that if you send every new SMS message to an Azure Function, you have enough information to instantiate an ACS instance from within the Azure Function and reply! Here’s an example from the session, see how in lines 16 and 17 they’ve pulled out the botIdentity and can then use it to create a new ACS ChatClient (line 20)

What about Microsoft Teams?

There’s an obvious question that comes from all of this. What about integration into Microsoft Teams?

Basically, it’s coming, “in the next couple of months”. Not here today, but it makes so much sense that I’m sure it’s a priority for the team. From what was said in the session, it sounds like the flow will be that Microsoft Teams users will be able to connect to ACS calls, not the other way around.

Pricing

It’s important to note that Azure Communication Services is currently in Public Preview, so shouldn’t be used in production as there’s no service-level agreement. However, pricing information has been published. Cost for using ACS comes from your Azure credit. Importantly, it is NOT tied to your Microsoft Phone System credit.

Pricing is $0.004 per min, per participant that joins a ACS meeting. This price holds regardless of modality – it doesn’t matter if you use audio, video or app sharing, the cost is the same. Chat messaging is charged at $0.0008 for every chat message sent.  These prices may change so please check on the Microsoft Docs pricing scenarios page for updated information.

Sample Code

Microsoft have provided two sample applications to help you get started:

Group Calling Hero Sample

Group Chat Hero Sample

Also check out the GitHub repo for this project, as it contains all the SDK client libraries and release notes.

I’m confident that I’ll be producing some sample code myself as well, as I’m itching to try this out!

Conclusion

This is a really interesting and exciting development. It makes all sorts of things possible that just weren’t possible before. I can’t wait to try out some ideas I have for using this – it’s just the right combination of simplicity and power. I love it! Congratulations to the Azure Communication Services team for this awesome delivery.

Written by Tom Morgan

Tom is a Microsoft Teams Platform developer and Microsoft MVP who has been blogging for over a decade. Find out more.
Buy the book: Building and Developing Apps & Bots for Microsoft Teams. Now available to purchase online with free updates.

1 Comment

  1. This was an incredibly interesting article, there are clearly lots of possibilities here. Thank you for sharing!

Post a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.