We have done our best to make integration as simple as possible.
Common Integration Approach
<?php
$queryUrl = 'https://xxx.bitrix24.com/rest/1/yyyyxxx000111/telephony.externalcall.register.json';
$queryData = http_build_query(array(
'USER_ID' => 1,
'PHONE_NUMBER' => '555666777',
'TYPE' => 2,
'CALL_START_DATE' => '2016-16-11 10:10',
'CRM_CREATE' => true
));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
));
$result = curl_exec($curl);
curl_close($curl);
$result = json_decode($result, 1);
Use any queue logic!
<?php
$queryUrl = 'https://xxx.bitrix24.com/rest/1/yyyyxxx000111/telephony.externalcall.hide.json';
$queryData = http_build_query(array(
'CALL_ID' => 'externalCall.a2fc40b56aa869141cc6aa2d2a965ba6.1478527542', // from telephony.externalcall.register
'USER_ID' => 1 // hide the call details form from user 1's screen
));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
));
$result = curl_exec($curl);
curl_close($curl);
$queryUrl = 'https://xxx.bitrix24.com/rest/1/yyyyxxx000111/telephony.externalcall.show.json';
$queryData = http_build_query(array(
'CALL_ID' => 'externalCall.a2fc40b56aa869141cc6aa2d2a965ba6.1478527542', // from telephony.externalcall.register,
'USER_ID' => 6 // show the call details form to user 6
));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
));
$result = curl_exec($curl);
curl_close($curl);
Direct Calls from the CRM!
specify your handler's URL in the outbound webhook preferences
https://your_server/your_webhook_script.php
handler code
<?php
/*
Bitrix24 passes $_REQUEST to the handler containing the following data:
array(
'PHONE_NUMBER' => '555666777', // number to dial
'USER_ID' => '1', // the ID of a user initiating the call
'CRM_ENTITY_TYPE' => 'LEAD', // type of a CRM object whose details form the user opened to make the call
'CRM_ENTITY_ID' => '248' // the ID of the respective CRM entity
)
*/
// register the outbound call
$queryUrl = 'https://xxx.bitrix24.com/rest/1/yyyyxxx000111/telephony.externalcall.register.json';
$queryData = http_build_query(array(
'USER_ID' => $_REQUEST['USER_ID'],
'PHONE_NUMBER' => $_REQUEST['USER_ID'],
'TYPE' => 1, // outbound call
'CALL_START_DATE' => '2016-16-11 10:10',
'CRM_CREATE' => false,
'CRM_ENTITY_TYPE' => $_REQUEST['CRM_ENTITY_TYPE'],
'CRM_ENTITY_ID' => $_REQUEST['CRM_ENTITY_ID']
));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
));
$result = curl_exec($curl);
curl_close($curl);
$result = json_decode($result, 1);
View the details and listen to the call recording without leaving the CRM!
<?php
$queryUrl = 'https://xxx.bitrix24.com/rest/1/yyyyxxx000111/telephony.externalcall.finish.json';
$queryData = http_build_query(array(
'CALL_ID' => 'externalCall.733e885003cbac98d92b811806caeaea.1478528885', // from telephony.externalcall.register
'DURATION' => '120', // call length, seconds
'STATUS_CODE' => 200, // status: success
'RECORD_URL' => 'http://your_server/call_record.mp3', // save call recording from this URL
));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
));
$result = curl_exec($curl);
curl_close($curl);
$result = json_decode($result, 1);
Read to the documentation and view an example of a local application.
Cookies: This website uses cookies for analytical and technical reasons. ‘Analytical Cookies’ are inserted by Google Analytics to help us understand which countries our visitors come from, which pages they visit and what actions they take on this site. ‘Strictly Necessary Cookies’, as the name implies, are a type of cookies that are required for proper functioning of certain features of this website, such as the ability to use live chat. Disabling these cookies will disable access to those features and degrade your website experience.
Cookies of both types can be enabled or disabled within this plugin.
More information about our Cookie Policy