Fermin Perdomo

Senior Full Stack Engineer | PHP | JavaScript

How to Build a Medicare AI Voice Bot Integrated with VICIdial

Fermin Perdomo
July 23, 2025

Are you looking to modernize your call center by automating outbound Medicare calls? In this post, we’ll show you how to create a working proof of concept for a voice bot that answers Medicare questions, compares plans, and guides users through enrollment—all powered by AI and connected to VICIdial.

Why Use an AI Voice Bot for Medicare?

Traditional call centers struggle with:

  • Limited agent availability
  • Compliance complexities
  • Repetitive FAQs about Medicare Part A, B, C, and D

An AI Voice Bot offers:

✅ 24/7 availability
 ✅ Accurate plan comparisons
 ✅ CMS-compliant call scripting
 ✅ Seamless transfers to human agents when needed

System Architecture

Here's how your AI voice system connects with VICIdial:


[VICIdial] ↓ SIP Call [Twilio SIP Trunk] ↓ Webhook [AI Voice Bot (Node.js)] ↙ STT (Whisper/Deepgram) → GPT-4 → TTS (ElevenLabs)

Tech Stack

Component | Tool
Voice Routing | VICIdial + Twilio SIP
Speech-to-Text | Whisper or Deepgram
AI/NLP | OpenAI GPT-4
Text-to-Speech | ElevenLabs
Bot Logic | Node.js + Express
Hosting | Fly.io, Vercel, or EC2
CRM (optional) | Firebase or Laravel


Step-by-Step: Build the Medicare Bot

1. Configure VICIdial SIP Carrier

Add a Twilio carrier to your VICIdial setup:


[twilio] type=peer host=your-sip-domain.pstn.twilio.com username=twilio_user secret=twilio_password disallow=all allow=ulaw context=trunkinbound

Then route outbound calls or IVRs to this SIP trunk.

2. Create the AI Voice Bot in Node.js

Set up your project:


mkdir ai-voice-bot && cd ai-voice-bot npm init -y npm install express axios dotenv body-parser openai

Create this folder structure:


ai-voice-bot/ ├── server.js ├── routes/voice.js ├── services/{stt.js,gpt.js,tts.js} ├── .env

Sample GPT logic:


// services/gpt.js const { OpenAI } = require('openai'); const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY }); async function generateReply(inputText) { const response = await openai.chat.completions.create({ model: "gpt-4", messages: [ { role: "system", content: "You're a helpful Medicare assistant..." }, { role: "user", content: inputText } ] }); return response.choices[0].message.content; }

3. Handle Transcription & Voice

Use Deepgram or Whisper to transcribe incoming audio, and ElevenLabs to convert GPT text to speech.


// services/tts.js const axios = require('axios'); async function synthesizeSpeech(text) { const response = await axios.post(`https://api.elevenlabs.io/v1/text-to-speech/${process.env.ELEVENLABS_VOICE_ID}`, { text, voice_settings: { stability: 0.75, similarity_boost: 0.75 } }, { headers: { 'xi-api-key': process.env.ELEVENLABS_API_KEY, 'Content-Type': 'application/json' }, responseType: 'arraybuffer' }); const filePath = `./public/output.mp3`; require('fs').writeFileSync(filePath, response.data); return `${process.env.PUBLIC_URL}/output.mp3`; }

4. Deploy & Connect Twilio

  • Host your Node.js app on Fly.io or EC2
  • Point your Twilio SIP webhook to /voice
  • Test a call from VICIdial

Example Call Script

Bot: “Hi, this is your Medicare assistant. Are you looking for information about Part C or D?”User: “I need help comparing plans.”Bot: “Great! Based on your ZIP code, you may qualify for zero-premium plans. Would you like me to connect you to a licensed agent?”

Compliance Tips

  • Always say: “We do not offer every plan available in your area.”
  • Ask: “Do I have your permission to continue?”
  • Log every call with timestamp and transcript
  • Offer easy transfer to a human agent

Want to Build It?

This proof-of-concept is ready to extend into a full platform. You can:

  • Add lead scoring
  • Sync with a CRM
  • Train GPT for Medicare-specific objections
  • Route only qualified leads to live agents

Need help building it or want the full source code?
 📩 Contact me to get a starter repo, SIP config, and voice templates.


Reactions

Loading reactions...
Log in to react to this post.

Comments

Please login to leave a comment.

Newsletter