1. Vonage Learn
  2. Blog
  3. 2019
  4. 05
  5. 16
  6. Build a Conference Call With Nexmo Voice Api and Csharp Dr
Build a Conference Call with the Nexmo Voice API and ASP.NET Core

< Tutorial />

Build a Conference Call with the Nexmo Voice API and ASP.NET Core

This is the sixth tutorial on how to use Voice APIs with ASP.NET series._ In the previous tutorial, we learnt how to forward a call via voice proxy with ASP.NET Core. In today's tutorial, we will learn how to setup a conference call so multiple people can join the same call.

Learning objectives

In this tutorial, we will:

  • Create an ASP.NET Core app.
  • Use NancyFX with ASP.NET Core.
  • Create a Nexmo voice application.
  • Create and return NCCOs.
  • Run and test the code using Ngrok.


  • Visual Studio 2017 or higher.
  • A project setup for this tutorial series, which you can find on Github.
  • Optional: The Nexmo CLI.


To use The Nexmo Voice API, we need to create a voice application.

The configuration steps are detailed in the Nexmo Voice API with ASP.NET: Before you start post.

Once the configuration is done successfully, we can move on to setting up a conference call.

Building a Conference Call

When a user calls the Nexmo number, the Nexmo Voice API will make a request to the application to figure out how to respond using a Nexmo Call Control Object (NCCO).

The user will be greeted then will join the conference call.

For that purpose, we are going to use NancyFX along side our ASP.NET Core project.

First of all, we need to add Nancy to our project :

PM> Install-Package Nancy
PM> Install-Package Microsoft.AspNetCore.Owin

To allow Nancy to handle any HTTP requests, we need to tell ASP.NET Core to use Nancy via Owin in the Configure method of Startup.cs.

using Microsoft.AspNetCore.Builder;
using Nancy.Owin;

namespace NexmoVoiceASPNetCoreQuickStarts
    public class Startup
        public void Configure(IApplicationBuilder app)
            app.UseOwin(x => x.UseNancy());

The next step is to create a Nancy module in which we setup a route to /webhook/answer which will respond with the ncco returned by GetConferenceCallNCCO()

using Nancy;
using Newtonsoft.Json.Linq;

namespace NexmoVoiceASPNetCoreQuickStarts.Modules
    public class ConferenceCallModule : NancyModule
        public ConferenceCallModule()
            Get["/webhook/answer/"] = x => GetConferenceCallNCCO();
            Post["/webhook/event"] = x => Request.Query["status"];

        private dynamic GetConferenceCallNCCO()
            dynamic TalkNCCO = new JObject();
            TalkNCCO.action = "talk";
            TalkNCCO.text = "Hello. You will now be added to the conference call.";
            TalkNCCO.voiceName = "Emma";

            dynamic ConferenceNCCO = new JObject();
            ConferenceNCCO.action = "conversation";
            ConferenceNCCO.name = "conference-call";

            JArray nccoObj = new JArray

            return nccoObj.ToString();

The above code will do the following:

When a call is received, the user will hear "Hello. You will now be added to the conference call." then they will be added to the conference call.

Multiple callers can be added to the conference until they all have disconnected.

We are done! To test this sample app, some more configuration steps are required.

Linking Your App to Nexmo

If you've been following along so far, you've already configured your Nexmo account and created a voice app as shown in this post. We need to link this app to a the Nexmo phone number that we are going to call.

If you don't have a number, you can purchase one using the dashboard or the by using the Nexmo CLI:

nexmo number:buy --country_code US

Similarly to link the number, you can use the dashboard or the CLI:


We need to tell Nexmo which URL to make a request to when a call is received - this is called the answer_url. For me, this url is http://localhost:63286/webhook/answer and that's only running locally.

To expose our webhook answer url, we will use Ngrok.

ngrok http 63286 

We now have a new url (mine is http://.ngrok.io) that can be used as the answer_url for the voice application.

Update your application with your new answer_url. It should look like http://subdomain.ngrok.io/webhook/answer. Run the app and give it a go by calling the TO_NUMBER.

Learn more

API References and Tools

Nexmo Getting Started Guides for ASP.NET

Comments currently disabled.