Skip to content

Commit

Permalink
feat(max-duration): Add a capability
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 8, 2024
1 parent 784e343 commit 97de780
Show file tree
Hide file tree
Showing 21 changed files with 70 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,4 @@
## 20.1
* `archived-conversations` (local) - Conversations can be marked as archived which will hide them from the conversation list by default
* `config => call => start-without-media` (local) - Boolean, whether media should be disabled when starting or joining a conversation
* `config => call => max-duration` - Integer, maximum call duration in seconds. Please note that this should only be used with system cron and with a reasonable high value, due to the expended duration until the background job ran.
1 change: 1 addition & 0 deletions lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public function getCapabilities(): array {
'sip-dialout-enabled' => $this->talkConfig->isSIPDialOutEnabled(),
'can-enable-sip' => false,
'start-without-media' => $this->talkConfig->getCallsStartWithoutMedia($user?->getUID()),
'max-duration' => $this->appConfig->getAppValueInt('max_call_duration'),
],
'chat' => [
'max-length' => ChatManager::MAX_CHAT_LENGTH,
Expand Down
1 change: 1 addition & 0 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@
* sip-dialout-enabled: bool,
* can-enable-sip: bool,
* start-without-media: bool,
* max-duration: int,
* },
* chat: array{
* max-length: int,
Expand Down
7 changes: 6 additions & 1 deletion openapi-administration.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
"sip-enabled",
"sip-dialout-enabled",
"can-enable-sip",
"start-without-media"
"start-without-media",
"max-duration"
],
"properties": {
"enabled": {
Expand Down Expand Up @@ -190,6 +191,10 @@
},
"start-without-media": {
"type": "boolean"
},
"max-duration": {
"type": "integer",
"format": "int64"
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion openapi-backend-recording.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"sip-enabled",
"sip-dialout-enabled",
"can-enable-sip",
"start-without-media"
"start-without-media",
"max-duration"
],
"properties": {
"enabled": {
Expand Down Expand Up @@ -123,6 +124,10 @@
},
"start-without-media": {
"type": "boolean"
},
"max-duration": {
"type": "integer",
"format": "int64"
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion openapi-backend-signaling.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"sip-enabled",
"sip-dialout-enabled",
"can-enable-sip",
"start-without-media"
"start-without-media",
"max-duration"
],
"properties": {
"enabled": {
Expand Down Expand Up @@ -123,6 +124,10 @@
},
"start-without-media": {
"type": "boolean"
},
"max-duration": {
"type": "integer",
"format": "int64"
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion openapi-backend-sipbridge.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@
"sip-enabled",
"sip-dialout-enabled",
"can-enable-sip",
"start-without-media"
"start-without-media",
"max-duration"
],
"properties": {
"enabled": {
Expand Down Expand Up @@ -166,6 +167,10 @@
},
"start-without-media": {
"type": "boolean"
},
"max-duration": {
"type": "integer",
"format": "int64"
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion openapi-bots.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"sip-enabled",
"sip-dialout-enabled",
"can-enable-sip",
"start-without-media"
"start-without-media",
"max-duration"
],
"properties": {
"enabled": {
Expand Down Expand Up @@ -123,6 +124,10 @@
},
"start-without-media": {
"type": "boolean"
},
"max-duration": {
"type": "integer",
"format": "int64"
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion openapi-federation.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@
"sip-enabled",
"sip-dialout-enabled",
"can-enable-sip",
"start-without-media"
"start-without-media",
"max-duration"
],
"properties": {
"enabled": {
Expand Down Expand Up @@ -166,6 +167,10 @@
},
"start-without-media": {
"type": "boolean"
},
"max-duration": {
"type": "integer",
"format": "int64"
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@
"sip-enabled",
"sip-dialout-enabled",
"can-enable-sip",
"start-without-media"
"start-without-media",
"max-duration"
],
"properties": {
"enabled": {
Expand Down Expand Up @@ -328,6 +329,10 @@
},
"start-without-media": {
"type": "boolean"
},
"max-duration": {
"type": "integer",
"format": "int64"
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@
"sip-enabled",
"sip-dialout-enabled",
"can-enable-sip",
"start-without-media"
"start-without-media",
"max-duration"
],
"properties": {
"enabled": {
Expand Down Expand Up @@ -269,6 +270,10 @@
},
"start-without-media": {
"type": "boolean"
},
"max-duration": {
"type": "integer",
"format": "int64"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions src/__mocks__/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const mockedCapabilities: Capabilities = {
'sip-dialout-enabled': true,
'can-enable-sip': true,
'start-without-media': false,
'max-duration': 0,
},
chat: {
'max-length': 32000,
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-administration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ export type components = {
"sip-dialout-enabled": boolean;
"can-enable-sip": boolean;
"start-without-media": boolean;
/** Format: int64 */
"max-duration": number;
};
chat: {
/** Format: int64 */
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-backend-recording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export type components = {
"sip-dialout-enabled": boolean;
"can-enable-sip": boolean;
"start-without-media": boolean;
/** Format: int64 */
"max-duration": number;
};
chat: {
/** Format: int64 */
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-backend-signaling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export type components = {
"sip-dialout-enabled": boolean;
"can-enable-sip": boolean;
"start-without-media": boolean;
/** Format: int64 */
"max-duration": number;
};
chat: {
/** Format: int64 */
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-backend-sipbridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ export type components = {
"sip-dialout-enabled": boolean;
"can-enable-sip": boolean;
"start-without-media": boolean;
/** Format: int64 */
"max-duration": number;
};
chat: {
/** Format: int64 */
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-bots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export type components = {
"sip-dialout-enabled": boolean;
"can-enable-sip": boolean;
"start-without-media": boolean;
/** Format: int64 */
"max-duration": number;
};
chat: {
/** Format: int64 */
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-federation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ export type components = {
"sip-dialout-enabled": boolean;
"can-enable-sip": boolean;
"start-without-media": boolean;
/** Format: int64 */
"max-duration": number;
};
chat: {
/** Format: int64 */
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi-full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1883,6 +1883,8 @@ export type components = {
"sip-dialout-enabled": boolean;
"can-enable-sip": boolean;
"start-without-media": boolean;
/** Format: int64 */
"max-duration": number;
};
chat: {
/** Format: int64 */
Expand Down
2 changes: 2 additions & 0 deletions src/types/openapi/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,8 @@ export type components = {
"sip-dialout-enabled": boolean;
"can-enable-sip": boolean;
"start-without-media": boolean;
/** Format: int64 */
"max-duration": number;
};
chat: {
/** Format: int64 */
Expand Down
2 changes: 2 additions & 0 deletions tests/php/CapabilitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public function testGetCapabilitiesGuest(): void {
'sip-dialout-enabled' => false,
'can-enable-sip' => false,
'start-without-media' => false,
'max-duration' => 0,
'predefined-backgrounds' => [
'1_office.jpg',
'2_home.jpg',
Expand Down Expand Up @@ -254,6 +255,7 @@ public function testGetCapabilitiesUserAllowed(bool $isNotAllowed, bool $canCrea
'sip-dialout-enabled' => false,
'can-enable-sip' => false,
'start-without-media' => false,
'max-duration' => 0,
'predefined-backgrounds' => [
'1_office.jpg',
'2_home.jpg',
Expand Down

0 comments on commit 97de780

Please sign in to comment.