【发布时间】:2019-02-25 18:13:00
【问题描述】:
我正在尝试使用我的 Twilio“测试”凭据通过 Twilio 测试我的出站呼叫。这是一个 ASP.NET MVC 4 Web 应用程序,它托管 Twilio 的端点。由于我在本地主机上运行,它们将通过 ngrok(路由到本地主机的公共端点)命中。
我在 twilio 中配置了一个 [toll-free] 电话号码,语音请求路由到我的 ngrok url。
当我尝试在我的网络应用程序中执行我的测试出站呼叫时,我导航到一个测试控制器。它会触发一些最终执行的代码:
var call = _client.InitiateOutboundCall(
new CallOptions
{
From = "+1" + _fromPhone, // twilio toll-free phone number with base site/ngrok url configured, ie http://{ngrokcode}.ngrok.io
To = "+1" + phoneNumber, // phone that I want to "answer" and listen to the message
Url = url, // ngrok url that points to my localhost endpoint to play message, ie http://{ngrokcode}.ngrok.io/message/{forCustomerId}
IfMachine = "Continue"
});
在这次通话中,“_fromPhone”是我在 twilio 中购买/配置的电话号码,免费电话号码,它是路由到我的 ngrok url 的电话号码。
“phoneNumber”是我要拨打的电话
“url”是我希望 twilio 命中的端点,因此它可以向收件人“说出”消息。
但是,使用这些测试凭据,电话永远不会中断。我不小心运行了同样的东西,但是使用生产凭据,电话确实出去了(并开始在我的手机上响起),但是当我接听时,它沉默了大约 15 秒,然后它终于说 twilio 遇到了一个错误。
查看意外生产调用的日志,它说它无法连接到我的 [ngrok] url。
那么,两个问题,为什么在使用我的测试凭据时电话没有被执行?而且,如果/当电话响起时,它为什么不执行/点击包含我的“说”动词的端点?
【问题讨论】:
-
您的 ngrok 端点是否自行工作?