Call
The call module manages call records — from creation during an incoming call to post-call details with transcriptions, recordings, and analysis results.
Data Model
Section titled “Data Model”Call (List View)
Section titled “Call (List View)”pub struct Call { pub id: Uuid, pub from_to_number: String, // "+15551234567 -> +15559876543" pub call_sid: String, // Twilio call SID pub has_recording: bool, pub created_at: String,}CallDetails (Detail View)
Section titled “CallDetails (Detail View)”Extends Call with transcription and analysis:
pub struct CallDetails { pub id: Uuid, pub from_to_number: String, pub call_sid: String, pub has_recording: bool, pub created_at: String, pub transcription: Option<String>, pub analysis_groups: Vec<CallAnalysisGroup>,}Analysis Structure
Section titled “Analysis Structure”Each call can have multiple analysis groups (one per analyzer), each with multiple runs:
pub struct CallAnalysisGroup { pub analyzer_id: Uuid, pub analyzer_name: String, // e.g. "Sentiment Analyzer" pub runs: Vec<CallAnalysisRun>,}
pub struct CallAnalysisRun { pub id: Uuid, pub analysis_text: String, // e.g. "No compliance issues found." pub created_at: String,}Previous analysis runs are preserved when re-running — new runs are appended.
API Endpoints
Section titled “API Endpoints”| Method | Path | Description |
|---|---|---|
GET | /api/calls | List calls for the organization |
GET | /api/calls/:id | Full details with transcription and analysis groups |
POST | /api/calls/:id/rerun | Re-run all active analyzers against the transcription |
GET | /api/calls/:id/recording | Serve the MP3 recording file |
All endpoints require an authenticated Session. Calls are scoped via a join on phone_number.organization_id.
Recording Endpoint
Section titled “Recording Endpoint”The recording endpoint (serve_recording_api) reads the MP3 file from disk using tokio::fs and returns it with Content-Type: audio/mpeg. Files are stored as {call_sid}.mp3.
Call Lifecycle
Section titled “Call Lifecycle”Twilio stream start → Call record created (id, call_sid, phone_number_id, contact_id, from_to_number) → Live AI session active → Call ends → Recording downloaded and transcribed (async, via Twilio module) → Call record updated with recording_url and transcription → Post-call pipeline: → Contact enrichment → Analyzer execution → To-do extraction → Email reportUI State
Section titled “UI State”The module includes two independent PLAYING_SID: GlobalSignal<Option<String>> signals — one in the list view and one in the detail view — to track which recording is currently playing.
Module Structure
Section titled “Module Structure”src/mods/call/├── api/ # List, details, rerun, recording endpoints├── components/ # Call list, call details UI components├── constants/ # Recording serve path├── types/ # Call, CallDetails, CallAnalysisGroup, CallAnalysisRun└── views/ # List and detail page views