Phone call bridge


Phone call bridge allows you programmatically start a phone call between two phone numbers. This tool is an alternative to “Click to Call” in cases where the user doesn’t have a mic on his computer or just prefer a more private phone call.

URL:

https://voip-communications.net/api-v2/index.php/pcall/callbridge

Method:

POST

Authentication:

Basic

Parameters:

  • token (required): token associated with your endpoint; The phone call will take the Caller ID and the recording options from the endpoint associated.
  • phone_a (required): First phone number to call (as soon as the phone call is answered, “phone_b” will be called)
  • phone_b (required): Second phone number to call after “phone_a” has answered the phone call.
  • call_date (optional): Date to make the phone call with format YYYY-MM-DD HH:MM (keep in mind, the system check for scheduled phone calls every 5 minutes); If not provided, the system will make the call immediately. So, if you schedule a call [click here] to see the API methods to list and delete scheduled calls or [Click here] to see all requested phone calls.
  • play_url (optional): Url to an MP3 or WAV (WAVE PCM, 8000 Hz 16 bit or 11025 Hz 16 bit PCM) file to be played to “phone_a” when the phone call is answered. Url must be accessible from the internet.
  • msg (optional): If specified, when “phone_a” answers the phone call the system will play the message indicated (after play the file indicated by “play_url”) and then call “phone_b”
  • msg_lang (optional): If “msg” is specified you must indicate the language to be used to play the message (see table below with possible values);
  • dialtone_url (optional): If specified, instead of hearing the “Ringing tone” of “phone_b”, the person in “phone_a” will hear the audio (MP3/WAV – WAVE PCM, 8000 Hz 16 bit or 11025 Hz 16 bit PCM) indicated; So dialtone_url must be an Url accessible from the internet.
Language Value
English – British en-GB
English – USA en-US
French fr-FR
German de-DE
Italian it-IT
Portuguese pt-BR
Russian ru-RU
Spanish es-ES
Spanish – USA es-US

It is your current Endpoints / Token list:

[Click here] to Login/Register to see a list of your Endpoint/Token

HTTP Response Codes:

200: Success
400: Invalid request
401: Invalid API credentials

Response data:

You will get a JSON like this.

{
    "data": {
             "token": "172805ndWT3J1Um4ySzRVWnpwMkZLZVAzSUSy9JRHUvdXVCVm9EdkszcGZhaTlySGc9PQ=as=",
             "phone_a": "12818387270",
             "phone_b": "17134533521",
             "play_url" : "https://example.com/file.mp3",
             "msg": "good morning, please wait a moment to connect your call",
             "msg_lang": "en-US",
             "code": 200,
             "code_desc": "",
             "callid": "4812659e8ee99a8167613597768"
    }
}

Please note “callid” in the response; It is a unique code for the process, and it is required to cancel the request (just if it is a scheduled phone call bridge). [click here] to see API methods to list/delete scheduled calls.

Curl Example

curl -u YOUR_API_KEY:YOUR_API_PASSWORD
     --data"token=YOUR_ENDPOINT_TOKEN&phone_a=18323456789&phone_b=17134567890&msg=HI&msg_lang=en-US"
     https://voip-communications.net/api-v2/index.php/pcall/callbridge

PHP Example

$service_url = "https://voip-communications.net/api-v2/index.php/pcall/callbridge";
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_USERPWD, "YOUR_API_KEY:YOUR_API_PASSWORD");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$post_fields = array("token" => "ENDPOINT_TOKEN",
                     "phone_a" => "18323456789",
                     "phone_b" => "17134567890",
                     "play_url" => "https://example.com/file.wav",
                     "msg" => "Please wait",
                     "msg_lang" => "en-US");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post_fields));
$curl_response = curl_exec($curl);
if ($curl_response !== false) {
    $http_code = curl_getinfo($curl,CURLINFO_HTTP_CODE);
    if ($http_code == "200") {
        $result = json_decode($curl_response,true);
        print_r($result);
    }
}
curl_close($curl);