How opensips/opensips-ai-voice-connector-ce works
Project type and purpose
• This is a middleware/microservice application (“AI Voice Connector”) that integrates a SIP gateway (OpenSIPS) with external AI engines for real-time voice interactions. It acts as a B2BUA media proxy, relaying SIP signaling and RTP media between user agents and AI engines.
File structure
• Top-level directories:
• docker/ → Dockerfile for building the connector image
• docs/ → Architecture, AI-flavors, and deployment guides
• examples/ → Docker-compose examples showing how OpenSIPS and the connector run together
• src/ → Core Python application
• Key Python modules in src/:
• main.py → Entry point
• engine.py → Core call/session management
• call.py, rtp.py → RTP capture/injection logic
• *\_api.py → Adapters for each AI provider (openai_api.py, deepgram_api.py, etc.)
• config.py → Configuration loader (file + env)
• utils.py, codec.py → Helpers and audio encoding
• examples/simple/ and examples/demo-summit/ demonstrate full Docker-Compose stacks: OpenSIPS container + AI Voice Connector container.
README for additional insights
• OpenSIPS handles SIP INVITEs, RTP relay to the AI Voice Connector.
• AI Voice Connector captures RTP, selects an “AI flavor” (Deepgram STT→OpenAI→Deepgram TTS, direct OpenAI speech-to-speech, Azure STT/TTS, or Deepgram native V2V).
• Media and control flows are fully asynchronous and modular.
• main.py / engine.py (orchestration)
• call.py / rtp.py (media hooks)
• ai adapters (openai_api.py, deepgram_api.py, etc.)
• codec.py (audio format conversion)
• Config passing into each subcomponent.