PHP

Call Controllers

KooKoo's Call Controllers apis helps to managing calls
 
KooKoo markup language KooKoo-XML is the basic language used to control action on KooKoo,
 
Call Controllers APIs help to mange the calls, like add conference,mute caller, pause/unpause the call recording, kick the caller from Conference etc.

Authentication

kookoo api_key is used as Authencation api
 
to be passed in header Authorization: {api_key}

Conference Add

You cannot create a conference directly from the API. To create a new conference, you must use Conference Tag, or If two callers already connected with Dial Tag, Only then API will work.

Parameter Description
ucid caller's call sid
phoneno conference participant number to add
did KooKoo Number
api_key KooKoo API KEY
playRing(True) Note : Use ring option Mandatory.
cburl when conference ended to this participant, data post to the callback_url
					<?php
						$url = 'https://in-ccaas.ozonetel.com/api/v1/CallControl/Conference';
						$param = array('api_key' => 'KKfdbxxxxxxxx',
						'phoneno' => '099xxxxxxxx',
						'did' => '91xxxxxxxx',
						'api_key'=>'KKXXXXX',
						'playRing'=>'true',
						'cburl' => 'callback url'
						);

						$url = $url . "?" . http_build_query($param, '&');
						$curl = curl_init();
						curl_setopt_array($curl, array(
						CURLOPT_URL => $url,
						CURLOPT_RETURNTRANSFER => true,
						CURLOPT_ENCODING => "",
						CURLOPT_MAXREDIRS => 10,
						CURLOPT_TIMEOUT => 30,
						CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
						CURLOPT_CUSTOMREQUEST => "GET",
						CURLOPT_HTTPHEADER => array(
						"Authorization: {{api_key}}",
						"Postman-Token: f32c47e6-b945-4056-be5e-de588e55651c",
						"cache-control: no-cache"
						),
						));

						$response = curl_exec($curl);
						$err = curl_error($curl);
						curl_close($curl);
						if ($err) {
							echo "cURL Error #:" . $err;
						} else {
							echo $response;
						}
					
				

Caller Hold

Call must the in conference Conference, or If two callers already connected with Dial Tag, Only then This API will work.

Parameter Description
ucid caller's call sid
api_key KooKoo API Key
phoneno phone number to hold
did KooKoo Number
playRing(True) Note : Use ring option Mandatory.
					<?php
						$url = 'https://in-ccaas.ozonetel.com/api/v1/CallControl/Hold';
						$param = array(
						'phoneno' => '099xxxxxxxx',
						'api_key'=>'KKXXXXX',
						'did' => '91xxxxxxxx',
						'ucid' => 'call id',
						'playRing'=>'true',
						);

						$url = $url . "?" . http_build_query($param, '&');
						$curl = curl_init();
						curl_setopt_array($curl, array(
						CURLOPT_URL => $url,
						CURLOPT_RETURNTRANSFER => true,
						CURLOPT_ENCODING => "",
						CURLOPT_MAXREDIRS => 10,
						CURLOPT_TIMEOUT => 30,
						CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
						CURLOPT_CUSTOMREQUEST => "GET",
						CURLOPT_HTTPHEADER => array(
						"Authorization: {{api_key}}",
						"Postman-Token: f32c47e6-b945-4056-be5e-de588e55651c",
						"cache-control: no-cache"
						),
						));

						$response = curl_exec($curl);
						$err = curl_error($curl);
						curl_close($curl);
						if ($err) {
							echo "cURL Error #:" . $err;
						} else {
							echo $response;
						}
					
				

Caller UnHold

Un hold the caller in caller on hold

Parameter Description
phoneno conference participant number to add
api_key KooKoo API Key
did KooKoo Number
ucid conference added participant's call ucid
					<?php
						$url = 'https://in-ccaas.ozonetel.com/api/v1/CallControl/Unhold';
						$param = array(
						'phoneno' => '099xxxxxxxx',
						'api_key'=>'KKXXXXX',
						'did' => '91xxxxxxxx',
						'ucid' => 'caller's call ucid'
						);

						$url = $url . "?" . http_build_query($param, '&');
						$curl = curl_init();
						curl_setopt_array($curl, array(
						CURLOPT_URL => $url,
						CURLOPT_RETURNTRANSFER => true,
						CURLOPT_ENCODING => "",
						CURLOPT_MAXREDIRS => 10,
						CURLOPT_TIMEOUT => 30,
						CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
						CURLOPT_CUSTOMREQUEST => "GET",
						CURLOPT_HTTPHEADER => array(
						"Authorization: {{api_key}}",
						"Postman-Token: f32c47e6-b945-4056-be5e-de588e55651c",
						"cache-control: no-cache"
						),
						));

						$response = curl_exec($curl);
						$err = curl_error($curl);
						curl_close($curl);
						if ($err) {
							echo "cURL Error #:" . $err;
						} else {
							echo $response;
						}
					
				

