{"_id":"558dbe407afc102f008ed8a4","parentDoc":null,"project":"558d9c32beb7c719007f6319","category":{"_id":"558db0bc7afc102f008ed863","pages":["558dbe324cd25f0d00b7ecce","558dbe407afc102f008ed8a4","558dbe567afc102f008ed8a9","558dbe677afc102f008ed8ac","558dbe7e4cd25f0d00b7ecd0","558dbea37afc102f008ed8b2","558dbeb27afc102f008ed8b4","558dbec14cd25f0d00b7ecd2","558dbed0beb7c719007f63b4","558dbf61beb7c719007f63ba"],"version":"558d9c33beb7c719007f631c","project":"558d9c32beb7c719007f6319","__v":10,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-06-26T20:06:20.813Z","from_sync":false,"order":2,"slug":"call-initiation-api","title":"Call Initiation APIs"},"githubsync":"","__v":53,"user":"558d70614cd25f0d00b7eba4","version":{"_id":"558d9c33beb7c719007f631c","project":"558d9c32beb7c719007f6319","__v":19,"createdAt":"2015-06-26T18:38:43.154Z","releaseDate":"2015-06-26T18:38:43.153Z","categories":["558d9c33beb7c719007f631d","558db0bc7afc102f008ed863","558db0d07afc102f008ed864","558db3c84cd25f0d00b7ecb2","558dbace7afc102f008ed894","558dbd104cd25f0d00b7ecca","558dbd4c4cd25f0d00b7eccb","559d3e858639bd21008e90a6","55bb8ca5a8400c2d00873e70","58fdfb438fbd2819000db9eb","590829c7ade4172d006a87b8","59082a11beedcf0f00235d87","5908bd2cba2afd23007d6d12","5908d1f64f544425002b6aae","591e5e9e2c1b1f0f000fa4e5","5a283434aba91f002834ea86","5a69fe5cde745d002c936c66","5a81e6ef761cf300127317f8","5a81e7d63b1e120012bed5a1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-26T21:04:00.477Z","link_external":false,"link_url":"","sync_unique":"","hidden":true,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Use the Click-to-Call API to initiate a phone call with a click of a mouse.\"\n}\n[/block]\nThe 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.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Base URL for Click-to-Call\",\n  \"body\": \"https://secure.dialogtech.com/ibp_api.php\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Parameter List\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Required\",\n    \"h-2\": \"Accepts\",\n    \"0-0\": \"access_key\",\n    \"0-1\": \"Yes* (See Notes)\",\n    \"1-0\": \"secret_access_key\",\n    \"1-2\": \"String\",\n    \"2-0\": \"action\",\n    \"2-1\": \"Yes\",\n    \"3-0\": \"type\",\n    \"3-2\": \"String: **1** or **2**\",\n    \"5-0\": \"phone_to_call\",\n    \"5-2\": \"String: Unformatted Phone Number\",\n    \"5-1\": \"Yes\",\n    \"6-0\": \"page\",\n    \"6-2\": \"String\",\n    \"8-0\": \"first_callerid\",\n    \"8-2\": \"String: Unformatted Phone Number\",\n    \"9-0\": \"second_callerid\",\n    \"9-1\": \"No\",\n    \"1-1\": \"Yes* (See Notes)\",\n    \"0-2\": \"String\",\n    \"2-2\": \"String: **clickto.call**\",\n    \"3-1\": \"Yes\",\n    \"h-3\": \"Max Length\",\n    \"0-3\": \"n/a\",\n    \"6-1\": \"No\",\n    \"h-4\": \"Notes\",\n    \"h-5\": \"Usage\",\n    \"0-4\": \"Access Key from the Key Manager within a DialogTech account\",\n    \"0-5\": \"Credentials used for access to the API for a particular DialogTech account\",\n    \"1-4\": \"Secret Access Key from the Key Manager within a DialogTech account\",\n    \"1-3\": \"n/a\",\n    \"2-3\": \"n/a\",\n    \"2-4\": \"Only accepts **clickto.call** for click-to-call\",\n    \"3-4\": \"1 - Call **phone_to_call** first\\n2 - Call **id** first\",\n    \"3-3\": \"n/a\",\n    \"4-0\": \"id\",\n    \"4-1\": \"Yes\",\n    \"4-2\": \"String: Unformatted Phone Number\",\n    \"4-3\": \"n/a\",\n    \"4-4\": \"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.\",\n    \"5-3\": \"n/a\",\n    \"6-3\": \"255\",\n    \"1-5\": \"Credentials used for access to the API for a particular DialogTech account\",\n    \"2-5\": \"Defines the API call as a \\\"Click-to-call\\\" type\",\n    \"3-5\": \"Determines the order in which the various numbers are dialed\",\n    \"4-5\": \"Defines one of the numbers being used in the click-to-call\",\n    \"5-4\": \"Can be any unformatted phone number\",\n    \"5-5\": \"Defines one of the numbers being used in the click-to-call\",\n    \"6-5\": \"Defines the \\\"page\\\" the click-to-call originated from.\",\n    \"8-1\": \"No\",\n    \"8-3\": \"n/a\",\n    \"8-4\": \"Must be a registered number, one of the two numbers being dialed, or tracking number within the DialogTech account.\",\n    \"8-5\": \"Defines the Caller ID utilized on the first leg of the call\",\n    \"9-5\": \"Defines the Caller ID utilized on the second leg of the call\",\n    \"9-2\": \"String: Unformatted Phone Number\",\n    \"9-3\": \"n/a\",\n    \"9-4\": \"Must be a registered number, one of the two numbers being dialed, or tracking number within the DialogTech account.\",\n    \"6-4\": \"Will be stored in the *Smart Click-to-Call Report*\",\n    \"7-0\": \"ref\",\n    \"7-1\": \"No\",\n    \"7-2\": \"String\",\n    \"7-3\": \"32\",\n    \"7-4\": \"Will be stored in the *Smart Click-to-Call Report*\",\n    \"7-5\": \"Can be used to pass in a reference string to be available in Click-to-Call reporting\"\n  },\n  \"cols\": 6,\n  \"rows\": 10\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Using this API\"\n}\n[/block]\nThese code examples are meant to show a basic method of accessing DialogTech's click-to-call API.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n    /*\\n        Click-to-Call Example:\\n        This example will use access_key and secret_access_key.\\n        This means the two numbers being dialed by this \\n        click-to-call are not required to be registered numbers\\n        or tracking numbers within your DialogTech account.\\n    */\\n\\n\\t// create curl resource\\n\\t$ch = curl_init(); \\n\\t$baseuri = \\\"https://secure.dialogtech.com/ibp_api.php?\\\";\\n\\t\\n    // API Specific Static Parameters\\n    $action = \\\"clickto.call\\\";\\n\\n\\t// Required User Parameters\\n\\t$access_key = \\\"foo\\\";\\n\\t$secret_access_key = \\\"bar\\\";\\n    $type = \\\"1\\\";\\n    $id = \\\"8772955100\\\";\\n    $phone_to_call = \\\"5551112222\\\";\\n    $page = \\\"home.html\\\";\\n    $first_callerid = \\\"9998887777\\\"; // Will display as the Caller ID for the 'phone_to_call' recipient as type=1\\n    $second_callerid = \\\"8887776666\\\"; // Will display as the Caller ID for the 'id' recipient as type=1\\n\\n    // Construct the full URL\\n    $full_url = $baseuri . \\\"&action=\\\" . $action .\\n        \\\"&access_key=\\\" . $access_key .\\n        \\\"&secret_access_key=\\\" . $secret_access_key .\\n        \\\"&type=\\\" . $type .\\n        \\\"&id=\\\" . $id .\\n        \\\"&phone_to_call=\\\" . $phone_to_call .\\n        \\\"&page=\\\" . $page .\\n        \\\"&first_callerid=\\\" . $first_callerid .\\n        \\\"&second_callerid=\\\" . $second_callerid;\\n\\n    // Set the URL\\n    curl_setopt($ch, CURLOPT_URL, $full_url);\\n    \\n    // Sets the return options of the cURL to return the actual result from the curl request, and FALSE on failure\\n    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\\n        \\n    // Sets the $output variable to the result of the curl\\n    $output = curl_exec($ch); \\n    \\n    // Close curl resource to free up system resources\\n    curl_close($ch);\\n\\n    // Send the API output to the php page\\n    echo $output;\\n?>\",\n      \"language\": \"php\",\n      \"name\": \"PHP Example\"\n    }\n  ]\n}\n[/block]\n**Example Response**\n\nWhen 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.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Call Connected\",\n      \"language\": \"text\",\n      \"name\": \"First Leg Answered\"\n    },\n    {\n      \"code\": \"No Answer\",\n      \"language\": \"text\",\n      \"name\": \"First Leg Not Answered\"\n    }\n  ]\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {}\n  ]\n}\n[/block]","excerpt":"Used to initiate a phone call directly between two phone numbers.","slug":"click-to-call","type":"basic","title":"Click-to-Call"}

Click-to-Call

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

https://secure.dialogtech.com/ibp_api.php

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