Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Legend:
| `call_recording_summary` | bool | `true` | No | 🖌️ | Whether call recordings should automatically be summarized when a transcription and summary provider is enabled. |
| `call_recording_transcription` | bool | `false` | Yes | | Whether call recordings should automatically be transcribed when a transcription provider is enabled. |
| `call_recording_summary_prompt` | string | `''` | No | | Instructions used by LLM to generate Talk call recording summaries |
| `sip_dialout` | string<br>`yes` or `no` | `no` | Yes | | SIP dial-out is allowed when a SIP bridge is configured |
| `sip_bridge_dialout` | bool | `false` | Yes | | SIP dial-out is allowed when a SIP bridge is configured |
| `federation_enabled` | bool | `false` | Yes | | 🏗️ *Work in progress:* Whether or not federation with this instance is allowed |
| `federation_incoming_enabled` | string<br>`1` or `0` | `1` | Yes | | 🏗️ *Work in progress:* Whether users of this instance can be invited to federated conversations |
| `federation_outgoing_enabled` | string<br>`1` or `0` | `1` | Yes | | 🏗️ *Work in progress:* Whether users of this instance can invite federated users into conversations |
Expand Down
2 changes: 1 addition & 1 deletion lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public function getCapabilities(): array {
// 'predefined-backgrounds-v2' => list<string>,
'can-upload-background' => false,
'sip-enabled' => $this->talkConfig->isSIPConfigured(),
'sip-dialout-enabled' => $this->talkConfig->isSIPDialOutEnabled(),
'sip-dialout-enabled' => $this->appConfig->getAppValueBool(Config::SIP_BRIDGE_DIALOUT),
'default-phone-region' => $this->serverConfig->getSystemValueString('default_phone_region'),
'can-enable-sip' => false,
'start-without-media' => $this->talkConfig->getCallsStartWithoutMedia($user?->getUID()),
Expand Down
28 changes: 11 additions & 17 deletions lib/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ class Config {
public const string HOSTED_SIGNALING_SERVER_ACCOUNT = 'hosted_signaling_server_account';
public const string HOSTED_SIGNALING_SERVER_NONCE = 'hosted_signaling_server_nonce';
public const string HOSTED_SIGNALING_SERVER_ACCOUNT_ID = 'hosted_signaling_server_account_id';
public const string SIP_BRIDGE_DIALIN_INFO = 'sip_bridge_dialin_info';
public const string SIP_BRIDGE_DIALOUT_ANONYMOUS = 'sip_bridge_dialout_anonymous';
public const string SIP_BRIDGE_DIALOUT_NUMBER = 'sip_bridge_dialout_number';
public const string SIP_BRIDGE_DIALOUT_PREFIX = 'sip_bridge_dialout_prefix';
public const string SIP_BRIDGE_SHARED_SECRET = 'sip_bridge_shared_secret';
public const string SIP_BRIDGE_DIALOUT = 'sip_bridge_dialout';

/**
* 1. Call recording, …
Expand Down Expand Up @@ -177,8 +183,8 @@ public function getSIPGroups(): array {
}

public function isSIPConfigured(): bool {
return $this->getSIPSharedSecret() !== ''
&& $this->getDialInInfo() !== '';
return $this->appConfig->getAppValueString(self::SIP_BRIDGE_SHARED_SECRET) !== ''
&& $this->appConfig->getAppValueString(self::SIP_BRIDGE_DIALIN_INFO) !== '';
}

/**
Expand All @@ -204,15 +210,7 @@ public function isBreakoutRoomsEnabled(): bool {
}

public function isConversationSubfoldersEnabled(): bool {
return $this->appConfig->getAppValueBool(self::CONVERSATION_SUBFOLDERS, true);
}

public function getDialInInfo(): string {
return $this->config->getAppValue('spreed', 'sip_bridge_dialin_info');
}

public function getSIPSharedSecret(): string {
return $this->config->getAppValue('spreed', 'sip_bridge_shared_secret');
return $this->appConfig->getAppValueBool(self::CONVERSATION_SUBFOLDERS);
}

public function canUserEnableSIP(IUser $user): bool {
Expand All @@ -222,7 +220,7 @@ public function canUserEnableSIP(IUser $user): bool {

$this->canEnableSIP[$user->getUID()] = false;

$allowedGroups = $this->getSIPGroups();
$allowedGroups = $this->appConfig->getAppValueArray(self::ALLOWED_GROUPS_SIP);
if (empty($allowedGroups)) {
$this->canEnableSIP[$user->getUID()] = true;
} else {
Expand All @@ -234,17 +232,13 @@ public function canUserEnableSIP(IUser $user): bool {
}

public function canUserDialOutSIP(IUser $user): bool {
if (!$this->isSIPDialOutEnabled()) {
if (!$this->appConfig->getAppValueBool(Config::SIP_BRIDGE_DIALOUT)) {
return false;
}

return $this->canUserEnableSIP($user);
}

public function isSIPDialOutEnabled(): bool {
return $this->config->getAppValue('spreed', 'sip_dialout', 'no') !== 'no';
}

public function getRecordingServers(): array {
$recording = $this->appConfig->getAppValueArray(self::RECORDING_SERVERS);
return $recording['servers'] ?? [];
Expand Down
6 changes: 6 additions & 0 deletions lib/ConfigLexicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ public function getAppConfigs(): array {
new Entry(Config::HOSTED_SIGNALING_SERVER_ACCOUNT, ValueType::ARRAY, [], definition: 'Account information of the hosted signaling server', flags: IAppConfig::FLAG_SENSITIVE, rename: 'hosted-signaling-server-account'),
new Entry(Config::HOSTED_SIGNALING_SERVER_NONCE, ValueType::STRING, '', definition: 'Temporary nonce while configuring the hosted signaling server', flags: IAppConfig::FLAG_SENSITIVE, rename: 'hosted-signaling-server-nonce'),
new Entry(Config::HOSTED_SIGNALING_SERVER_ACCOUNT_ID, ValueType::STRING, '', definition: 'Account identifier of the hosted signaling server', flags: IAppConfig::FLAG_SENSITIVE, rename: 'hosted-signaling-server-account-id'),
new Entry(Config::SIP_BRIDGE_DIALIN_INFO, ValueType::STRING, '', definition: 'Additional information added in the SIP dial-in invitation mail and sidebar', flags: IAppConfig::FLAG_SENSITIVE),
new Entry(Config::SIP_BRIDGE_DIALOUT_ANONYMOUS, ValueType::BOOL, false, definition: 'When set to true, all out-going SIP calls will be anonymous calls (CLIR)'),
new Entry(Config::SIP_BRIDGE_DIALOUT_NUMBER, ValueType::STRING, '', definition: 'Fallback phone number that is used as caller for out-going calls when the user has no phone-number configured (has to be E164 `+49123456789` formatted'),
new Entry(Config::SIP_BRIDGE_DIALOUT_PREFIX, ValueType::STRING, '+', definition: 'Deprecated: Only used for direct dial-in from older SIP bridges, which send phone numbers without this prefix', deprecated: true),
new Entry(Config::SIP_BRIDGE_SHARED_SECRET, ValueType::STRING, '', definition: 'Shared secret allowing the SIP bridge to authenticate on the Nextcloud server', flags: IAppConfig::FLAG_SENSITIVE),
new Entry(Config::SIP_BRIDGE_DIALOUT, ValueType::BOOL, false, definition: 'SIP dial-out is allowed when a SIP bridge is configured', rename: 'sip_dialout'),
];
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Controller/CallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,10 @@ public function sipDialOut(int $attendeeId): DataResponse {
}

$callerNumber = true;
if ($this->appConfig->getAppValueBool('sip_bridge_dialout_anonymous')) {
if ($this->appConfig->getAppValueBool(Config::SIP_BRIDGE_DIALOUT_ANONYMOUS)) {
$callerNumber = false;
} elseif ($this->appConfig->getAppValueString('sip_bridge_dialout_number') !== '') {
$callerNumber = $this->appConfig->getAppValueString('sip_bridge_dialout_number');
} elseif ($this->appConfig->getAppValueString(Config::SIP_BRIDGE_DIALOUT_NUMBER) !== '') {
$callerNumber = $this->appConfig->getAppValueString(Config::SIP_BRIDGE_DIALOUT_NUMBER);
}

// No elseif, so we have the fallback to sip_bridge_dialout_number when the caller is no user or doesn't have a number
Expand Down
13 changes: 6 additions & 7 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ protected function getTalkHashHeader(): array {
$this->config->getAppValue('spreed', 'federation_enabled'),
json_encode($this->appConfig->getAppValueArray(Config::ALLOWED_GROUPS_SIP)),
$this->appConfig->getAppValueBool(Config::MATTERBRIDGE_ENABLED),
$this->config->getAppValue('spreed', 'sip_bridge_dialin_info'),
$this->config->getAppValue('spreed', 'sip_bridge_shared_secret'),
$this->appConfig->getAppValueInt(Config::RECORDING_CONSENT),
$this->appConfig->getAppValueString(Config::SIP_BRIDGE_DIALIN_INFO),
$this->appConfig->getAppValueString(Config::SIP_BRIDGE_SHARED_SECRET),
$this->appConfig->getAppValueBool(Config::CALL_RECORDING_TRANSCRIPTION),
$this->appConfig->getAppValueBool(Config::CALL_RECORDING_SUMMARY),
$this->config->getAppValue('theming', 'cachebuster', '1'),
Expand Down Expand Up @@ -588,7 +588,7 @@ public function getNoteToSelfConversation(): DataResponse {
private function validateSIPBridgeRequest(string $token): bool {
$random = $this->request->getHeader('talk-sipbridge-random');
$checksum = $this->request->getHeader('talk-sipbridge-checksum');
$secret = $this->talkConfig->getSIPSharedSecret();
$secret = $this->appConfig->getAppValueString(Config::SIP_BRIDGE_SHARED_SECRET);
return $this->checksumVerificationService->validateRequest($random, $checksum, $secret, $token);
}

Expand Down Expand Up @@ -843,8 +843,7 @@ public function createRoom(
$sipEnabled = Webinary::SIP_DISABLED;
} elseif ($sipEnabled !== Webinary::SIP_DISABLED
&& $this->forcedParameters->getForcedParameter(Parameter::SIP_ENABLED) === null
&& (!$this->talkConfig->isSIPConfigured()
|| !$this->talkConfig->canUserEnableSIP($user))) {
&& (!$this->talkConfig->isSIPConfigured() || !$this->talkConfig->canUserEnableSIP($user))) {
if ($sipEnabled === $this->defaultParameters->getParameters()[Parameter::SIP_ENABLED->value]) {
// Clients send the administrator configured default value also when the
// user did not request SIP themselves, so it is silently disabled instead.
Expand Down Expand Up @@ -2743,7 +2742,7 @@ public function directDialIn(string $phoneNumber, string $caller): DataResponse
'token' => '[a-z0-9]{4,30}',
])]
public function verifyDialOutNumber(string $number, array $options = []): DataResponse {
if (!$this->talkConfig->isSIPConfigured() || !$this->talkConfig->isSIPDialOutEnabled()) {
if (!$this->talkConfig->isSIPConfigured() || !$this->appConfig->getAppValueBool(Config::SIP_BRIDGE_DIALOUT)) {
return new DataResponse(null, Http::STATUS_NOT_IMPLEMENTED);
}

Expand Down Expand Up @@ -2841,7 +2840,7 @@ public function createGuestByDialIn(): DataResponse {
'token' => '[a-z0-9]{4,30}',
])]
public function rejectedDialOutRequest(string $callId, array $options = []): DataResponse {
if (!$this->talkConfig->isSIPConfigured() || !$this->talkConfig->isSIPDialOutEnabled()) {
if (!$this->talkConfig->isSIPConfigured() || !$this->appConfig->getAppValueBool(Config::SIP_BRIDGE_DIALOUT)) {
return new DataResponse(null, Http::STATUS_NOT_IMPLEMENTED);
}

Expand Down
12 changes: 7 additions & 5 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
namespace OCA\Talk\Controller;

use OCA\Talk\AuditLog\Operation;
use OCA\Talk\Config;
use OCA\Talk\Settings\BeforePreferenceSetEventListener;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\ApiRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\OpenAPI;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\AppFramework\Services\IAppConfig;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IGroup;
Expand All @@ -30,6 +32,7 @@ public function __construct(
string $appName,
IRequest $request,
private readonly IConfig $config,
private readonly IAppConfig $appConfig,
private readonly IGroupManager $groupManager,
private readonly BeforePreferenceSetEventListener $preferenceListener,
private readonly ?string $userId,
Expand Down Expand Up @@ -89,11 +92,10 @@ public function setSIPSettings(
}
}

$sharedSecretChanged = $this->config->getAppValue('spreed', 'sip_bridge_shared_secret') !== $sharedSecret;

$this->config->setAppValue('spreed', 'sip_bridge_groups', json_encode($groups));
$this->config->setAppValue('spreed', 'sip_bridge_dialin_info', $dialInInfo);
$this->config->setAppValue('spreed', 'sip_bridge_shared_secret', $sharedSecret);
$sharedSecretChanged = $this->appConfig->getAppValueString(Config::SIP_BRIDGE_SHARED_SECRET) !== $sharedSecret;
$this->appConfig->setAppValueArray(Config::ALLOWED_GROUPS_SIP, $groups);
$this->appConfig->setAppValueString(Config::SIP_BRIDGE_DIALIN_INFO, $dialInInfo);
$this->appConfig->setAppValueString(Config::SIP_BRIDGE_SHARED_SECRET, $sharedSecret);

$this->dispatcher->dispatchTyped(new CriticalActionPerformedEvent(
'SIP bridge settings were changed: groups "{sipGroups}", shared secret {sharedSecret}',
Expand Down
6 changes: 4 additions & 2 deletions lib/Controller/SignalingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use OCP\AppFramework\Http\Attribute\RequestHeader;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\AppFramework\Services\IAppConfig;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\DB\Exception;
use OCP\EventDispatcher\IEventDispatcher;
Expand All @@ -60,6 +61,7 @@ public function __construct(
string $appName,
IRequest $request,
private readonly Config $talkConfig,
private readonly IAppConfig $appConfig,
private readonly \OCA\Talk\Signaling\Manager $signalingManager,
private readonly ISession $serverSession,
private readonly TalkSession $session,
Expand Down Expand Up @@ -119,7 +121,7 @@ private function validateRecordingBackendRequest(string $data): bool {
private function validateSIPBridgeRequest(string $data): bool {
$random = $this->request->getHeader('talk-sipbridge-random');
$checksum = $this->request->getHeader('talk-sipbridge-checksum');
$secret = $this->talkConfig->getSIPSharedSecret();
$secret = $this->appConfig->getAppValueString(Config::SIP_BRIDGE_SHARED_SECRET);
try {
return $this->checksumVerificationService->validateRequest($random, $checksum, $secret, $data);
} catch (UnauthorizedException) {
Expand Down Expand Up @@ -269,7 +271,7 @@ public function getSettings(string $token = ''): DataResponse {
'federation' => $this->getFederationSettings($room),
'stunservers' => $stun,
'turnservers' => $turn,
'sipDialinInfo' => $this->talkConfig->isSIPConfigured() ? $this->talkConfig->getDialInInfo() : '',
'sipDialinInfo' => $this->talkConfig->isSIPConfigured() ? $this->appConfig->getAppValueString(Config::SIP_BRIDGE_DIALIN_INFO) : '',
];

if ($signalingMode !== Config::SIGNALING_INTERNAL) {
Expand Down
4 changes: 3 additions & 1 deletion lib/GuestManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use OCA\Talk\Service\ParticipantService;
use OCA\Talk\Service\PollService;
use OCA\Talk\Service\RoomService;
use OCP\AppFramework\Services\IAppConfig;
use OCP\Defaults;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IDateTimeZone;
Expand All @@ -35,6 +36,7 @@
class GuestManager {
public function __construct(
private readonly Config $talkConfig,
private readonly IAppConfig $appConfig,
private readonly IEmailValidator $emailValidator,
private readonly IMailer $mailer,
private readonly Defaults $defaults,
Expand Down Expand Up @@ -284,7 +286,7 @@ public function sendEmailInvitation(Room $room, Participant $participant): void
$template->addBodyText($this->l->t('You can also dial-in via phone with the following details'));

$template->addBodyListItem(
$this->talkConfig->getDialInInfo(),
$this->appConfig->getAppValueString(Config::SIP_BRIDGE_DIALIN_INFO),
$this->l->t('Dial-in information'),
$this->url->getAbsoluteURL($this->url->imagePath('spreed', 'phone.png'))
);
Expand Down
14 changes: 7 additions & 7 deletions lib/Settings/Admin/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,15 +461,15 @@ protected function initRecording(): void {
}

protected function initSIPBridge(): void {
$groups = $this->getGroupDetailsArray($this->talkConfig->getSIPGroups(), 'sip_bridge_groups');
$groups = $this->getGroupDetailsArray($this->appConfig->getAppValueArray(Config::ALLOWED_GROUPS_SIP), Config::ALLOWED_GROUPS_SIP);

$this->initialState->provideInitialState('sip_bridge_groups', $groups);
$this->initialState->provideInitialState('sip_bridge_shared_secret', $this->talkConfig->getSIPSharedSecret());
$this->initialState->provideInitialState('sip_bridge_dialin_info', $this->talkConfig->getDialInInfo());
$this->initialState->provideInitialState('sip_bridge_dialout', $this->talkConfig->isSIPDialOutEnabled());
$this->initialState->provideInitialState('sip_bridge_dialout_anonymous', $this->appConfig->getAppValueBool('sip_bridge_dialout_anonymous'));
$this->initialState->provideInitialState('sip_bridge_dialout_number', $this->serverConfig->getAppValue('spreed', 'sip_bridge_dialout_number', ''));
$this->initialState->provideInitialState('sip_bridge_dialout_prefix', $this->serverConfig->getAppValue('spreed', 'sip_bridge_dialout_prefix', '+'));
$this->initialState->provideInitialState('sip_bridge_shared_secret', $this->appConfig->getAppValueString(Config::SIP_BRIDGE_SHARED_SECRET));
$this->initialState->provideInitialState('sip_bridge_dialin_info', $this->appConfig->getAppValueString(Config::SIP_BRIDGE_DIALIN_INFO));
$this->initialState->provideInitialState('sip_bridge_dialout', $this->appConfig->getAppValueBool(Config::SIP_BRIDGE_DIALOUT));
$this->initialState->provideInitialState('sip_bridge_dialout_anonymous', $this->appConfig->getAppValueBool(Config::SIP_BRIDGE_DIALOUT_ANONYMOUS));
$this->initialState->provideInitialState('sip_bridge_dialout_number', $this->appConfig->getAppValueString(Config::SIP_BRIDGE_DIALOUT_NUMBER));
$this->initialState->provideInitialState('sip_bridge_dialout_prefix', $this->appConfig->getAppValueString(Config::SIP_BRIDGE_DIALOUT_PREFIX));
}

protected function getGroupDetailsArray(array $gids, string $configKey): array {
Expand Down
3 changes: 1 addition & 2 deletions lib/SetupCheck/SIPConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public function run(): SetupResult {
return SetupResult::success($this->l->t('Using the SIP functionality requires a High-performance backend.'));
}

if ($this->talkConfig->getSIPSharedSecret() === ''
&& $this->talkConfig->getDialInInfo() === ''
if (!$this->talkConfig->isSIPConfigured()
&& $this->appConfig->getAppValueInt(Config::FEATURE_HINTS_HIDDEN) < 34) {
return SetupResult::info($this->l->t('No SIP backend configured'));
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/AdminSettings/SIPBridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export default {
dialInInfo: this.dialInInfo,
})
if (this.currentSetup.dialOutEnabled !== this.dialOutEnabled) {
await OCP.AppConfig.setValue('spreed', 'sip_dialout', this.dialOutEnabled ? 'yes' : 'no')
await OCP.AppConfig.setValue('spreed', 'sip_bridge_dialout', this.dialOutEnabled.toString())
}
if (this.currentSetup.dialOutAnonymous !== this.dialOutAnonymous) {
await OCP.AppConfig.setValue('spreed', 'sip_bridge_dialout_anonymous', String(this.dialOutAnonymous))
Expand Down
Loading
Loading