Launch click to call

This method allows you to start a click-to-call toward multiple destinations.

Resource

https://api.infobip.com/voice/ctc/1/send

Parameters

Property name Type Description
bulkid string The ID which uniquely identifies the request.
messageId string The ID that uniquely identifies the established call.
from string Numeric sender ID in E.164 format
destinationA string Original destination address. Address must be in the international format (Example: 41793026727).
destinationB string Destination address to which the call will be transferred after successful answering. Address must be in the international format (Example: 41793026727).
text string Text of the message that will be played before call transfer.
language string

If the message is in text format, languages in which the message is written must be defined for correct pronunciation. In the Languages section you can find the list of languages that we support.

audioFileUrl string Besides the text format of the message played before call transfer, audio recording (in waw or mp3 format) can also be delivered. Audio file must be uploaded online so the existing URL can be available for the file download. Size of the audio file must be below 4 MB.
record string Record the call and expose it to client as URL inside the delivery report. Can be true or false.
anonymization   boolean If set, same numeric sender is used for both calls (destinations).
notifyUrl   String The URL on your callback server on which the Delivery report will be sent.
notifyContentType   String Preferred Delivery report content type. Can be application/json or application/xml.

Request Example

					POST /voice/ctc/1/send HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json

{
   "bulkId": "BULK-ID-123-xyz",
   "messages": [
      {
         "messageId": "MESSAGE-ID-123-xyz",
         "from": "41793026700",
         "destinationA": "41793026727",
         "destinationB": "41793026731",
         "text": "Test Voice message.",
         "language": "en",
         "record": true,
         "anonymization": false,
         "notifyUrl": "https://www.example.com/voice/clicktocall",
         "notifyContentType": "application/json"
      }
   ]
}
					
				
					curl -X POST \
  http:// \
  -H 'cache-control: no-cache' \
  -H 'postman-token: ee3cf632-75b7-6580-c54b-f1368240be58' \
  -d 'POST /voice/ctc/1/send HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json

{
   "bulkId": "BULK-ID-123-xyz",
   "messages": [
      {
         "messageId": "MESSAGE-ID-123-xyz",
         "from": "41793026700",
         "destinationA": "41793026727",
         "destinationB": "41793026731",
         "text": "Test Voice message.",
         "language": "en",
         "record": true,
         "anonymization": false,
         "notifyUrl": "https://www.example.com/voice/clicktocall",
         "notifyContentType": "application/json"
      }
   ]
}'
					
				
					<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.infobip.com/voice/ctc/1/send",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{
  	\"bulkId\": \"BULK-ID-123-xyz\",
  	\"messages\": [
  		{
  			\"messageId\": \"MESSAGE-ID-123-xyz\",
  			\"from\": \"41793026700\",
  			\"destinationA\": \"41793026727\",
  			\"destinationB\": \"41793026731\",
  			\"text\": \"Test Voice message.\",
  			\"language\": \"en\",
  			\"record\": true,
  			\"anonymization\": false,
  			\"notifyUrl\": \"https://www.example.com/voice/clicktocall\",
  			\"notifyContentType\": \"application/json\"
  			}
  			]
  	
  }",
  CURLOPT_HTTPHEADER => array(
    "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=",
    "content-type: application/json",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
					
				
					require 'uri'
require 'net/http'

url = URI("https://api.infobip.com/voice/ctc/1/send")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ='
request["content-type"] = 'application/json'
request.body = "{
	\"bulkId\": \"BULK-ID-123-xyz\",
	\"messages\": [
		{
			\"messageId\": \"MESSAGE-ID-123-xyz\",
			\"from\": \"41793026700\",
			\"destinationA\": \"41793026727\",
			\"destinationB\": \"41793026731\",
			\"text\": \"Test Voice message.\",
			\"language\": \"en\",
			\"record\": true,
			\"anonymization\": false,
			\"notifyUrl\": \"https://www.example.com/voice/clicktocall\",
			\"notifyContentType\": \"application/json\"
			}
			]}"

response = http.request(request)
puts response.read_body
					
				
					import http.client

conn = http.client.HTTPSConnection("api.infobip.com")

