Files
avc-phone-ai/.env.example
tocmo0nlord 1e7b7844a4 Ops hardening: lead re-import, SMS health-watch, ambient office murmur
- scripts/reimport_leads.py drains appointment_requests.jsonl into Odoo
  (fallback leads were captured but invisible to staff forever); server.py
  now warns at startup when leads are pending.
- scripts/healthwatch.sh (cron, every minute): after 3 consecutive /health
  failures sends a Twilio SMS to ALERT_SMS_TO (30-min cooldown) + a recovery
  SMS. systemd handles restarts; this makes a human aware when that isn't
  enough. Tested end-to-end (DOWN + RECOVERED SMS delivered).
- Ambient office murmur (assets/office_ambience.wav, generated by
  scripts/make_ambience.py from low-passed unintelligible Kokoro babble +
  room tone) mixed continuously into outbound audio via pipecat
  SoundfileMixer, so callers hear a live office instead of dead silence
  while the agent thinks. AMBIENT_VOLUME/AMBIENT_ENABLED to tune/disable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 16:35:34 +00:00

88 lines
5.1 KiB
Plaintext

# Copy to .env and fill in. run.sh auto-loads it.
# ── Public ingress (Twilio dials this back) ──────────────────────────────────
# Public hostname; nginx terminates TLS here and proxies to the app. Must match the
# Twilio webhook host (Twilio signs https://PUBLIC_HOST/voice).
PUBLIC_HOST=voip.activeblue.net
PORT=8200
# App bind address. Default 127.0.0.1 (nginx proxies in locally) — not exposed on LAN.
BIND_HOST=127.0.0.1
# ── Twilio ───────────────────────────────────────────────────────────────────
# From console.twilio.com. Used to auto-hang-up the carrier leg and (recommended)
# validate inbound webhook signatures. Twilio signs webhooks with the Auth Token, so
# signature validation must use the Auth Token (not an API Key Secret).
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token_here
# Inbound webhook signature validation is ON whenever TWILIO_AUTH_TOKEN is set.
# Set to false only for local testing without real Twilio requests.
TWILIO_VALIDATE=true
# Shared secret embedded in the Media Stream wss URL to gate /ws. Set a stable random
# value (e.g. `openssl rand -base64 24`); if blank, one is generated per process start.
STREAM_TOKEN=
# ── Odoo appointment integration ─────────────────────────────────────────────
# Leave ODOO_USER/ODOO_API_KEY blank to disable Odoo and log requests to JSONL only.
# Same creds the activeblue-agent container uses (docker inspect activeblue-agent).
# Verified working against db1 with ODOO_TARGET=crm.
ODOO_URL=http://localhost:8069
ODOO_DB=db1
ODOO_USER=mr.garcia09@gmail.com
ODOO_API_KEY=
ODOO_TARGET=crm # crm = callback lead (recommended) | calendar = tentative event
# ── Capacity ─────────────────────────────────────────────────────────────────
# Max simultaneous calls (each uses GPU; Ollama serializes generation). Over-cap
# callers hear BUSY_MESSAGE and are hung up. Tune to your GPU headroom (2-3 typical).
MAX_CONCURRENT_CALLS=2
# BUSY_MESSAGE=Thank you for calling Advanced Vision Care. All of our lines are busy right now. Please call back in a few minutes. Goodbye.
# ── Models (defaults are fine) ───────────────────────────────────────────────
OLLAMA_MODEL=llama3.1:8b
OLLAMA_URL=http://127.0.0.1:11434/v1
# LLM provider: ollama (local, default) | anthropic (Claude API). Flip to A/B test Claude.
LLM_PROVIDER=ollama
ANTHROPIC_API_KEY=
# Default is the most capable model; for low-latency phone voice prefer claude-haiku-4-5
# (fastest) or claude-sonnet-4-6 (balance).
ANTHROPIC_MODEL=claude-opus-4-8
# ── STT: Whisper (faster-whisper, real-time in-call) ─────────────────────────
WHISPER_MODEL=base
WHISPER_DEVICE=cuda
WHISPER_COMPUTE=float16
KOKORO_VOICE=af_heart
KOKORO_MODEL_DIR=/home/tocmo0nlord/pipecat-run/models
# ── Call behaviour ───────────────────────────────────────────────────────────
AGENT_NAME=AVA
# How the name is SPOKEN (TTS only; logs/Odoo keep AGENT_NAME). "Eva" -> "EE-vuh".
AGENT_NAME_SPOKEN=Eva
# Grace pause after the goodbye before the carrier leg is dropped (seconds).
HANGUP_DELAY_SECS=4.0
# Half-duplex: ignore caller audio while the agent speaks (+ tail) so its own echo on the
# phone line can't trigger a false barge-in that cancels its reply. false = allow barge-in.
HALF_DUPLEX=true
ECHO_TAIL_SECS=0.25
# VAD kept sensitive (half-duplex gates echo, so this only affects the caller's turn).
VAD_CONFIDENCE=0.5
VAD_MIN_VOLUME=0.15
VAD_START_SECS=0.1
VAD_STOP_SECS=0.5
# Extra silence the smart-turn analyzer waits when it judges an utterance INCOMPLETE
# before ending the turn anyway (library default 3s caused ~3.5s dead air on some turns).
#SMART_TURN_STOP_SECS=1.5
# Deterministic slot memory (callstate.py): injects an ALREADY-COLLECTED / STILL-NEEDED
# checklist into the system prompt each turn + merges VAD-fragmented user turns, so the
# local 8B stops re-asking for name/reason/phone. Default: on for ollama, off for anthropic.
#CALL_STATE_TRACKING=true
# Ambient office murmur mixed into outbound audio (masks reply latency; file from
# scripts/make_ambience.py). AMBIENT_VOLUME=0 or AMBIENT_ENABLED=false disables.
#AMBIENT_SOUND=assets/office_ambience.wav
#AMBIENT_VOLUME=0.10
# Hard timeout for every Odoo XML-RPC round-trip (a HUNG Odoo must not hold call slots).
#ODOO_TIMEOUT_SECS=15
# Health-watch alerting (scripts/healthwatch.sh via cron): SMS on sustained /health
# failure. From = your Twilio number; To = the phone that should get the alert.
TWILIO_PHONE_NUMBER=+1...
ALERT_SMS_TO=+1...