Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable27] feat(recording): Make automatic call recording transcription opt-in #9971

Merged
merged 1 commit into from
Jul 13, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Legend:
| `hide_signaling_warning` | string<br>`yes` or `no` | `no` | No | 🖌️ | Flag that allows to suppress the warning that an HPB should be configured |
| `breakout_rooms` | string<br>`yes` or `no` | `yes` | Yes | | Whether or not breakout rooms are allowed (Will only prevent creating new breakout rooms. Existing conversations are not modified.) |
| `call_recording` | string<br>`yes` or `no` | `yes` | Yes | | Enable call recording |
| `call_recording_transcription` | string<br>`yes` or `no` | `no` | No | | Whether call recordings should automatically be transcripted when a transcription provider is enabled. |
| `federation_enabled` | string<br>`yes` or `no` | `no` | Yes | | 🏗️ *Work in progress:* Whether or not federation with this instance is allowed |
| `conversations_files` | string<br>`1` or `0` | `1` | No | 🖌️ | Whether the files app integration is enabled allowing to start conversations in the right sidebar |
| `conversations_files_public_shares` | string<br>`1` or `0` | `1` | No | 🖌️ | Whether the public share integration is enabled allowing to start conversations in the right sidebar on the public share page (Requires `conversations_files` also to be enabled) |
Expand Down
7 changes: 7 additions & 0 deletions lib/Service/RecordingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\IConfig;
use OCP\Notification\IManager;
use OCP\PreConditionNotMetException;
use OCP\Share\IManager as ShareManager;
Expand Down Expand Up @@ -76,6 +77,7 @@ public function __construct(
protected Manager $roomManager,
protected ITimeFactory $timeFactory,
protected Config $config,
protected IConfig $serverConfig,
protected RoomService $roomService,
protected ShareManager $shareManager,
protected ChatManager $chatManager,
Expand Down Expand Up @@ -145,8 +147,13 @@ public function store(Room $room, string $owner, array $file): void {
throw new InvalidArgumentException('owner_permission');
}

if (!$this->serverConfig->getAppValue('spreed', 'call_recording_transcription', 'no') === 'yes') {
return;
}

try {
$this->speechToTextManager->scheduleFileTranscription($fileNode, $owner, Application::APP_ID);
$this->logger->debug('Scheduled transcription of call recording');
} catch (PreConditionNotMetException $e) {
// No Speech-to-text provider installed
$this->logger->debug('Could not generate transcript of call recording', ['exception' => $e]);
Expand Down
5 changes: 5 additions & 0 deletions tests/php/Service/RecordingServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function is_uploaded_file($filename) {
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\IMimeTypeDetector;
use OCP\Files\IRootFolder;
use OCP\IConfig;
use OCP\Notification\IManager;
use OCP\Share\IManager as ShareManager;
use OCP\SpeechToText\ISpeechToTextManager;
Expand All @@ -65,6 +66,8 @@ class RecordingServiceTest extends TestCase {
private $rootFolder;
/** @var Config|MockObject */
private $config;
/** @var IConfig|MockObject */
private $serverConfig;
/** @var IManager|MockObject */
private $notificationManager;
/** @var Manager|MockObject */
Expand Down Expand Up @@ -95,6 +98,7 @@ public function setUp(): void {
$this->roomManager = $this->createMock(Manager::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->config = $this->createMock(Config::class);
$this->serverConfig = $this->createMock(IConfig::class);
$this->roomService = $this->createMock(RoomService::class);
$this->shareManager = $this->createMock(ShareManager::class);
$this->chatManager = $this->createMock(ChatManager::class);
Expand All @@ -110,6 +114,7 @@ public function setUp(): void {
$this->roomManager,
$this->timeFactory,
$this->config,
$this->serverConfig,
$this->roomService,
$this->shareManager,
$this->chatManager,
Expand Down