A scalable AI Voice Calling Agent built with Next.js, Faster-Whisper, Ollama (Qwen), and Piper TTS.
The goal of this project is to create a low-cost outbound AI calling system that can be integrated with VICIdial/Asterisk while keeping infrastructure costs minimal using open-source models.
Caller
│
▼
Speech (Audio)
│
▼
Faster Whisper
(Speech → Text)
│
▼
Qwen (Ollama)
(Text → Text)
│
▼
Piper
(Text → Speech)
│
▼
Caller hears AI Response
- Next.js 15
- TypeScript
- Faster-Whisper
- Ollama
- Qwen 2.5
- Piper TTS
- Node.js
- REST API
voice-agent/
├── app/
│ ├── api/
│ │ ├── stt/
│ │ │ └── route.ts
│ │ │
│ │ ├── llm/
│ │ │ └── route.ts
│ │ │
│ │ ├── tts/
│ │ │ └── route.ts
│ │ │
│ │ └── call/
│ │ └── route.ts
│ │
│ └── page.tsx
│
├── lib/
│ ├── whisper/
│ │ ├── transcribe.ts
│ │ └── index.ts
│ │
│ ├── ollama/
│ │ ├── generate.ts
│ │ └── index.ts
│ │
│ ├── piper/
│ │ ├── speak.ts
│ │ └── index.ts
│ │
│ └── pipeline/
│ └── voicePipeline.ts
│
├── services/
│ ├── stt.service.ts
│ ├── llm.service.ts
│ ├── tts.service.ts
│ └── call.service.ts
│
├── temp/
│ ├── audio/
│ └── output/
│
├── utils/
├── types/
├── public/
└── package.json
Receive caller audio.
Audio
↓
Convert speech into text.
Faster Whisper
↓
Example:
Hello, I want to rent an apartment.
↓
Send transcript to the LLM.
Ollama
│
▼
Qwen 2.5
↓
Example response
Sure!
Can I know which city you're interested in?
↓
Convert text into speech.
Piper TTS
↓
Return audio back to the caller.
Responsible only for converting audio into text.
Input
Audio
Output
Text
Responsible only for reasoning and generating responses.
Input
Text
Output
Text
Responsible only for converting text into speech.
Input
Text
Output
Audio
Audio
│
▼
Speech To Text
│
▼
LLM
│
▼
Text To Speech
│
▼
Return AudioImplement Faster Whisper.
Goal:
Audio
↓
Text
Integrate Ollama.
Goal:
Audio
↓
Whisper
↓
Qwen
Integrate Piper.
Goal:
Audio
↓
Whisper
↓
Qwen
↓
Piper
Create complete pipeline.
voicePipeline()
↓
Whisper
↓
Qwen
↓
Piper
↓
Return Audio
Integrate with VICIdial / Asterisk.
Phone Call
↓
Voice Pipeline
↓
AI Response
↓
Caller
- Streaming responses
- Interrupt handling (barge-in)
- Voice Activity Detection (VAD)
- Conversation memory
- RAG support
- CRM integration
- Call recording
- Analytics dashboard
- Multi-language support
- GPU deployment
- Docker support
- Kubernetes deployment
Build a production-ready AI Voice Calling Agent capable of handling outbound calls using open-source AI models while minimizing infrastructure costs.