Used to initiate a phone call directly between two phone numbers.
Use the Click-to-Call API to initiate a phone call with a click of a mouse.
The Click-to-call API is used to initiate a phone call directly between two phone numbers. Depending on the parameters used, the order in which numbers are dialed can be modified.
Base URL for Click-to-Call
Parameter List
Parameter | Required | Accepts | Max Length | Notes | Usage |
---|---|---|---|---|---|
access_key | Yes* (See Notes) | String | n/a | Access Key from the Key Manager within a DialogTech account | Credentials used for access to the API for a particular DialogTech account |
secret_access_key | Yes* (See Notes) | String | n/a | Secret Access Key from the Key Manager within a DialogTech account | Credentials used for access to the API for a particular DialogTech account |
action | Yes | String: clickto.call | n/a | Only accepts clickto.call for click-to-call | Defines the API call as a "Click-to-call" type |
type | Yes | String: 1 or 2 | n/a | 1 - Call phone_to_call first 2 - Call id first | Determines the order in which the various numbers are dialed |
id | Yes | String: Unformatted Phone Number | n/a | Must be a registered number, or tracking number within the DialogTech account if key is being utilized. If access_key and secret_access_key are being utilized, this can be any number. | Defines one of the numbers being used in the click-to-call |
phone_to_call | Yes | String: Unformatted Phone Number | n/a | Can be any unformatted phone number | Defines one of the numbers being used in the click-to-call |
page | No | String | 255 | Will be stored in the Smart Click-to-Call Report | Defines the "page" the click-to-call originated from. |
ref | No | String | 32 | Will be stored in the Smart Click-to-Call Report | Can be used to pass in a reference string to be available in Click-to-Call reporting |
first_callerid | No | String: Unformatted Phone Number | n/a | Must be a registered number, one of the two numbers being dialed, or tracking number within the DialogTech account. | Defines the Caller ID utilized on the first leg of the call |
second_callerid | No | String: Unformatted Phone Number | n/a | Must be a registered number, one of the two numbers being dialed, or tracking number within the DialogTech account. | Defines the Caller ID utilized on the second leg of the call |
Using this API
These code examples are meant to show a basic method of accessing DialogTech's click-to-call API.
<?php
/*
Click-to-Call Example:
This example will use access_key and secret_access_key.
This means the two numbers being dialed by this
click-to-call are not required to be registered numbers
or tracking numbers within your DialogTech account.
*/
// create curl resource
$ch = curl_init();
$baseuri = "https://secure.dialogtech.com/ibp_api.php?";
// API Specific Static Parameters
$action = "clickto.call";
// Required User Parameters
$access_key = "foo";
$secret_access_key = "bar";
$type = "1";
$id = "8772955100";
$phone_to_call = "5551112222";
$page = "home.html";
$first_callerid = "9998887777"; // Will display as the Caller ID for the 'phone_to_call' recipient as type=1
$second_callerid = "8887776666"; // Will display as the Caller ID for the 'id' recipient as type=1
// Construct the full URL
$full_url = $baseuri . "&action=" . $action .
"&access_key=" . $access_key .
"&secret_access_key=" . $secret_access_key .
"&type=" . $type .
"&id=" . $id .
"&phone_to_call=" . $phone_to_call .
"&page=" . $page .
"&first_callerid=" . $first_callerid .
"&second_callerid=" . $second_callerid;
// Set the URL
curl_setopt($ch, CURLOPT_URL, $full_url);
// Sets the return options of the cURL to return the actual result from the curl request, and FALSE on failure
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Sets the $output variable to the result of the curl
$output = curl_exec($ch);
// Close curl resource to free up system resources
curl_close($ch);
// Send the API output to the php page
echo $output;
?>
Example Response
When requesting the click-to-call API, the client side response will only populate after the first leg of the call is answered or not. The response will be a plain-text string indicating the success/failure of the first leg of the call.
Call Connected
No Answer