I am following the Nexmo documentation here I cant find the iOS docs anymore (mysteriously) Specifically the docs talk about the Answer URL it says
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.```
So I created my custom backend that takes in a ?to
parameter which returns valid json like so:
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"}}]
I put that custom url into my application in the dashboard like this...
https://mycustomurl.herokuapp.com/
I have also tried many other variations like full path /hello etc.
When I place the call from my app... how do I reference this endpoint? is the parameter automatically to
(a nexmo support person told me that)? do i pass in the url?
i have tried all these combos:
client.call("https://mycustomurl.herokuapp.com/hello?to=18052428083", callHandler: .server)
client.call("hello?to=18052428083", callHandler: .server)
client.call("18052428083", callHandler: .server)
I cannot get it to work and cannot find anything in the docs about how to use the custom backend answer url. Any help would be appreciated.
We moved some stuff around, apologies that the redirect didn't work. Here is a step by step tutorial on making a call from the app.
Your custom url does not need any parameters, but you will need to update the dashboard to use 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'
}
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
}
]
}
]