Bargein

Number who is already in Conference and to be patched with the callerNumber which has to be barge into the call.

Parameter Description
ucid caller's call sid
api_key KooKoo API Key
phoneno phone number to bargein
callerNumber Number to barge in with phoneno.
playRing(True) Note : Use ring option Mandatory.
                                        
                                      <?php
$url = 'https://in-ccaas.ozonetel.com/api/v1/CallControl/Bargein';
$param = array(
'phoneno' => '099xxxxxxxx',
'api_key'=>'KKXXXXX',
'callerNumber' => '91xxxxxxxx',
'ucid' => 'call id',
'playRing'=>'true',
);

$url = $url . "?" . http_build_query($param, '&');
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Authorization: {{api_key}}",
"Postman-Token: f32c47e6-b945-4056-be5e-de588e55651c",
"cache-control: no-cache"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
        echo "cURL Error #:" . $err;
} else {
        echo $response;
}
                                        
                                

Disconnect

Disconnect the caller from the To create a new conference, you must use Conference Tag, or from any state in the flow

Parameter Description
phoneno caller number to disconnect
api_key KooKoo API Key
did KooKoo Number
ucid ucid of the caller
					<?php
						$url = 'https://in-ccaas.ozonetel.com/api/v1/CallControl/Disconnect';
						$param = array(
						'phoneno' => '099xxxxxxxx',
						'did' => '91xxxxxxxx',
						'callback_url' => 'callback url'
						);

						$url = $url . "?" . http_build_query($param, '&');
						$curl = curl_init();
						curl_setopt_array($curl, array(
						CURLOPT_URL => $url,
						CURLOPT_RETURNTRANSFER => true,
						CURLOPT_ENCODING => "",
						CURLOPT_MAXREDIRS => 10,
						CURLOPT_TIMEOUT => 30,
						CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
						CURLOPT_CUSTOMREQUEST => "GET",
						CURLOPT_HTTPHEADER => array(
						"Authorization: {{api_key}}",
						"Postman-Token: f32c47e6-b945-4056-be5e-de588e55651c",
						"cache-control: no-cache"
						),
						));

						$response = curl_exec($curl);
						$err = curl_error($curl);
						curl_close($curl);
						if ($err) {
							echo "cURL Error #:" . $err;
						} else {
							echo $response;
						}
					
				

IVR Transfer

to redirect the caller to new application url

Parameter Description
phoneno caller number
api_key KooKoo API Key
did KooKoo Number
ucid caller's call sid
appURL application url
					<?php
						$url = 'https://in-ccaas.ozonetel.com/api/v1/CallControl/IVRTransfer';
						$param = array(
						'ucid' => "caller's call sid",
						'api_key'=>"KKXXXXX",
						'phoneno' => '099xxxxxxxx',
						'did' => '91xxxxxxxx',
						'appURL' => 'application url'
						);

						$url = $url . "?" . http_build_query($param, '&');
						$curl = curl_init();
						curl_setopt_array($curl, array(
						CURLOPT_URL => $url,
						CURLOPT_RETURNTRANSFER => true,
						CURLOPT_ENCODING => "",
						CURLOPT_MAXREDIRS => 10,
						CURLOPT_TIMEOUT => 30,
						CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
						CURLOPT_CUSTOMREQUEST => "GET",
						CURLOPT_HTTPHEADER => array(
						"Authorization: {{api_key}}"
						),
						));

						$response = curl_exec($curl);
						$err = curl_error($curl);
						curl_close($curl);
						if ($err) {
							echo "cURL Error #:" . $err;
						} else {
							echo $response;
						}
					
				

Pause the Recording

You can pause the call recording or conference recording, This API will work on if call recording already to call or conference enabled.

