Skip to main content
JA jansher.aquib
Linea Care 2025–present

Virtual Contact Center for Patient Triage

AI-native virtual contact center integrating Twilio Programmable Voice/WebSockets, Gemini, and neural voice providers to automate inbound patient triage.

Twilio WebSockets Gemini Neural Voice Node.js TypeScript FastAPI

Context

At Linea Care Inc, an AI-native ACO platform managing full patient lifecycles for major healthcare partners including DaVita Care, handling timely patient communications is mission-critical. Inbound patient calls span routine appointment scheduling, benefits inquiries, and intake triage.

Operating under the CTO, I was responsible for designing and deploying backend systems to modernize voice interactions without sacrificing patient trust or clinical rigor.

Problem

Traditional interactive voice response (IVR) phone trees create substantial patient friction, resulting in high abandonment rates and overloaded clinical coordination teams. Scaling human operators to triage calls around the clock is cost-prohibitive.

The system needed to support real-time, low-latency conversational audio streaming, handle patient interruptions (barge-in), accurately interpret clinical intent, and integrate seamlessly with downstream medical practice-management software.

What I Built

I architected and implemented an AI-native virtual contact center:

  • Full-Duplex Audio Pipeline: Built a bidirectional streaming pipeline using Twilio Programmable Voice over WebSockets, interfacing directly with neural voice synthesis and Gemini models.
  • Real-Time Triage Logic: Engineered voice session managers that detect speech presence, handle natural conversational interruptions, and steer patients through structured clinical intake paths.
  • Practice-Management Integration: Built reliable API connectors syncing caller intent directly into EHR and practice-management backends for scheduling and verification.
  • Latency & Telemetry Optimization: Instrumented end-to-end voice latency budgets, audio chunk buffering, and fallback failovers to human operators when confidence thresholds are unmet.

Architecture

The architecture decouples audio streaming from heavy background business logic:

  1. Twilio Media Stream: Connects inbound telephony calls to a WebSocket edge handler, streaming bi-directional μ-law raw audio packets.
  2. Audio Processing Layer: Streams audio chunks to speech-to-text / speech-to-speech models, managing silence detection and buffer windows.
  3. Conversational Engine: Evaluates conversational turns with Gemini, utilizing schema-restricted tool-calling for patient record lookup and triage decisions.
  4. Practice Management Sync: Asynchronously dispatches verified intake transcripts and structured payloads to downstream clinical services.

Stack

  • Telephony & Audio: Twilio Programmable Voice, Twilio WebSockets, Neural Voice providers
  • AI & Models: Gemini (LLM orchestration & intent routing)
  • Backend Services: Node.js, TypeScript, FastAPI
  • Data & Workers: Postgres, Redis, Background Workers
  • CI/CD & Observability: GitHub Actions, Structured Logging, Latency Tracing

Outcome

  • Successfully automated inbound triage for routine inquiries and patient interactions.
  • Achieved sub-second audio turn-taking streaming over WebSockets for natural conversational cadence.
  • Enabled clinical teams to focus directly on complex patient encounters while maintaining structured, auditable electronic intake logs.