pipedog is an unofficial community port of Pipecat, not affiliated with Daily.
pipedog

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:cleared and websocket:notify are logged, and websocket:dtmf becomes an InputDTMFFrame.
  • An InterruptionFrame sends {"action": "clear"}.

Installation

bun add @pipedog/serializer-vonage @pipedog/transport-websocket
import { VonageFrameSerializer } from "@pipedog/serializer-vonage/vonage";

Prerequisites

  • A Vonage application, and an Audio Connector (or a Voice API websocket endpoint) pointed at your WebSocket URL, with audio/l16 at the rate you configure.

VonageFrameSerializer

Configuration

Prop

Type

InputParams

params is a VonageFrameSerializer.InputParams (VonageFrameSerializerInputParams):

ParamTypeDefaultDescription
vonageSampleRatenumber16000Sample rate of the Vonage stream, in Hz (8000, 16000 or 24000).
sampleRatenumber | nullnullOverride for the pipeline input rate. null uses the pipeline's.
resamplerClearAfterSecsnumber | null0.2Seconds of silence after which the stream resamplers clear their history. null never clears.
ignoreRtviMessagesbooleantrueDrop RTVI messages instead of sending them to Vonage.

Usage

vonage.ts
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 digit or dtmf.digit; both work.
  • OutputTransportMessageFrames are sent as JSON text (e.g. a notify action), except RTVI messages while ignoreRtviMessages is on.
  • There is no hang-up call: end the session from Vonage's side.

Runtime notes

RuntimeWorksWhat it needs
Bun✅ yesNothing.
Node.js✅ yesNothing.
Deno✅ yesNothing.
Cloudflare Workers✅ yesNothing.

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).

On this page