Skip to content

Pipeline de Voz ​

Fluxo de Áudio ​

Telefone (PSTN 8kHz)
    │
    ▼
┌─────────────────────┐
│  Telnyx/Twilio SIP   │
│  WebSocket Stream     │
└──────────┬──────────┘
           │ μ-law → PCM
           ▼
┌─────────────────────┐
│  Deepgram STT        │
│  Nova-3 (PT-BR)      │
│  endpointing: 500ms  │
└──────────┬──────────┘
           │ texto
           ▼
┌─────────────────────┐
│  SmartTurn V3        │
│  stop: 2.5s          │
│  pre_speech: 500ms   │
└──────────┬──────────┘
           │
           ▼
┌─────────────────────┐
│  OpenAI gpt-4o-mini  │
│  + GHL Function Call  │
│  (6 tools)           │
└──────────┬──────────┘
           │ texto resposta
           ▼
┌─────────────────────┐
│  Cartesia TTS        │
│  Sonic-3 (Luana)     │
│  + flush_audio fix   │
└──────────┬──────────┘
           │ PCM → μ-law
           ▼
┌─────────────────────┐
│  Telnyx/Twilio SIP   │
│  WebSocket Stream     │
└──────────┬──────────┘
           │
           ▼
     Telefone Lead

Supabase Schema ​

cold_call_logs ​

ColunaTipoDescrição
iduuidPK
call_idtextID da chamada (Twilio/Telnyx)
phonetextTelefone do lead
lead_nametextNome do lead
statustextcompleted, failed, etc
outcometextagendou, interessado, nao_atendeu, recusou
duration_secondsnumeric(10,2)Duração em segundos
transcripttextTranscrição completa
cost_usdnumeric(8,4)Custo total USD
cost_breakdownjsonbBreakdown por componente
started_attimestamptzInício da chamada

cold_call_retry_queue ​

ColunaTipoDescrição
iduuidPK
phonetextTelefone
attempt_numberintTentativa atual
max_attemptsintMáximo configurável (1-6)
next_retry_attimestamptzPróximo retry (business hours)
statustextpending, paused, calling, completed, cancelled

Custos por Chamada (~$0.04/min) ​

ComponenteCusto/min% Total
Telephony$0.04556%
TTS$0.01822%
STT$0.0056%
LLM$0.0023%

Endpoints API ​

MétodoEndpointDescrição
GET/healthHealth check
GET/costs/summary?days=30Custos agregados
GET/calls/activeChamadas ativas
GET/retry/queueFila de retries
POST/retry/nowRetry imediato
POST/retry/cancelCancelar retry
POST/retry/settingsToggle auto-retry + max_attempts
POST/retry/processProcessar fila (cron)
POST/outbound-callIniciar chamada

AI Factory V3 - Mottivme Sales