Testing VoiceLive in a Separate Terminal
Quick Steps
Terminal 1 (Backend - Already Running)
Keep your backend running here. You should see:
INFO: Application startup complete.
Terminal 2 (Testing - New Terminal)
- Navigate to project directory:
cd /Users/derek/Library/CloudStorage/OneDrive-zimaxnet/code/CogAI - Activate virtual environment:
source venv/bin/activate - Run the test:
python3 scripts/test-voicelive-websocket.py
One-Liner Command
You can also run it all in one command:
cd /Users/derek/Library/CloudStorage/OneDrive-zimaxnet/code/CogAI && source venv/bin/activate && python3 scripts/test-voicelive-websocket.py
Alternative: Browser Console Test
If you prefer to test in the browser:
- Open browser DevTools (F12)
- Go to Console tab
- Run:
const ws = new WebSocket('ws://localhost:8082/api/v1/voice/voicelive/test-123');
ws.onopen = () => {
console.log('✓ Connected');
ws.send(JSON.stringify({type: 'agent', agent_id: 'elena'}));
};
ws.onmessage = (e) => console.log('Received:', JSON.parse(e.data));
ws.onerror = (e) => console.error('Error:', e);
ws.onclose = () => console.log('Disconnected');
Expected Output
If successful, you should see:
✓ WebSocket connected successfully
✓ Response: agent_switched (or similar)
If there’s still a 401 error, check:
- Backend logs for authentication errors
- Azure credentials are set correctly
- VoiceLive is enabled in Azure Portal