• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/routing/router.php
  • Класс: BitrixVoximplantRoutingRouter
  • Вызов: Router::buildUserGraph
static function buildUserGraph($userId, $connectType, $skipRule, $passIfBusy = false)
{
	$firstNode = new User($userId, $connectType, $skipRule, $passIfBusy);
	$lastNode = $firstNode;

	if($skipRule == CVoxImplantIncoming::RULE_PSTN)
	{
		$userPhone = CVoxImplantPhone::GetUserPhone($userId);
		if($userPhone)
		{
			$lastNode = new Pstn(CVoxImplantPhone::stripLetters($userPhone), CVoxImplantIncoming::RULE_VOICEMAIL, $userId);
		}
		else
		{
			$lastNode = new Voicemail($userId, 'User '. $userId .' have no phone number in the profile');
		}
	}
	else if($skipRule == CVoxImplantIncoming::RULE_QUEUE)
	{
		// move to the next node
	}
	else if($skipRule == CVoxImplantIncoming::RULE_VOICEMAIL)
	{
		$lastNode = new Voicemail($userId, 'Call skipped by rule voicemail. Connect type is ' . $connectType);;
	}
	else
	{
		$lastNode = new Hangup('480', 'Unknown rule ' . $skipRule);
	}

	if($lastNode !== $firstNode)
	{
		$firstNode->setNext($lastNode);
	}

	return [$firstNode, $lastNode];
}