- Модуль: voximplant
- Путь к файлу: ~/bitrix/modules/voximplant/classes/general/vi_rest.php
- Класс: CVoxImplantRestService
- Вызов: CVoxImplantRestService::startCallViaRest
static function startCallViaRest($params, $n, $server)
{
if ($server->getAuthType() !== BitrixRestSessionAuthAuth::AUTH_TYPE)
{
throw new BitrixRestRestException("This method is only available for internal usage.", "WRONG_AUTH_TYPE", CRestServer::STATUS_FORBIDDEN);
}
$callParams = is_array($params['PARAMS']) ? $params['PARAMS'] : [];
$userId = static::getCurrentUserId();
$isMobile = BitrixMainContext::getCurrent()->getRequest()->get('bx_mobile') === 'Y';
$callParams['IS_MOBILE'] = $isMobile;
$startResult = BitrixVoximplantRestHelper::startCall(
$params['NUMBER'],
$userId,
$params['LINE_ID'],
$callParams
);
$result = $startResult->toArray();
if ($startResult->isSuccess())
{
$callId = $result['DATA']['CALL_ID'];
$result['DATA']['CRM'] = CVoxImplantCrmHelper::GetDataForPopup($callId, $params['NUMBER'], $userId);
if ($params['SHOW'] === 'Y')
{
RestHelper::showExternalCall([
'USER_ID' => $userId,
'CALL_ID' => $callId
]);
}
}
return $result;
}