iOS Nexmo SDK 在应用语音自定义应答中呼叫 phone 号码 url
iOS Nexmo SDK call a phone number in app voice custom answer url
我正在关注 Nexmo 文档 here 我找不到 iOS 文档了(神秘)
具体来说,文档讨论了答案 URL 它说
You are expected to replace CALLEE_PHONE_NUMBER with the number to be called. But, ultimately, the number that is actually called is the one supplied in the Answer URL webhook. In a real-life use case, you would create a server component to serve as the Answer URL. The app will send to your backend, through the Answer URL the CALLEE_PHONE_NUMBER, the backend would validate it and then supply it in the JSON returned.
Note: The gist you created is specific to this tutorial. In a real-life scenario, the Answer URL should be provided by a purposely built web solution. Your backend should provide that can serve custom NCCOs and, for this case, receive and validate the phone number dialled from the app.```
所以我创建了我的自定义后端,它接受一个 ?to
参数,returns 有效 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 支持人员告诉我的)?我要传递 url 吗?
我已经尝试了所有这些组合:
client.call("https://mycustomurl.herokuapp.com/hello?to=18052428083", callHandler: .server)
client.call("hello?to=18052428083", callHandler: .server)
client.call("18052428083", callHandler: .server)
我无法让它工作,并且在文档中找不到任何关于如何使用自定义后端答案的内容 url。任何帮助将不胜感激。
我们移动了一些东西,很抱歉重定向不起作用。这里有一个step by step tutorial on making a call from the app.
您的自定义 url 不需要任何参数,但您需要更新仪表板才能使用 https://mycustomurl.herokuapp.com/hello
。
在应用程序中,您调用 client.call("44000000000", callHandler: .server)
,这将向您的自定义 url 发出 GET 请求。对自定义 url 的请求将在其查询中有一个 JSON 对象,如下所示:
{
to: '44000000000',
from_user: 'Alice',
conversation_uuid: 'CON-7a15150b-121d-42b7-91eb-23ccefdcbf5e',
uuid: 'NONE'
}
JSON 对象中的 to
值将是应用程序中提供的数字。您可以使用它来填写您想要 return 的 NCCO,例如:
[
{
"action": "talk",
"text": "Please wait while we connect you."
},
{
"action": "connect",
"endpoint": [
{
"type": "phone",
"from": request.body.from_user
"number": request.body.to
}
]
}
]
我正在关注 Nexmo 文档 here 我找不到 iOS 文档了(神秘) 具体来说,文档讨论了答案 URL 它说
You are expected to replace CALLEE_PHONE_NUMBER with the number to be called. But, ultimately, the number that is actually called is the one supplied in the Answer URL webhook. In a real-life use case, you would create a server component to serve as the Answer URL. The app will send to your backend, through the Answer URL the CALLEE_PHONE_NUMBER, the backend would validate it and then supply it in the JSON returned.
Note: The gist you created is specific to this tutorial. In a real-life scenario, the Answer URL should be provided by a purposely built web solution. Your backend should provide that can serve custom NCCOs and, for this case, receive and validate the phone number dialled from the app.```
所以我创建了我的自定义后端,它接受一个 ?to
参数,returns 有效 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 支持人员告诉我的)?我要传递 url 吗?
我已经尝试了所有这些组合:
client.call("https://mycustomurl.herokuapp.com/hello?to=18052428083", callHandler: .server)
client.call("hello?to=18052428083", callHandler: .server)
client.call("18052428083", callHandler: .server)
我无法让它工作,并且在文档中找不到任何关于如何使用自定义后端答案的内容 url。任何帮助将不胜感激。
我们移动了一些东西,很抱歉重定向不起作用。这里有一个step by step tutorial on making a call from the app.
您的自定义 url 不需要任何参数,但您需要更新仪表板才能使用 https://mycustomurl.herokuapp.com/hello
。
在应用程序中,您调用 client.call("44000000000", callHandler: .server)
,这将向您的自定义 url 发出 GET 请求。对自定义 url 的请求将在其查询中有一个 JSON 对象,如下所示:
{
to: '44000000000',
from_user: 'Alice',
conversation_uuid: 'CON-7a15150b-121d-42b7-91eb-23ccefdcbf5e',
uuid: 'NONE'
}
JSON 对象中的 to
值将是应用程序中提供的数字。您可以使用它来填写您想要 return 的 NCCO,例如:
[
{
"action": "talk",
"text": "Please wait while we connect you."
},
{
"action": "connect",
"endpoint": [
{
"type": "phone",
"from": request.body.from_user
"number": request.body.to
}
]
}
]