- AudioSocket server (asyncio TCP, Asterisk wire protocol) bridging calls into the same M2 agent used by chat - Call session engine: greeting → energy-VAD utterance collection → STT → agent turn → TTS playback with barge-in (120ms of caller speech stops playback); inactivity + max-duration guards; unintelligible audio reaches the agent as '[nerazumljivo]' so the two-attempt rule stays in the prompt - STTProvider (faster-whisper, lang hint 'sr', GPU/CPU via env) and TTSProvider (Azure Neural raw-8k PCM / ElevenLabs Flash) + test fakes - Recording (mixed caller+agent WAV), transcripts, per-turn latency trace, metering via record_agent_call (§12) - Internal dialplan API: /internal/calls/register (ring targets computed from working hours + ring settings §5.2), /answered (human outcome, no minutes), /hangup (abandoned → missed-call SMS §5.5); shared-token auth - Asterisk config generator (pjsip.conf + extensions.conf from DB): worker endpoints, per-tenant test-caller endpoint, register→Dial→AudioSocket dialplan with h-extension reporting — validated against a real Asterisk 20 container (modules, dialplan, endpoints all load) - docker-compose 'voice' profile (voice server + Asterisk), Dockerfile.voice, docs/VOICE_TESTING.md softphone runbook - 16 new tests incl. full fake-call e2e and a real-TCP AudioSocket wire test Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
70 lines
1.9 KiB
YAML
70 lines
1.9 KiB
YAML
services:
|
|
db:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_USER: gogo
|
|
POSTGRES_PASSWORD: gogo
|
|
POSTGRES_DB: gogo
|
|
ports:
|
|
- "127.0.0.1:5433:5432" # 5433 on the host to avoid clashing with a system postgres
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U gogo"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
|
|
app:
|
|
build: .
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
environment:
|
|
GOGO_DATABASE_URL: postgresql+psycopg://gogo:gogo@db:5432/gogo
|
|
env_file:
|
|
- path: .env
|
|
required: false
|
|
ports:
|
|
- "127.0.0.1:8000:8000"
|
|
volumes:
|
|
- recordings:/data/recordings
|
|
command: >
|
|
sh -c "alembic upgrade head &&
|
|
uvicorn gogo.main:app --host 0.0.0.0 --port 8000"
|
|
|
|
# Voice pipeline (M4): AudioSocket server with STT/TTS/LLM.
|
|
# Heavy (faster-whisper); start with: docker compose --profile voice up
|
|
voice:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.voice
|
|
profiles: ["voice"]
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
environment:
|
|
GOGO_DATABASE_URL: postgresql+psycopg://gogo:gogo@db:5432/gogo
|
|
GOGO_RECORDINGS_DIR: /data/recordings
|
|
env_file:
|
|
- path: .env
|
|
required: false
|
|
ports:
|
|
- "127.0.0.1:9092:9092"
|
|
volumes:
|
|
- recordings:/data/recordings
|
|
|
|
# Asterisk (M4): softphones register here; agent calls bridge to `voice`.
|
|
# Config is generated: python -m gogo.telephony.asterisk --out ./asterisk/conf
|
|
asterisk:
|
|
image: andrius/asterisk:alpine-20.5.2
|
|
profiles: ["voice"]
|
|
network_mode: host # SIP/RTP is painful behind NAT; host networking for MVP
|
|
volumes:
|
|
- ./asterisk/conf/pjsip.conf:/etc/asterisk/pjsip.conf:ro
|
|
- ./asterisk/conf/extensions.conf:/etc/asterisk/extensions.conf:ro
|
|
|
|
volumes:
|
|
pgdata:
|
|
recordings:
|