.NET
Add a Receive Call Route
You will now provide an answer webhook so that when you receive an inbound call on your virtual number, the Vonage API platform will notify you on that webhook via an HTTP request.
The webhook will return an NCCO to Vonage containing a single stream action, which will play the audio from the file located at the STREAM_URL into the call.
For testing purposes you will use the URL: https://raw.githubusercontent.com/nexmo-community/ncco-examples/gh-pages/assets/welcome_to_nexmo.mp3
Add the following code to the VoiceController class
[HttpGet("/webhooks/answer")]
public string Answer()
{
const string STREAM_URL = "https://raw.githubusercontent.com/nexmo-community/ncco-examples/gh-pages/assets/welcome_to_nexmo.mp3";
var streamAction = new StreamAction{
StreamUrl = new string[]
{
STREAM_URL
}
};
var ncco = new Ncco(streamAction);
return ncco.ToString();
}
Play Audio into a Call with .NET
A tutorial showing you how to build an app that will play audio into a PSTN call
手順
1
Introduction to this tutorial2
Prerequisites3
Create .NET Voice Application4
Install Vonage Dotnet5
Add a Voice Controller6
Add Make Call Action7
Add a Receive Call Route8
Add a Voice View9
Set Startup Route10
Configure the ASP.NET App11
Run the .NET App12
What's Next?