Introduction to Sonetel:
We can connect two calls with Sonetel web service using php. You only have to make an account over it and deposit some dollars that will be used to connect your two numbers that you will give it to connect them. Then you will be able to make request for calls.
Make Account
How you can send the request
The API for callback is a simple HTTPS POST Request to https://call.sonetel.com
Required parameters
- email: The of you sonetel account.
- password: Your sonetel account password.
- call1: The first number that you want it to call.
- call2: The second number that you want it to call.
Optional parameter
- show1: Caller-id that you want to show to the first number.
- show2: Caller-id that you want to show to the second number.
show1 and show2 must be a Sonetel phone number that you have available in your account. Numbers should be entered in the E164 format (+NUMBER).
Responses
- Success. A success reponse tell you that your call was initiated properly.
-
Error. In case your api does’nt work then it will give you some errors then you can check it what type of error you are getting. Below are the errors that you may get while requesting.
The error codes will be upto 3 to 4 numeric codes and can have the following values. - 1000: Invalid username
- 1001: Invalid password
- 1002: User account blocked for many attempts with incorrect credentials.
- 1003: Account suspended. You may need to contact Sonetel support.
- 1004: No credit: The account does not have enough credit to make the callback call.
- 500: Unexpected error.
Php Example Code:
<?php $url='https://call.sonetel.com'; $api_call = array('email' => 'xyz@abc.com','password' => 'XXXXXXXXXXX','call1' => 'XXXXXXXXXX','call2' => 'XXXXXXXXXXXXX'); $data_to_send = http_build_query($api_call); $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS,$data_to_send); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); $result = curl_exec($ch); ?>
This code attempts to connect the calls. Instantly you will receive the call when it will return the TRUE reponse. Call will be initiated to the first number you have given with the call1 name. When the first person will receive it then it will be hold for this and then call will be initiate to the second number that is Call2 and when second person will receive both of these person will be interconnected and will be able to talk wisely.