• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/classes/general/vi_rest.php
  • Класс: CVoxImplantRestService
  • Вызов: CVoxImplantRestService::signOneTimeKey
static function signOneTimeKey($params, $n, $server)
{
	$allowedAuthTypes = [BitrixRestSessionAuthAuth::AUTH_TYPE => true];
	if (Loader::includeModule('im') && class_exists('BitrixImCallAuth'))
	{
		$allowedAuthTypes[BitrixImCallAuth::AUTH_TYPE] = true;
	}
	if (!isset($allowedAuthTypes[$server->getAuthType()]))
	{
		throw new BitrixRestRestException("This method is only available for internal usage.", "WRONG_AUTH_TYPE", CRestServer::STATUS_FORBIDDEN);
	}

	$voxMain = new CVoxImplantMain(static::getCurrentUserId());
	$result = $voxMain->GetOneTimeKey($_POST['KEY']);
	if (!$result)
	{
		throw new BitrixRestRestException($voxMain->GetError()->msg, $voxMain->GetError()->code);
	}

	return [
		'HASH' => $result,
		'ERROR' => ''
	];
}