Skip to content

Call

The call module manages call records — from creation during an incoming call to post-call details with transcriptions, recordings, and analysis results.

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,
}

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>,
}

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.

MethodPathDescription
GET/api/callsList calls for the organization
GET/api/calls/:idFull details with transcription and analysis groups
POST/api/calls/:id/rerunRe-run all active analyzers against the transcription
GET/api/calls/:id/recordingServe the MP3 recording file

All endpoints require an authenticated Session. Calls are scoped via a join on phone_number.organization_id.

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.

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 report

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.

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
  • Twilio — creates call records, triggers post-call pipeline
  • Analyzer — runs analysis against transcriptions
  • Contact — linked via contact_id, enriched post-call
  • Report — generates email reports from call data
  • Todo — extracts to-dos from transcriptions