iOS Nexmo SDK 在应用语音自定义应答 url 中拨打电话号码

h.w*_*ers 0 ios nexmo swift

我正在关注 Nexmo 文档here我再也找不到 iOS 文档(神秘地) 特别是文档讨论了它所说的答案 URL

您需要将 CALLEE_PHONE_NUMBER 替换为要呼叫的号码。但最终,实际调用的号码是 Answer URL webhook 中提供的号码。在实际用例中,您将创建一个服务器组件作为应答 URL。该应用程序将通过应答 URL CALLEE_PHONE_NUMBER 发送到您的后端,后端将对其进行验证,然后在返回的 JSON 中提供它。

注意:您创建的要点特定于本教程。在实际场景中,答案 URL 应由专门构建的 Web 解决方案提供。您的后端应该提供可以为自定义 NCCO 提供服务的服务,并且在这种情况下,接收并验证从应用程序拨打的电话号码。```

所以我创建了我的自定义后端,它接受一个?to返回有效 json的参数,如下所示: GET https://mycustomurl.herokuapp.com/hello?to=18052425555

[{"action":"talk","text":"Please wait while we connect you."},{"action":"connect","timeout":20,"from":"14697938019","endpoint":{"type":"phone","number":"18052425555"}}]

我像这样将自定义 url 放入我的应用程序中的仪表板中...... https://mycustomurl.herokuapp.com/我还尝试了许多其他变体,如完整路径 /hello 等。

当我从我的应用程序发出呼叫时......我如何引用这个端点?参数是自动to的吗(nexmo 支持人员告诉我的)?我传递网址了吗?

我已经尝试了所有这些组合:

client.call("https://mycustomurl.herokuapp.com/hello?to=18052428083", callHandler: .server)
client.call("hello?to=18052428083", callHandler: .server)
client.call("18052428083", callHandler: .server)
Run Code Online (Sandbox Code Playgroud)

我无法让它工作,也无法在文档中找到有关如何使用自定义后端答案 url 的任何内容。任何帮助,将不胜感激。

abd*_*jet 6

我们移动了一些东西,很抱歉重定向不起作用。这是从应用程序拨打电话分步教程

您的自定义 url 不需要任何参数,但您需要更新仪表板以使用https://mycustomurl.herokuapp.com/hello.

In the app, you call client.call("44000000000", callHandler: .server) which will make a GET request to your custom url. The request made to the custom url will have a JSON object in its query which would like like this:

{
  to: '44000000000',
  from_user: 'Alice',
  conversation_uuid: 'CON-7a15150b-121d-42b7-91eb-23ccefdcbf5e',
  uuid: 'NONE'
}
Run Code Online (Sandbox Code Playgroud)

The to value in the JSON object will be the number provided in the app. You can use this to fill out the NCCO that you would return, for example:

[
    {
        "action": "talk",
        "text": "Please wait while we connect you."
    },
    {
        "action": "connect",
        "endpoint": [
            {
                "type": "phone",
                "from": request.body.from_user
                "number": request.body.to
            }
        ]
    }
]
Run Code Online (Sandbox Code Playgroud)