Auto Dialing
For the purpose of this guide, we'll use the Cloudonix REST API, specifically the Call and Session Control API.
We'll demonstrate 2 different methods of using the Outbound Call From Application
API request: with an embedded CXML document and with a Voice Application
.
Embedded CXML Document
Assume issuing the following CURL request to the Cloudonix API endpoint:
$ curl -X POST "https://api.cloudonix.io/calls/example.com/application" \
-H "Authorization: bearer XI1234567890" \
-H "Content-Type: application/json" \
-d '{"destination": "63121233333",
"caller-id": "12127773456",
"cxml": "<Response> \
<Play>https://example.com/sample.mp3</Play> \
<Hangup />
</Response>"}'
The above API request will initiate a call to the number 63121233333
(either a registered subscriber or via an outbound trunk). Upon pickup, the embedded
CXML
will be executed, in our case, playing back the file located at https://example.com/sample.mp3
.
Voice Application Request
Create a voice application (either remote or container)
In order to use a Voice Application
, we'll first create a voice application. For sake of simplicity, we'll call it autoDialDemoApp
.
<Response>
<Play>https://example.com/sample.mp3</Play> \
<Hangup />
</Response>
As you can see, this voice application is identical to the previously embedded CXML document.
Issue the API Request
$ curl -X POST "https://api.cloudonix.io/calls/example.com/application" \
-H "Authorization: bearer XI1234567890" \
-H "Content-Type: application/json" \
-d '{"destination": "63121233333", "caller-id": "12127773456", "application": "autoDialDemoApp"}'