DEV Community

Cover image for Making Phone Calls from Blazor WebAssembly with Twilio Voice
Niels Swimburger.NET 🍔
Niels Swimburger.NET 🍔

Posted on • Originally published at on

Making Phone Calls from Blazor WebAssembly with Twilio Voice

Mobile phones are ubiquitous and convenient but there are times when it’s more practical to be able to receive and place phone calls from a computer. If you’ve called customer service about the tickets you ordered, or anything else, it’s likely the rep you spoke to took your call with a mouse click.

Using Twilio Voice you can add the ability to make and receive phone calls from your own ASP.NET web applications. Twilio’s helper library for JavaScript makes it easy to integrate client functionality into web front ends built with Blazor WebAssembly, and the Twilio NuGet packages provide you with convenient interfaces to Twilio’s APIs for server-side tasks.

Blazor WebAssembly lets you build your application front end in C# and Razor, so you can focus the client-side JavaScript on functionality that requires JavaScript for implementation.

JavaScript interoperability (JS interop) is a feature of Blazor that makes it easy to call JavaScript APIs and libraries from your C# code.

Both these technologies are built on .NET Standard, so they’re available in both ASP.NET Core 3.1 and ASP.NET Core in .NET 5.0.

In this post you’ll learn how to build a web application for making and receiving voice calls using these technologies. You’ll see how to integrate a Blazor component with the Twilio Client JS SDK and how to route Twilio calls using ASP.NET Core WebAPI. You’ll also learn how to use TwiML™ (the Twi lio M arkup L anguage) to tell Twilio what to do when a call comes into a Twilio phone number.

The tutorial in this post contains the complete source code and it’s provided under an MIT license so you can incorporate it into your own project.

Continue reading at the Twilio blog: Making Phone Calls from Blazor WebAssembly with Twilio Voice

Discussion (0)