简体   繁体   English

如何使用 Nexmo 服务制作语音通话网络应用程序?

[英]How to make a voice calling web app using Nexmo services?

I have been trying to make an asp.net web application which has the ability to call people on their cellphones etc. I have to use Nexmo API for the calling purpose.我一直在尝试制作一个 ASP.NET Web 应用程序,它能够通过手机等呼叫人们。我必须使用 Nexmo API 来进行呼叫。 Currently, I have implemented samples available on its website for eg.目前,我已经实现了其网站上提供的示例,例如。 https://github.com/nexmo-community/nexmo-dotnet-quickstart/blob/ASPNET/NexmoDotNetQuickStarts/Controllers/VoiceController.cs https://github.com/nexmo-community/nexmo-dotnet-quickstart/blob/ASPNET/NexmoDotNetQuickStarts/Controllers/VoiceController.cs

But none of the samples show how to make a call from a browser to lets say a cell phone number.但是没有一个示例显示如何从浏览器拨打电话以说出手机号码。 I might be following the wrong links here.我可能在这里访问了错误的链接。 Any help will be greatly appreciated here.任何帮助将不胜感激。 Edit: Below is the sample I have tried.编辑:以下是我尝试过的示例。

[HttpPost]
[Route("voice/event")]
public string Event([FromBody] dynamic type)
{
    return "Event received";
}

[HttpPost]
[Route("voice/call")]
public string MakeCall([FromUri] string to)
{
    var TO_NUMBER = to;
    var NEXMO_NUMBER = "MyNexmoNumber";

    var results = Client.Call.Do(new Call.CallCommand
    {
        to = new[]
        {
            new Call.Endpoint {
                type = "phone",
                number = TO_NUMBER
            }
        },
        from = new Call.Endpoint
        {
            type = "phone",
            number = NEXMO_NUMBER
        },
        answer_url = new[]
        {
            "https://developer.nexmo.com/ncco/tts.json"
        }
    });

    var callUUID = results.uuid;

    return callUUID;
}

Thanks in advance.提前致谢。

You need to use the Nexmo in-app voice product if you want to make voice calls from browser.如果您想从浏览器拨打语音电话,您需要使用 Nexmo 应用内语音产品。 Here's a link on how to use this , it's in vue.js but hopefully it will give you a good idea on the approach to follow. 这是一个关于如何使用它的链接,它在 vue.js 中,但希望它能让你对要遵循的方法有一个好主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM