Skip to content

Commit

Permalink
fix(docs): Add capability configs for all the SIP states
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Oct 13, 2023
1 parent 297d15c commit 4cd9191
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,9 @@
* `session-state` - Sessions can mark themselves as inactive, so the participant receives notifications again
* `note-to-self` - Support for "Note-to-self" conversation exists
* `recording-consent` - Whether admins and moderators can require recording consent before joining a call
* `sip-support-dialout` - Whether admins can enable SIP dial-out
* `config => chat => has-translation-providers` - When true, translation tuples can be loaded from the [OCS Translation API](https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-translation-api.html#get-available-translation-options).
* `config => call => recording-consent` - Whether users need to consent into call recording before joining a call (see [constants list](constants.md#recording-consent-required))
* `config => call => sip-enabled` - Whether SIP is configured on the server allowing for SIP dial-in
* `config => call => sip-dialout-enabled` - Whether SIP dial-out is configured on the server, additionally requires `config => call => sip-enabled`
* `config => call => can-enable-sip` - Whether the current user is a member of the groups that are allowed to enable SIP dial-in on a conversation or use SIP dial-out
7 changes: 7 additions & 0 deletions lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public function __construct(
* supported-reactions: string[],
* predefined-backgrounds: string[],
* can-upload-background: bool,
* sip-enabled: bool,
* sip-dialout-enabled: bool,
* can-enable-sip: bool,
* },
* chat: array{
* max-length: int,
Expand Down Expand Up @@ -177,6 +180,8 @@ public function getCapabilities(): array {
'recording' => $this->talkConfig->isRecordingEnabled(),
'recording-consent' => $this->talkConfig->recordingConsentRequired(),
'supported-reactions' => ['❀️', 'πŸŽ‰', 'πŸ‘', 'πŸ‘', 'πŸ‘Ž', 'πŸ˜‚', '🀩', 'πŸ€”', '😲', 'πŸ˜₯'],
'sip-enabled' => $this->talkConfig->isSIPConfigured(),
'sip-dialout-enabled' => $this->talkConfig->isSIPDialOutEnabled(),
],
'chat' => [
'max-length' => ChatManager::MAX_CHAT_LENGTH,
Expand Down Expand Up @@ -260,8 +265,10 @@ public function getCapabilities(): array {
$quota = Util::computerFileSize($quota);
}
$capabilities['config']['call']['can-upload-background'] = $quota === 'none' || $quota > 0;
$capabilities['config']['call']['can-enable-sip'] = $this->talkConfig->canUserEnableSIP($user);
} else {
$capabilities['config']['call']['can-upload-background'] = false;
$capabilities['config']['call']['can-enable-sip'] = false;
}

return [
Expand Down
7 changes: 7 additions & 0 deletions tests/php/CapabilitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public function setUp(): void {
'session-state',
'note-to-self',
'recording-consent',
'sip-support-dialout',
'message-expiration',
'reactions',
];
Expand Down Expand Up @@ -193,6 +194,8 @@ public function testGetCapabilitiesGuest(): void {
'recording' => false,
'recording-consent' => 0,
'supported-reactions' => ['❀️', 'πŸŽ‰', 'πŸ‘', 'πŸ‘', 'πŸ‘Ž', 'πŸ˜‚', '🀩', 'πŸ€”', '😲', 'πŸ˜₯'],
'sip-enabled' => false,
'sip-dialout-enabled' => false,
'predefined-backgrounds' => [
'1_office.jpg',
'2_home.jpg',
Expand All @@ -204,6 +207,7 @@ public function testGetCapabilitiesGuest(): void {
'8_space_station.jpg',
],
'can-upload-background' => false,
'can-enable-sip' => false,
],
'chat' => [
'max-length' => 32000,
Expand Down Expand Up @@ -318,6 +322,8 @@ public function testGetCapabilitiesUserAllowed(bool $isNotAllowed, bool $canCrea
'recording' => false,
'recording-consent' => 0,
'supported-reactions' => ['❀️', 'πŸŽ‰', 'πŸ‘', 'πŸ‘', 'πŸ‘Ž', 'πŸ˜‚', '🀩', 'πŸ€”', '😲', 'πŸ˜₯'],
'sip-enabled' => false,
'sip-dialout-enabled' => false,
'predefined-backgrounds' => [
'1_office.jpg',
'2_home.jpg',
Expand All @@ -329,6 +335,7 @@ public function testGetCapabilitiesUserAllowed(bool $isNotAllowed, bool $canCrea
'8_space_station.jpg',
],
'can-upload-background' => $canUpload,
'can-enable-sip' => false,
],
'chat' => [
'max-length' => 32000,
Expand Down

0 comments on commit 4cd9191

Please sign in to comment.