2026-07-11 09:45:06 +02:00
|
|
|
"""Application configuration via environment variables / .env file."""
|
|
|
|
|
|
|
|
|
|
from functools import lru_cache
|
|
|
|
|
|
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
|
|
|
model_config = SettingsConfigDict(env_file=".env", env_prefix="GOGO_", extra="ignore")
|
|
|
|
|
|
|
|
|
|
# Core
|
|
|
|
|
env: str = "dev" # dev | test | prod
|
|
|
|
|
secret_key: str = "dev-secret-change-me"
|
|
|
|
|
base_url: str = "http://localhost:8000" # public URL for action links / transcripts
|
|
|
|
|
database_url: str = "postgresql+psycopg://gogo:gogo@localhost:5432/gogo"
|
|
|
|
|
|
|
|
|
|
# Email (SMTP). provider=console logs instead of sending.
|
|
|
|
|
email_provider: str = "console" # console | smtp
|
|
|
|
|
smtp_host: str = "localhost"
|
|
|
|
|
smtp_port: int = 587
|
|
|
|
|
smtp_user: str = ""
|
|
|
|
|
smtp_password: str = ""
|
|
|
|
|
smtp_starttls: bool = True
|
|
|
|
|
email_from: str = "Gogo Telefon <noreply@gogotelefon.ba>"
|
M6 + M0: hardening, deploy docs, PoC scripts
- Pipeline-down fallback: dialplan plays gogo-fallback after a failed
AudioSocket (§15) + script to synthesize the Bosnian prompt via TTS
- Voice heartbeat file → /health/voice endpoint + live status in admin panel
- Retention job also purges stale call registrations; chat sessions metered;
100%-usage super-admin alert email (GOGO_ADMIN_ALERT_EMAIL)
- .env.example, docs/DEPLOY.md (compose stack, GPU node, backups pg_dump,
update procedure, security notes)
- §16 Definition of Done as an automated test: softphone-style call → fake
partner availability → request pushed → webhook confirm → console SMS
- M0 PoC scripts: STT accuracy harness (CER/WER + spoken-digit check; dry-run
verified with espeak-ng samples + faster-whisper small on CPU — phone number
extracted exactly), TTS bake-off (Azure vs ElevenLabs, latency+cost), and
end-to-end latency smoke test speaking real AudioSocket to the live pipeline
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:27:05 +02:00
|
|
|
admin_alert_email: str = "" # super-admin alerts (100% usage etc.), empty = off
|
2026-07-11 09:45:06 +02:00
|
|
|
|
|
|
|
|
# SMS. provider=console logs instead of sending (GSM gateway impl in M5).
|
|
|
|
|
sms_provider: str = "console" # console | gsm_gateway
|
|
|
|
|
gsm_gateway_url: str = ""
|
|
|
|
|
gsm_gateway_user: str = ""
|
|
|
|
|
gsm_gateway_password: str = ""
|
|
|
|
|
|
|
|
|
|
# LLM
|
|
|
|
|
anthropic_api_key: str = ""
|
|
|
|
|
llm_model: str = "claude-haiku-4-5-20251001" # default; per-tenant override possible
|
|
|
|
|
|
|
|
|
|
# TTS (decided by Phase-0 PoC; both supported behind TTSProvider)
|
|
|
|
|
tts_provider: str = "azure" # azure | elevenlabs
|
|
|
|
|
azure_speech_key: str = ""
|
|
|
|
|
azure_speech_region: str = "westeurope"
|
|
|
|
|
elevenlabs_api_key: str = ""
|
|
|
|
|
|
|
|
|
|
# Google OAuth (Calendar free/busy)
|
|
|
|
|
google_client_id: str = ""
|
|
|
|
|
google_client_secret: str = ""
|
|
|
|
|
|
M4: voice pipeline (software-only telephony)
- 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>
2026-07-11 11:05:56 +02:00
|
|
|
# Voice pipeline (M4)
|
|
|
|
|
voice_host: str = "0.0.0.0"
|
|
|
|
|
voice_port: int = 9092
|
|
|
|
|
recordings_dir: str = "./recordings"
|
|
|
|
|
internal_token: str = "dev-internal-token" # dialplan ↔ backend shared secret
|
|
|
|
|
|
2026-07-11 09:45:06 +02:00
|
|
|
# Proposal engine defaults (overridable per tenant)
|
|
|
|
|
proposal_ttl_hours: int = 24
|
|
|
|
|
|
|
|
|
|
# Retention
|
|
|
|
|
audio_retention_days: int = 90
|
|
|
|
|
|
|
|
|
|
# Session cookies
|
|
|
|
|
session_cookie: str = "gogo_session"
|
|
|
|
|
session_max_age: int = 60 * 60 * 24 * 14 # 14 days
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@lru_cache
|
|
|
|
|
def get_settings() -> Settings:
|
|
|
|
|
return Settings()
|