• Модуль: messageservice
  • Путь к файлу: ~/bitrix/modules/messageservice/lib/sender/sms/smsednaru.php
  • Класс: BitrixMessageServiceSenderSmsSmsEdnaru
  • Вызов: SmsEdnaru::migrateToNewApi
public function migrateToNewApi(): void
{
	$oldRegistrar = new SMSOldRegistrar($this->getId(), $this->optionManager, $this->utils);

	if (!$this->canUse() && !$oldRegistrar->canUse())
	{
		return;
	}

	if ($this->getOption(InternalOption::SENDER_ID) !== null)
	{
		return;
	}

	$channelListResult = $this->utils->getChannelList(EdnaConstantsChannelType::SMS);

	$subjectIdList = [];
	foreach ($channelListResult->getData() as $channel)
	{
		if (isset($channel['active'], $channel['subjectId']) && $channel['active'] === true)
		{
			$subjectIdList[] = $channel['subjectId'];
			$this->utils->setCallback(
				$this->getCallbackUrl(),
				[
					EdnaConstantsCallbackType::MESSAGE_STATUS
				],
				$channel['subjectId']
			);
		}
	}
	$this->setOption(InternalOption::SENDER_ID, $subjectIdList);
	$this->setNewApi(true);
}