payload = "{
	\"bulkId\": \"BULK-ID-123-xyz\",
	\"messages\": [
		{
			\"messageId\": \"MESSAGE-ID-123-xyz\",
			\"from\": \"41793026700\",
			\"destinationA\": \"41793026727\",
			\"destinationB\": \"41793026731\",
			\"text\": \"Test Voice message.\",
			\"language\": \"en\",
			\"record\": true,
			\"anonymization\": false,
			\"notifyUrl\": \"https://www.example.com/voice/clicktocall\",
			\"notifyContentType\": \"application/json\"
			}
			]
			}"

headers = {
    'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=",
    'content-type': "application/json",
    }

conn.request("POST", "/voice/ctc/1/send", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
					
				
					HttpResponse<String> response = Unirest.post("https://api.infobip.com/voice/ctc/1/send")
  .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=")
  .header("content-type", "application/json")
  .body("{
  	     \"bulkId\": \"BULK-ID-123-xyz\",
  	     \"messages\": [
  	                {
  	                	\"messageId\": \"MESSAGE-ID-123-xyz\",
  	                	\"from\": \"41793026700\",
  	                	\"destinationA\": \"41793026727\",
  	                	\"destinationB\": \"41793026731\",
  	                	\"text\": \"Test Voice message.\",
  	                	\"language\": \"en\",
  	                	\"record\": true,
  	                	\"anonymization\": false,
  	                	\"notifyUrl\": \"https://www.example.com/voice/clicktocall\",
  	                	\"notifyContentType\": \"application/json\"
  	                	}  
  	                	]
  	
					}")
  .asString();
					
				
					var client = new RestClient("https://api.infobip.com/voice/ctc/1/send");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=");
request.AddParameter("application/json", 
					"{
						\"bulkId\": \"BULK-ID-123-xyz\",
						\"messages\": [
							{
								\"messageId\": \"MESSAGE-ID-123-xyz\",
								\"from\": \"41793026700\",
								\"destinationA\": \"41793026727\",
								\"destinationB\": \"41793026731\",
								\"text\": \"Test Voice message.\",
								\"language\": \"en\",
								\"record\": true,
								\"anonymization\": false,
								\"notifyUrl\": \"https://www.example.com/voice/clicktocall\",
								\"notifyContentType\": \"application/json\"
							}
								]
						}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
					
				
					var data = "{
	\"bulkId\": \"BULK-ID-123-xyz\",
	\"messages\": [
		{
			\"messageId\": \"MESSAGE-ID-123-xyz\",
			\"from\": \"41793026700\",
			\"destinationA\": \"41793026727\",
			\"destinationB\": \"41793026731\",
			\"text\": \"Test Voice message.\",
			\"language\": \"en\",
			\"record\": true,
			\"anonymization\": false,
			\"notifyUrl\": \"https://www.example.com/voice/clicktocall\",
			\"notifyContentType\": \"application/json\"
			}
			]
		}";

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.infobip.com/voice/ctc/1/send");
xhr.setRequestHeader("authorization", "Basic VGFyaWsxMjI6VGFyaWsxMjM=");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);
					
				

Response

					{
  "bulkId": "BULK-ID-123-xyz",
  "messages": [
    {
      "to": "41793026727",
      "status": {
        "groupId": 1,
        "groupName": "PENDING",
        "id": 26,
        "name": "PENDING_ACCEPTED",
        "description": "Message accepted, pending for delivery."
      },
      "messageId": "MESSAGE-ID-123-xyz"
    }
  ]
}
					
				

Response format

If successful, the response header HTTP status code will be 200 OK.

If you try to send the request without authorization, you will receive a 401 Unauthorized error.

Voice Response

Parameter Type Description
bulkId String The ID that uniquely identifies the request. Bulk ID will be received when a message is sent to more than one destination address.
messages VoiceResponseDetails Array of sent message objects, one object per message.

Voice Response Details

Parameter Type Description
to String The message destination address.
status Status Indicates whether the message has been sent successfully, not sent, delivered, not delivered, waiting for delivery, or other status.
messageId String The ID that uniquely identifies the sent message.

Status

Parameter Type Description
groupId int Status group ID.
groupName String Status group name.
id int Status ID.
name String Status name.
description String Human readable description of the status.