• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/call/call.php
  • Класс: BitrixImCallCall
  • Вызов: Call::getLogToken
public function getLogToken(int $userId = 0, int $ttl = 3600) : string
{
	$userId = $userId ?: $this->getCurrentUserId();
	if(!$userId)
	{
		return  '';
	}

	if (Loader::includeModule("bitrix24") && defined('BX24_HOST_NAME'))
	{
		$portalId = BX24_HOST_NAME;
	}
	else if (defined('IM_CALL_LOG_HOST'))
	{
		$portalId = IM_CALL_LOG_HOST;
	}
	else
	{
		return '';
	}

	$secret = Option::get('im', 'call_log_secret');
	if ($secret == '')
	{
		return '';
	}

	return JWT::encode(
		[
			'prt' => $portalId,
			'call' => $this->getId(),
			'usr' => $userId,
			'exp' => (new DateTime())->getTimestamp() + $ttl
		],
		$secret
	);
}