---
title: "Build an AI Voice Assistant with Twilio Voice and Media Streams, Rime's Prism, and Node.js"
description: "The tutorial shows how to connect Rime’s Prism speech-to-speech model to Twilio’s voice infrastructure using Twilio Media Streams, Node.js, and Rime’s Node SDK. It covers setting up a Node.js project with Fastify, installing dependencies, and writing audio conversion code to handle the format mismatch between Twilio’s 8 kHz G.711 μ-law and Prism’s 16/24 kHz PCM16. The server manages WebSocket connections, converts incoming μ-law audio to PCM16 for Prism, and converts Prism’s 24 kHz output back to 8 kHz μ-law for Twilio using a low-pass filter and decimation. Additional features include interruption handling, tool calling, persisting customer details with Twilio’s Conversation Memory, and analyzing transcripts with Conversation Intelligence. The tutorial concludes with troubleshooting tips and next steps for further exploration."
---

# Build an AI Voice Assistant with Twilio Voice and Media Streams, Rime's Prism, and Node.js

[Twilio](https://yomu.fyi/company/twilio) · Paul Kamp, Safdar Jaffari · Oct 30, 2026

**Type:** Tutorial

## Summary

The tutorial shows how to connect Rime’s Prism speech-to-speech model to Twilio’s voice infrastructure using Twilio Media Streams, Node.js, and Rime’s Node SDK. It covers setting up a Node.js project with Fastify, installing dependencies, and writing audio conversion code to handle the format mismatch between Twilio’s 8 kHz G.711 μ-law and Prism’s 16/24 kHz PCM16. The server manages WebSocket connections, converts incoming μ-law audio to PCM16 for Prism, and converts Prism’s 24 kHz output back to 8 kHz μ-law for Twilio using a low-pass filter and decimation. Additional features include interruption handling, tool calling, persisting customer details with Twilio’s Conversation Memory, and analyzing transcripts with Conversation Intelligence. The tutorial concludes with troubleshooting tips and next steps for further exploration.

## Context

Building an AI voice assistant that can handle phone calls using Twilio’s voice infrastructure and Rime’s Prism speech-to-speech model.

## Approach / What changed

Set up a Node.js server with Fastify and WebSocket support, connect Twilio Media Streams to Rime Prism via the Rime Node SDK, implement audio conversion between μ-law and PCM16, and add features like interruption handling, tool calling, Conversation Memory, and Conversation Intelligence.

## Takeaways

- Twilio Media Streams uses 8 kHz G.711 μ-law audio, while Rime Prism uses 16 kHz PCM16 input and 24 kHz PCM16 output, requiring audio conversion.
- The audio conversion from 24 kHz PCM16 to 8 kHz μ-law uses a low-pass filter with a 3.6 kHz cutoff and decimation by keeping every third sample.
- The tutorial demonstrates persisting customer details across calls using Twilio’s Conversation Memory and analyzing transcripts with Conversation Intelligence.

## FAQ

### What audio format does Twilio Media Streams use?

Twilio Media Streams sends and receives 8 kHz G.711 μ-law audio. This differs from Rime Prism which uses 16 kHz PCM16 input and 24 kHz PCM16 output, requiring conversion.

### How do you convert Prism's 24 kHz output to Twilio's 8 kHz μ-law?

The conversion uses a low-pass filter with a 3.6 kHz cutoff to remove frequencies above 4 kHz, then keeps every third sample to decimate from 24 kHz to 8 kHz, and encodes the result as μ-law.

### What features does the tutorial add beyond basic voice conversation?

The tutorial adds interruption handling, tool calling, persisting customer details with Twilio's Conversation Memory, and analyzing transcripts with Conversation Intelligence.

**Tags:** [Node.js](https://yomu.fyi/topic/node-js), [Rime](https://yomu.fyi/topic/rime), [Twilio](https://yomu.fyi/topic/twilio), [Voice AI](https://yomu.fyi/topic/voice-ai), [WebSockets](https://yomu.fyi/topic/websockets)

- Source: [Twilio](https://www.twilio.com/en-us/blog/developers/tutorials/integrations/voice-ai-agent-rime-prism-node)
- Source URL: https://www.twilio.com/en-us/blog/developers/tutorials/integrations/voice-ai-agent-rime-prism-node
- Ingested by Yomu: 2026-10-31T03:00:13.721Z

[Read original post](https://www.twilio.com/en-us/blog/developers/tutorials/integrations/voice-ai-agent-rime-prism-node)
