Now that you understand the basic fundamentals and requirements of voice API lets get you started by creating your very first API.
Write your first API
We will start off with basic instruction and will name our API “Hello World”.
Before you proceed choose the language that you will use to write your first API. For current example we will be using PHP.
* Irrespective of the language you choose the basic steps and output will be same.
Follow the steps below:-
STEP 1:- Set Up Web URL
– Make sure your web url is ready to respond to requests from DIDforSale(DFS).
– The hello-world.php file should be linked directly to the url as this is the connection point for DFS.
For example http://example.com/hello-world.php
STEP 2:- Configure the Phone Number
– Log in to your DIDforSale account. (If you don’t have an account create now)
– Select an existing phone number or buy new.
– Edit the phone number and link it to web url by pasting the url here and save the settings.
In our current example we will link 999-888-7777 to http://example.com/hello-world.php
<Say>Hello, Your call has successfully connected</Say>
STEP 4:- From any phone dial 999-888-7777
– As soon as the call is initiated DFS will contact the specified weburl. (http://example.com/hello-world.php)
– Once the connection is established DFS will look for instruction in hello-world.php.
– As specified in current example the caller will hear “Hello Your call has successfully connected” as that’s the instruction we gave.
– Call Completed.
Key word used = Say
Say Reads the text and convert’s that to audio and play to the caller.
You successfully wrote and executed your Hello World API!!!
Saying "Hello" to the caller does not do any good". Let's get little more advanced.