01acfa3b40
Type checking / changes (push) Has been cancelled
Type checking / test (push) Has been cancelled
Type checking / typescript-summary (push) Has been cancelled
Node tests / changes (push) Has been cancelled
Node tests / test (push) Has been cancelled
Node tests / test-summary (push) Has been cancelled
Источник: https://github.com/nextcloud/spreed/archive/refs/tags/v22.0.12.tar.gz С этого коммита ветка официального Nextcloud Talk отрезана (решение владельца 2026-07-06). Все дальнейшие изменения — только наши; версии релизов: 22.0.12-f7.N.
76 lines
2.2 KiB
PHP
76 lines
2.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
/**
|
|
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace OCA\Talk\SetupCheck;
|
|
|
|
use OCA\Talk\Config;
|
|
use OCP\IDBConnection;
|
|
use OCP\IL10N;
|
|
use OCP\SetupCheck\ISetupCheck;
|
|
use OCP\SetupCheck\SetupResult;
|
|
|
|
class SIPConfiguration implements ISetupCheck {
|
|
public function __construct(
|
|
protected readonly Config $talkConfig,
|
|
protected readonly IDBConnection $connection,
|
|
protected readonly IL10N $l,
|
|
) {
|
|
}
|
|
|
|
#[\Override]
|
|
public function getCategory(): string {
|
|
return 'talk';
|
|
}
|
|
|
|
#[\Override]
|
|
public function getName(): string {
|
|
$name = $this->l->t('SIP configuration');
|
|
if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_INTERNAL) {
|
|
return '[skip] ' . $name;
|
|
}
|
|
return $name;
|
|
}
|
|
|
|
#[\Override]
|
|
public function run(): SetupResult {
|
|
if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_INTERNAL) {
|
|
return SetupResult::success($this->l->t('Using the SIP functionality requires a High-performance backend.'));
|
|
}
|
|
|
|
$query = $this->connection->getQueryBuilder();
|
|
$query->select('phone_number')
|
|
->from('talk_phone_numbers')
|
|
->where($query->expr()->like('phone_number', $query->createNamedParameter(
|
|
$this->connection->escapeLikeParameter('+') . '%'
|
|
)))
|
|
->orWhere($query->expr()->like('phone_number', $query->createNamedParameter(
|
|
$this->connection->escapeLikeParameter('0') . '%'
|
|
)));
|
|
|
|
$result = $query->executeQuery();
|
|
$invalidNumbers = $result->fetchAll(\PDO::FETCH_COLUMN);
|
|
$result->closeCursor();
|
|
|
|
if (!empty($invalidNumbers)) {
|
|
$message = $this->l->t("Assigned Talk phone numbers must not start with + or 0. Please remove or update the following numbers:\n{list}");
|
|
$message = str_replace(
|
|
'{list}',
|
|
implode("\n", $invalidNumbers),
|
|
$message
|
|
);
|
|
return SetupResult::error($message, 'https://portal.nextcloud.com/article/Nextcloud-Talk/Nextcloud-Talk-Phone/Direct-Dial-in#content-provisioning');
|
|
}
|
|
|
|
if ($this->talkConfig->getSIPSharedSecret() === '' && $this->talkConfig->getDialInInfo() === '') {
|
|
return SetupResult::info($this->l->t('No SIP backend configured'));
|
|
}
|
|
|
|
return SetupResult::success();
|
|
}
|
|
}
|