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