• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/call.php
  • Класс: BitrixVoximplantCall
  • Вызов: Call::loadExternal
static function loadExternal($externalCallId)
{
	if(static::$externalInstances[$externalCallId])
	{
		return static::$externalInstances[$externalCallId];
	}

	$fields = CallTable::getRow([
		'filter' => [
			'=EXTERNAL_CALL_ID' => $externalCallId
		]
	]);
	if(!$fields)
	{
		return false;
	}

	$users = [];
	$cursor = CallUserTable::getList([
		'select' => ['USER_ID', 'ROLE', 'STATUS'],
		'filter' => ['=CALL_ID' => $fields['CALL_ID']]
	]);

	while ($row = $cursor->fetch())
	{
		$users[$row['USER_ID']] = $row;
	}

	$instance = new static();
	static::$externalInstances[$externalCallId] = $instance;

	$instance->fromArray($fields);
	$instance->users = $users;
	return $instance;
}