From abf38eada38cf1cd73e826f714a6758ff8b51b9e Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Thu, 26 Feb 2026 21:27:15 +0100
Subject: [PATCH] Restore bot voice output with TTS mic preflight.
Run a one-time best-effort mic enable before first playback so injected TTS audio is audible even when Teams starts muted.
Made-with: Cursor
---
src/bot/orchestrator.ts | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/bot/orchestrator.ts b/src/bot/orchestrator.ts
index fcbe9ea..458b0de 100644
--- a/src/bot/orchestrator.ts
+++ b/src/bot/orchestrator.ts
@@ -72,6 +72,7 @@ export class BotOrchestrator {
private _isShuttingDown: boolean = false;
private _isDebugMode: boolean = false;
private _keepAliveInterval: NodeJS.Timeout | null = null;
+ private _hasAttemptedMicEnableForTts: boolean = false;
constructor(
sessionId: string,
@@ -828,6 +829,20 @@ export class BotOrchestrator {
return;
}
+ // Best-effort safety net:
+ // In some authenticated sessions the mic can be muted after join.
+ // TTS is injected into the mic stream; if mic is muted, participants hear nothing.
+ // We only attempt this once per session to avoid unnecessary UI actions.
+ if (!this._hasAttemptedMicEnableForTts && this._teamsActions) {
+ this._hasAttemptedMicEnableForTts = true;
+ try {
+ const micEnabled = await this._teamsActions.toggleMic(true);
+ this._logger.info(`TTS preflight mic-enable attempt result: ${micEnabled ? 'ok' : 'not-confirmed'}`);
+ } catch (err) {
+ this._logger.warn(`TTS preflight mic-enable attempt failed: ${err}`);
+ }
+ }
+
await this._audioProcedure.playAudio(audioData, format);
}