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
This commit is contained in:
ValueOn AG 2026-02-26 21:27:15 +01:00
parent 3863063984
commit abf38eada3

View file

@ -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);
}