A voice-enabled AI assistant "Breeze Automatic" for D2C business analytics, built with Pipecat AI and optimized for ESP32 WebRTC connections.
This project provides real-time voice interaction with business analytics data through WebRTC, supporting both local development and production deployment on Google Cloud Platform (GCP).
- Voice AI Assistant: "Breeze Automatic" with Indian English conversational interface
- Real-time Analytics: 24 business intelligence functions for Juspay and Breeze platforms
- ESP32 Optimized: Custom SDP munging for ESP32 WebRTC limitations
- Production Ready: Automatic environment detection and NAT traversal support
-
Setup Environment
cp .env.example .env # Edit .env with your credentials -
Install Dependencies
pip install -r requirements.txt
-
Run Server
python main.py --host YOUR_LOCAL_IP --port 7860 --verbose
-
Get GCP External IP
gcloud compute instances describe YOUR_INSTANCE_NAME \ --zone=YOUR_ZONE \ --format='get(networkInterfaces[0].accessConfigs[0].natIP)' -
Configure GCP Firewall
# Allow WebRTC server traffic gcloud compute firewall-rules create allow-webrtc-server \ --allow tcp:7860 \ --source-ranges 0.0.0.0/0 \ --description "Allow WebRTC server traffic" # Allow WebRTC UDP (optional) gcloud compute firewall-rules create allow-webrtc-udp \ --allow udp:10000-20000 \ --source-ranges 0.0.0.0/0 \ --description "Allow WebRTC UDP traffic"
-
Deploy Using Script
chmod +x deploy_production.sh ./deploy_production.sh YOUR_GCP_EXTERNAL_IP
Or manually:
python main.py --host YOUR_GCP_EXTERNAL_IP --port 7860 --verbose
Create .env file from .env.example:
# Azure OpenAI
AZURE_API_KEY="your_azure_api_key"
AZURE_ENDPOINT="your_azure_endpoint"
AZURE_MODEL="your_azure_model"
# Google Cloud
GOOGLE_CREDENTIALS_JSON="{your_service_account_json}"Your ESP32 client needs these changes for production:
-
Update Server URL
// Change from local to production const char* serverURL = "http://YOUR_GCP_IP:7860/api/offer";
-
Add STUN Servers (Critical for production)
PeerConfiguration peer_connection_config = { .ice_servers = { {"stun:stun.l.google.com:19302"}, {"stun:stun1.l.google.com:19302"} }, // ... other config }; -
Increase Timeouts
#define HTTP_TIMEOUT_MS 30000 // Increase for internet connections
- FastAPI: HTTP server for WebRTC signaling
- Pipecat AI: Voice pipeline framework
- Azure OpenAI: LLM service
- Google Cloud: STT/TTS services
- SmallWebRTC: ESP32-optimized WebRTC transport
- Production-Aware SDP Munging: Different ICE filtering for local vs production
- STUN Server Support: Automatic NAT traversal configuration
- Comprehensive Logging: Debug-friendly WebRTC connection tracking
- Environment Detection: Automatic production vs local detection
-
ESP32 Can't Connect to Production
- Verify GCP firewall rules allow port 7860
- Check ESP32 has STUN servers configured
- Ensure server is using external IP, not localhost
-
WebRTC Negotiation Fails
- Check SDP munging logs for ICE candidate filtering
- Verify ESP32 supports server-reflexive candidates
- Enable verbose logging:
--verbose
-
Audio Not Working
- Check UDP firewall rules (ports 10000-20000)
- Verify Google Cloud credentials for TTS/STT
- Monitor VAD analyzer settings
# Test server accessibility
curl http://YOUR_GCP_IP:7860/api/offer
# Check firewall
nmap -p 7860 YOUR_GCP_IP
# Monitor logs
python main.py --host YOUR_GCP_IP --port 7860 --verboseThe assistant provides 24 analytics functions:
- Success rates (overall and by payment method)
- Transaction volumes and failure analysis
- GMV and average ticket sizes
- Daily and weekly variants
- Sales and order breakdowns
- Conversion rate tracking
- Payment success rates
- Ad spend and ROAS metrics
- Current time with timezone support
├── main.py # Main server application
├── tools.py # Analytics function definitions
├── dummy_data.py # Mock analytics data
├── requirements.txt # Python dependencies
├── deploy_production.sh # Production deployment script
├── .env.example # Environment template
└── README.md # This file
smallwebrtc_sdp_munging(): ESP32-specific SDP processingis_production_environment(): Environment detectionrun_server(): Main WebRTC server with ICE configuration
BSD 2-Clause License - Copyright (c) 2024–2025, Daily