Features of customization after Bitrix24 23.300.0 update

To be able to make click-to-call from the boxed version of Bitrix24 in a closed network, you need to:

In the 1C-Bitrix24 administrative interface (<portal_address>/bitrix) under Content → Site Structure → Files and Folders

  1. Let's check if there is a file in which we will make changes at the following path local/php_interface/init.php

If there is no such file, we will change the contents of the bitrix/php_interface/init.php file or init.php for a specific file.

  1. Add the following code to init.php

\Bitrix\Main\Loader::includeModule('rest');
class MyEventProvider extends \Bitrix\Rest\Event\ProviderOAuth
{
   public function send(array $queryData)
   {
      $http = new \Bitrix\Main\Web\HttpClient();
      foreach($queryData as $key => $item)
      {
         if(preg_match('/192\.168\./', $item['query']['QUERY_URL'])) // directly sending handlers, having  192.168. in the address
         {
            $http->post($item['query']['QUERY_URL'], $item['query']['QUERY_DATA']);
            unset($queryData[$key]);
         }
      }
      if(count($queryData) > 0)
      {
         parent::send(array_values($queryData)); // all the rest is to be sent via the standard mechanism
      }
   }
}
\Bitrix\Rest\Event\Sender::setProvider(MyEventProvider::instance());
  1. In this code you need to change the template '/192.168./' in the preg_match function: it should contain the address to which click-to-call requests will be sent, it should be the address to which the Bitrix24 server can access the module's admin area, for example, if the module's admin area is available at example.com:8077, then the template will be '/example.com:8077/'.

  2. The same address for click-to-call requests should be specified in the module settings, in the Bitrix24 section:

If you do not use the code above, the Asterisk server must allow incoming requests from https://oauth.bitrix.info address.

To get IP addresses from which incoming requests can come, you can use the following commands:

curl https://dl.bitrix24.com/webhook/app.json

curl https://dl.bitrix24.com/webhook/app-world.json

Last updated