diff --git a/docs/capabilities.md b/docs/capabilities.md index f4388a5614..c5a10c093d 100644 --- a/docs/capabilities.md +++ b/docs/capabilities.md @@ -132,5 +132,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 diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 53996f09e8..b8b3356727 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -70,6 +70,9 @@ class Capabilities implements IPublicCapability { * 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, @@ -178,6 +181,8 @@ class Capabilities implements IPublicCapability { '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, @@ -261,8 +266,10 @@ class Capabilities implements IPublicCapability { $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 [ diff --git a/openapi.json b/openapi.json index c2d151307d..f7c26648ca 100644 --- a/openapi.json +++ b/openapi.json @@ -655,7 +655,10 @@ "recording-consent", "supported-reactions", "predefined-backgrounds", - "can-upload-background" + "can-upload-background", + "sip-enabled", + "sip-dialout-enabled", + "can-enable-sip" ], "properties": { "enabled": { @@ -685,6 +688,15 @@ }, "can-upload-background": { "type": "boolean" + }, + "sip-enabled": { + "type": "boolean" + }, + "sip-dialout-enabled": { + "type": "boolean" + }, + "can-enable-sip": { + "type": "boolean" } } }, diff --git a/tests/php/CapabilitiesTest.php b/tests/php/CapabilitiesTest.php index ff70c47b8a..bcb77df03d 100644 --- a/tests/php/CapabilitiesTest.php +++ b/tests/php/CapabilitiesTest.php @@ -143,6 +143,7 @@ class CapabilitiesTest extends TestCase { 'session-state', 'note-to-self', 'recording-consent', + 'sip-support-dialout', 'message-expiration', 'reactions', ]; @@ -194,6 +195,8 @@ class CapabilitiesTest extends TestCase { 'recording' => false, 'recording-consent' => 0, 'supported-reactions' => ['❤️', '🎉', '👏', '👍', '👎', '😂', '🤩', '🤔', '😲', '😥'], + 'sip-enabled' => false, + 'sip-dialout-enabled' => false, 'predefined-backgrounds' => [ '1_office.jpg', '2_home.jpg', @@ -205,6 +208,7 @@ class CapabilitiesTest extends TestCase { '8_space_station.jpg', ], 'can-upload-background' => false, + 'can-enable-sip' => false, ], 'chat' => [ 'max-length' => 32000, @@ -319,6 +323,8 @@ class CapabilitiesTest extends TestCase { 'recording' => false, 'recording-consent' => 0, 'supported-reactions' => ['❤️', '🎉', '👏', '👍', '👎', '😂', '🤩', '🤔', '😲', '😥'], + 'sip-enabled' => false, + 'sip-dialout-enabled' => false, 'predefined-backgrounds' => [ '1_office.jpg', '2_home.jpg', @@ -330,6 +336,7 @@ class CapabilitiesTest extends TestCase { '8_space_station.jpg', ], 'can-upload-background' => $canUpload, + 'can-enable-sip' => false, ], 'chat' => [ 'max-length' => 32000,