How alessandrovezzoso/portunus works
Portunus is a Go SIP answering service for a Yeastar PBX. The documented call flow is PBX-routed call → greeting → listen and transcribe → Claude reply → synthesize and play audio → end call. Its runtime also includes G.711/audio handling, configuration, and speech-service adapters. The README documents the conversational workflow, while the sampled call code shows the listen/transcription path; unsampled conversation details are represented only where the README supports them.
Main entry points: listen.go Listen and transcribe · call.go Call handling · greet.go Fixed greeting · call Conversation turn
Components 20
Runtime and configuration
- Runtime wiring
cmd/portunus/main.go - Preflight checks
cmd/portunus/preflight.go - Configuration
internal/config/config.go - Dotenv reader
internal/config/dotenv.go
SIP telephony
- SIP server
internal/sip/server.go - Call handling
internal/sip/call.go
Call and audio
- Fixed greeting
internal/call/greet.go - Listen and transcribe
internal/call/listen.go - Utterance segmenter
internal/call/segmenter.go - Audio conversion
internal/media/decoder.go - RTP audio pacer
internal/media/pacer.go - Silero VAD
internal/vad/silero/silero.go - Conversation turn
internal/call
Speech services
- STT adapter
internal/stt/openaicompat/client.go - Whisper service
- TTS adapter
internal/tts/openaicompat/client.go - Kokoro service
Other components
- Caller
- Yeastar S20
- Claude API
Connections 26
- Caller → Yeastar S20: calls office
README.md - Yeastar S20 → SIP server: routes SIP call
README.md - Runtime wiring → Configuration: loads settings
cmd/portunus/main.go - Runtime wiring → Preflight checks: checks readiness
cmd/portunus/main.go - Runtime wiring → SIP server: starts server
cmd/portunus/main.go - SIP server → Call handling: handles INVITE
internal/sip/call.go - Call handling → Fixed greeting: runs handler
internal/call/greet.go - Call handling → Listen and transcribe: runs handler
internal/call/listen.go - Call handling → Caller: answers call
README.md - Fixed greeting → TTS adapter: requests speech
internal/call/greet.go - TTS adapter → Kokoro service: synthesizes text
internal/tts/openaicompat/client.go - Fixed greeting → Audio conversion: encodes audio
internal/call/greet.go - Fixed greeting → RTP audio pacer: queues audio
internal/call/greet.go - Listen and transcribe → Audio conversion: decodes audio
README.md - Listen and transcribe → Silero VAD: checks speech
README.md - Listen and transcribe → Utterance segmenter: segments utterances
internal/call/listen.go - Listen and transcribe → STT adapter: transcribes utterances
internal/call/listen.go - STT adapter → Whisper service: uploads WAV
internal/stt/openaicompat/client.go - Listen and transcribe → Conversation turn: provides transcript
- Conversation turn → Claude API: sends turn text
README.md - Claude API → Conversation turn: streams reply
README.md - Conversation turn → TTS adapter: synthesizes reply
- TTS adapter → RTP audio pacer: streams audio
- RTP audio pacer → Call handling: writes RTP audio
README.md - Call handling → Yeastar S20: signals hangup
README.md - Dotenv reader → Configuration: parses environment
internal/config/dotenv.go