Parameter Description
ucid caller's call sid
did KooKoo Number
api_key KooKoo API Key
ucid call sid
					<?php
						$url = 'https://in-ccaas.ozonetel.com/api/v1/CallControl/PauseMonitor';
						$param = array(
						'ucid' => "caller's call sid",
						'did' => '91xxxxxxxx',
						'api_key'=>"KKXXXXX",
						'sid' => 'call sid'
						);

						$url = $url . "?" . http_build_query($param, '&');
						$curl = curl_init();
						curl_setopt_array($curl, array(
						CURLOPT_URL => $url,
						CURLOPT_RETURNTRANSFER => true,
						CURLOPT_ENCODING => "",
						CURLOPT_MAXREDIRS => 10,
						CURLOPT_TIMEOUT => 30,
						CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
						CURLOPT_CUSTOMREQUEST => "GET",
						CURLOPT_HTTPHEADER => array(
						"Authorization: {{api_key}}",
						),
						));

						$response = curl_exec($curl);
						$err = curl_error($curl);
						curl_close($curl);
						if ($err) {
							echo "cURL Error #:" . $err;
						} else {
							echo $response;
						}
					
				

Unpause recording

This api will work only recording enabled to call and it is already paused

Parameter Description
ucid caller's call sid
did KooKoo Number
api_key KooKoo API Key
					<?php
						$url = 'https://in-ccaas.ozonetel.com/api/v1/CallControl/UnpauseMonitor';
						$param = array(
						'phoneno' => '099xxxxxxxx',
						'did' => '91xxxxxxxx',
						'ucid' => "caller's call sid",
						'api_key'=>"KKXXXXX",
						);

						$url = $url . "?" . http_build_query($param, '&');
						$curl = curl_init();
						curl_setopt_array($curl, array(
						CURLOPT_URL => $url,
						CURLOPT_RETURNTRANSFER => true,
						CURLOPT_ENCODING => "",
						CURLOPT_MAXREDIRS => 10,
						CURLOPT_TIMEOUT => 30,
						CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
						CURLOPT_CUSTOMREQUEST => "GET",
						CURLOPT_HTTPHEADER => array(
						"Authorization: {{api_key}}"
						),
						));

						$response = curl_exec($curl);
						$err = curl_error($curl);
						curl_close($curl);
						if ($err) {
							echo "cURL Error #:" . $err;
						} else {
							echo $response;
						}
					
				

Call Mute

Mute the caller

Parameter Description
did KooKoo Number
api_key KooKoo API Key
ucid caller's call sid
phoneno caller's phone number
					<?php
						$url = 'https://in-ccaas.ozonetel.com/api/v1/CallControl/Mute';
						$param = array(
						'phoneno' => '099xxxxxxxx',
						'did' => '91xxxxxxxx',
						'ucid' => 'xxxx',
						'api_key'=>"KKXXXXX"
						);

						$url = $url . "?" . http_build_query($param, '&');
						$curl = curl_init();
						curl_setopt_array($curl, array(
						CURLOPT_URL => $url,
						CURLOPT_RETURNTRANSFER => true,
						CURLOPT_ENCODING => "",
						CURLOPT_MAXREDIRS => 10,
						CURLOPT_TIMEOUT => 30,
						CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
						CURLOPT_CUSTOMREQUEST => "GET",
						CURLOPT_HTTPHEADER => array(
						"Authorization: {{api_key}}"
						),
						));

						$response = curl_exec($curl);
						$err = curl_error($curl);
						curl_close($curl);
						if ($err) {
							echo "cURL Error #:" . $err;
						} else {
							echo $response;
						}
					
				

Un mute the caller

Un mute the caller's If caller is in mute by requested call mute api.

Parameter Description
phoneno caller number
api_key KooKoo API Key
did KooKoo Number
ucid caller's call ucid
					<?php
						$url = 'https://in-ccaas.ozonetel.com/api/v1/CallControl/UnMute';
						$param = array(
						'phoneno' => '099xxxxxxxx',
						'did' => '91xxxxxxxx',
						'ucid' => 'xxx',
						'api_key'=>"KKXXXXX"
						);

						$url = $url . "?" . http_build_query($param, '&');
						$curl = curl_init();
						curl_setopt_array($curl, array(
						CURLOPT_URL => $url,
						CURLOPT_RETURNTRANSFER => true,
						CURLOPT_ENCODING => "",
						CURLOPT_MAXREDIRS => 10,
						CURLOPT_TIMEOUT => 30,
						CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
						CURLOPT_CUSTOMREQUEST => "GET",
						CURLOPT_HTTPHEADER => array(
						"Authorization: {{api_key}}",
						),
						));

						$response = curl_exec($curl);
						$err = curl_error($curl);
						curl_close($curl);
						if ($err) {
							echo "cURL Error #:" . $err;
						} else {
							echo $response;
						}