• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/classes/general/vi_rest.php
  • Класс: CVoxImplantRestService
  • Вызов: CVoxImplantRestService::sipDelete
static function sipDelete($arParams, $nav, $server)
{
	$permissions = SecurityPermissions::createWithCurrentUser();
	if (!$permissions->canPerform(SecurityPermissions::ENTITY_LINE, SecurityPermissions::ACTION_MODIFY))
	{
		throw new BitrixRestAccessException();
	}

	$arParams = array_change_key_case($arParams, CASE_UPPER);
	$arParams["CONFIG_ID"] ??= null;

	$dbResCnt = BitrixVoximplantSipTable::getList([
		'filter' => [
			'CONFIG_ID' => $arParams["CONFIG_ID"],
			'APP_ID' => $server->getAppId()
		],
		'select' => ["CNT" => new BitrixMainEntityExpressionField('CNT', 'COUNT(1)')],
	]);
	$arResCnt = $dbResCnt->fetch();
	if (!$arResCnt || $arResCnt["CNT"] <= 0)
	{
		throw new BitrixRestRestException("Specified CONFIG_ID is not found", BitrixRestRestException::ERROR_NOT_FOUND, CRestServer::STATUS_WRONG_REQUEST);
	}

	$viSip = new CVoxImplantSip();
	$result = $viSip->Delete($arParams['CONFIG_ID']);
	if (!$result || $viSip->GetError()->error)
	{
		throw new BitrixRestRestException($viSip->GetError()->msg, $viSip->GetError()->code, CRestServer::STATUS_WRONG_REQUEST);
	}

	return 1;
}