in challenge5/frontend/components/voice-mode.tsx [100:117]
function stopSession() {
if (dataChannel) {
dataChannel.close()
}
if (peerConnection.current) {
peerConnection.current.close()
}
setIsSessionStarted(false)
setIsSessionActive(false)
setDataChannel(null)
peerConnection.current = null
if (audioStream) {
audioStream.getTracks().forEach(track => track.stop())
}
setAudioStream(null)
audioTransceiver.current = null
}