• Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/preset/templates/audiocall.php
  • Класс: BitrixSenderPresetTemplatesAudioCall
  • Вызов: AudioCall::getMetadata
static function getMetadata()
{
	static $failed = false;
	if ($failed)
	{
		return false;
	}

	$cacheTtl = 86400; // 24 hours
	$cacheId = 'sender_audiocall_metadata';
	$cachePath = '/sender/audiocall_metadata/';
	$cache = BitrixMainApplication::getInstance()->getCache();
	if($cache->initCache($cacheTtl, $cacheId, $cachePath))
	{
		return $cache->getVars();
	}
	else
	{
		$result = false;

		$cache->startDataCache();

		$request = new HttpClient([
			"socketTimeout" => 5,
			"streamTimeout" => 5
		]);
		$request->get(static::METADATA_FILE);
		if($request->getStatus() == 200)
		{
			try
			{
				$result = Json::decode($request->getResult());
			}
			catch (ArgumentException $e)
			{
			}
		}
		if (is_array($result))
		{
			$cache->endDataCache($result);
		}
		else
		{
			$failed = true;
			$cache->abortDataCache();
		}
		return $result;
	}
}