chore(audio): add more data to audio_joined/failure logs

Add secondsToActivateAudio, inputDeviceId, outputDeviceId and isListenOnly
to audio_joined.extraInfo

Add inputDeviceId, outputDeviceId and isListenOnly to
audio_failure.extraInfo

Add a try-catch to the device enforcement procedure triggered by
onAudioJoin - it may throw and block the modal.
This commit is contained in:
prlanzarin 2023-07-27 10:54:53 -03:00
parent f682348db4
commit 26815f4679

View File

@ -548,22 +548,11 @@ class AudioManager {
);
}
if (!this.isEchoTest) {
this.notify(this.intl.formatMessage(this.messages.info.JOINED_AUDIO));
logger.info({ logCode: 'audio_joined' }, 'Audio Joined');
try {
this.inputStream = this.bridge ? this.bridge.inputStream : null;
if (STATS.enabled) this.monitor();
this.audioEventHandler({
name: 'started',
isListenOnly: this.isListenOnly,
});
}
Session.set('audioModalIsOpen', false);
// Enforce correct output device on audio join
this.changeOutputDevice(this.outputDeviceId, true);
storeAudioOutputDeviceId(this.outputDeviceId);
// Extract the deviceId again from the stream to guarantee consistency
// between stream DID vs chosen DID. That's necessary in scenarios where,
// eg, there's no default/pre-set deviceId ('') and the browser's
@ -578,6 +567,36 @@ class AudioManager {
// Audio joined successfully - add device IDs to session storage so they
// can be re-used on refreshes/other sessions
storeAudioInputDeviceId(this.inputDeviceId);
} catch (error) {
logger.warn({
logCode: 'audiomanager_device_enforce_failed',
extraInfo: {
errorName: error.name,
errorMessage: error.message,
inputDeviceId: this.inputDeviceId,
outputDeviceId: this.outputDeviceId,
},
}, `Failed to enforce input/output devices: ${error.message}`);
}
if (!this.isEchoTest) {
this.notify(this.intl.formatMessage(this.messages.info.JOINED_AUDIO));
logger.info({
logCode: 'audio_joined',
extraInfo: {
secondsToActivateAudio,
inputDeviceId: this.inputDeviceId,
outputDeviceId: this.outputDeviceId,
isListenOnly: this.isListenOnly,
},
}, 'Audio Joined');
if (STATS.enabled) this.monitor();
this.audioEventHandler({
name: 'started',
isListenOnly: this.isListenOnly,
});
}
Session.set('audioModalIsOpen', false);
}
onTransferStart() {
@ -648,6 +667,9 @@ class AudioManager {
errorCode: error,
cause: bridgeError,
bridge,
inputDeviceId: this.inputDeviceId,
outputDeviceId: this.outputDeviceId,
isListenOnly: this.isListenOnly,
},
},
`Audio error - errorCode=${error}, cause=${bridgeError}`