hello,
I’m wondering curently what is the best way to originate a call using wazo-platform api ?
Regards,
hello,
I’m wondering curently what is the best way to originate a call using wazo-platform api ?
Regards,
Hi,
it really depends on the context. For example, if the call is originated from a authenticated user you can use the following call.
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'X-Auth-Token: <token>' -d '{"extension": "<extension>"}' 'https://<host>/api/calld/1.0/users/me/calls'
If you’re originating from an application you can use the following call
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'X-Auth-Token: <token>' -d '{"destination": {"context": "<context>", "extension": "<exten>"}, "source": {"user": "<user_uuid>"}}' 'https://host/api/calld/1.0/calls'
Hello,
Thank you for taking the time to answer me, it is noted.
Not knowing how to do it, I quickly produced a flask application, which launches a shell command: https://github.com/benasse/flask-originate/
Case 2 looks like what I would like to do, however, according to the doc, I am forced to enter a uuid user as a caller, which does not suit me too much.
Allow me to recap what I understand.
You would like an API to launch a call to and from an arbitrary context/exten
ex:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'X-Auth-Token: <token>' -d '{"destination": {"context": "<context>", "extension": "<exten>"}, "source": {"context": "<context>", "extensions": "<exten>"}}' 'https://host/api/calld/1.0/calls'
You can also use the /applications in calld which would also allow you to do that at a lower lever
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"autoanswer": false, "context": "<context>", "displayed_caller_id_name": "<cid name>", "displayed_caller_id_number": "<cid number>", "exten": "<exten>"}' 'https://<host>/api/calld/1.0/applications/%3Capplication_uuid%3E/calls'
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"autoanswer": false, "context": "<context>", "displayed_caller_id_name": "<cid name>", "displayed_caller_id_number": "<cid number>", "exten": "<exten>"}' 'https://<host>/api/calld/1.0/applications/%3Capplication_uuid%3E/calls'
And add the two calls to a node (which is an Asterisk bridge)
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"calls": [{"id": "<call_id_1>"}, {"id": "<call_id_2>"}]}' 'https://<host>/api/calld/1.0/applications/%3Capplication_uuid%3E/nodes'
Before doing that you would have to create an application in wazo-confd.
That’s exactly what I want to do, thanks.
It is a little more complex than what I had done, I must find the time to implement it.