API Requirements
Your sandbox must expose a WebRTC-compatible endpoint, plus a health check endpoint.1. WebRTC Voice Endpoint
Endpoint:WebSocket: wss://your-domain.com/voice
Connection Handshake:
2. Health Check Endpoint
Endpoint:GET /health
Request:
Advanced Configuration
Optional Parameters
user_id and session_id are optional in requests. If your agent doesn’t require session management, you can omit them. metadata is optional and can contain any scenario or context information your agent needs. Request with minimal parameters:Implementation Guide
1. Set Up Your Sandbox
Deploy your voice agent to a publicly accessible WebSocket endpoint with WSS (secure WebSocket) support. Required Headers:Sec-WebSocket-Protocol: voice-agentAuthorization: Bearer <your-api-key>(best practice for security)
2. Test Your Endpoints
WebRTC Connection Test:3. Configure in UserTrace
- Add your sandbox URL in the UserTrace dashboard
- Set authentication if required (API keys, tokens)
- Configure audio settings (codec preferences, quality settings)
- Test connection using the built-in connectivity checker
Best Practices
Performance
Response Optimization• Target < 200ms audio latency
• Support 100 concurrent connections
• Implement proper error handling
• Add connection quality monitoring
Security
WebRTC Security• Use WSS (secure WebSocket) only
• Implement DTLS for media encryption
• Validate all signaling messages
• Use secure TURN servers
Error Handling
Your API should return appropriate WebSocket close codes and error messages: Connection Errors:Voice Processing Support
For agents that handle voice conversations, your response should include both the voice interaction results and conversation metadata: Voice Response Example:Common Integration Patterns
- Speech Recognition: Real-time transcription with confidence scores
- Voice Synthesis: Text-to-speech with natural voice generation
- Intent Detection: Understanding user requests from voice input
- Context Management: Maintaining conversation state across turns
- Quality Monitoring: Real-time audio quality and connection metrics
Troubleshooting
Common Issues:- Connection not establishing: Check WebSocket endpoint and SSL certificates
- Audio not flowing: Verify WebRTC signaling and ICE connectivity
- Poor audio quality: Optimize codec settings and network configuration
- High latency: Review server location and network routing
Need help with WebRTC implementation? Our team can assist with technical setup and optimization. Contact [email protected].