Vonage
Vonage Audio Connector streams with VonageFrameSerializer, used with FastAPIWebsocketTransport.
Overview
VonageFrameSerializer speaks the WebSocket protocol of Vonage's Audio Connector, which
streams a Vonage Video session's audio (or a Voice API call's) to your server:
- Binary messages carry raw 16-bit PCM (16 kHz by default), resampled to the pipeline's input rate
as
InputAudioRawFrames. - Bot audio is resampled to the Vonage rate and sent as binary messages.
- JSON text events:
websocket:connected,websocket:clearedandwebsocket:notifyare logged, andwebsocket:dtmfbecomes anInputDTMFFrame. - An
InterruptionFramesends{"action": "clear"}.
Upstream page
Pipecat's documentation for the same serializer.
Source
packages/serializer-vonage/src/vonage.ts.
Vonage docs
The Audio Connector.
Installation
bun add @pipedog/serializer-vonage @pipedog/transport-websocketimport { VonageFrameSerializer } from "@pipedog/serializer-vonage/vonage";Prerequisites
- A Vonage application, and an Audio Connector (or a Voice API
websocketendpoint) pointed at your WebSocket URL, withaudio/l16at the rate you configure.
VonageFrameSerializer
Configuration
Prop
Type
InputParams
params is a VonageFrameSerializer.InputParams (VonageFrameSerializerInputParams):
| Param | Type | Default | Description |
|---|---|---|---|
vonageSampleRate | number | 16000 | Sample rate of the Vonage stream, in Hz (8000, 16000 or 24000). |
sampleRate | number | null | null | Override for the pipeline input rate. null uses the pipeline's. |
resamplerClearAfterSecs | number | null | 0.2 | Seconds of silence after which the stream resamplers clear their history. null never clears. |
ignoreRtviMessages | boolean | true | Drop RTVI messages instead of sending them to Vonage. |
Usage
import { VonageFrameSerializer } from "@pipedog/serializer-vonage/vonage";
import {
FastAPIWebsocketParams,
FastAPIWebsocketTransport,
} from "@pipedog/transport-websocket/fastapi";
import { websocketFetchHandler } from "@pipedog/transport-websocket/fetch";
import type { WebsocketConnection } from "@pipedog/transport-websocket/socket";
async function runSession(connection: WebsocketConnection): Promise<void> {
const serializer = new VonageFrameSerializer({
// The rate you gave the Audio Connector (audio/l16;rate=16000).
params: new VonageFrameSerializer.InputParams({ vonageSampleRate: 16000 }),
});
const transport = new FastAPIWebsocketTransport(
connection,
new FastAPIWebsocketParams({
audioInEnabled: true,
audioOutEnabled: true,
addWavHeader: false,
serializer,
}),
);
// ... build and run the pipeline with transport.input() and transport.output()
}
// The Audio Connector's websocket.uri points here.
const handler = websocketFetchHandler(runSession);Notes
- DTMF digits may arrive as strings or numbers, under
digitordtmf.digit; both work. OutputTransportMessageFrames are sent as JSON text (e.g. anotifyaction), except RTVI messages whileignoreRtviMessagesis on.- There is no hang-up call: end the session from Vonage's side.
Runtime notes
| Runtime | Works | What it needs |
|---|---|---|
| Bun | ✅ yes | Nothing. |
| Node.js | ✅ yes | Nothing. |
| Deno | ✅ yes | Nothing. |
| Cloudflare Workers | ✅ yes | Nothing. |
Generated from pipecat.runtimes and pipecat.compat in packages/serializer-vonage/package.json: ✅ means the compat smoke test passes on that runtime.
Runs on Bun, Node, Deno and Cloudflare Workers. The package's golden tests replay vectors recorded from upstream: at 16 kHz the audio is byte-identical.
pipedog is an unofficial community TypeScript port of Pipecat. It is not affiliated with or endorsed by Daily or the Pipecat project.
Portions adapted from the Pipecat documentation, Copyright (c) 2024–2025 Daily, BSD-2-Clause (see apps/docs/LICENSE-pipecat-docs).