Skip to main content

Overview

DidlogicFrameSerializer converts audio between Pipecat frames and the didlogic voice-stream WebSocket protocol, so a Pipecat bot can take a call on a didlogic number or be the agent leg of an outbound call. It is used with FastAPIWebsocketTransport. didlogic dials your endpoint, so the bot is the WebSocket server. One protocol carries both directions of call: inbound, where somebody called a number pointed at your endpoint, and outbound, placed through the Click2Call API with a_type: "stream".

Source Repository

Source code, examples, and issues for the didlogic integration

PyPI Package

The pipecat-didlogic package on PyPI

Protocol Reference

The WebSocket call protocol this serializer implements

didlogic

didlogic telephony platform and account signup

Installation

This is a community-maintained package distributed separately from pipecat-ai:

Prerequisites

didlogic Account Setup

Before using the didlogic serializer, you need:
  1. didlogic account with voice streaming enabled. This is enabled per account — if the WebSocket destination type is absent from the portal, or the API answers 422 a_type_unsupported, ask support to turn it on.
  2. A publicly reachable wss:// address. The platform dials your endpoint rather than the other way round, so it has to be reachable from the internet.
  3. One of: a phone number with its destination set to your wss:// address, for inbound calls; or an API token and SIP account, to place outbound calls through Click2Call.

Required Environment Variables

Nothing is required by the serializer itself — it reads everything it needs off the socket. The outbound example in the source repository uses:
  • DIDLOGIC_API_TOKEN: your API token, for placing Click2Call calls
  • DIDLOGIC_SIP_ACCOUNT: the SIP account the call is billed and routed against
  • PUBLIC_WSS_URL: the public wss:// base the platform dials back on
  • DIDLOGIC_STREAM_TOKEN: optional, sent to your endpoint as Authorization: Bearer <token> on the WebSocket upgrade
Both examples also use OPENAI_API_KEY, DEEPGRAM_API_KEY and CARTESIA_API_KEY for the speech and LLM services in the pipeline.

Configuration

The serializer takes no required arguments. The call id, both numbers and the direction are read from the start message.
DidlogicFrameSerializer.InputParams
default:"None"
Serializer configuration. Defaults to DidlogicFrameSerializer.InputParams() when not provided. See Input Parameters below.
Optional[str]
default:"None"
The call’s identifier, for a caller that read start before building the serializer. Left unset, it is learned from start.
Optional[str]
default:"None"
The calling party, on the same terms as call_id.
Optional[str]
default:"None"
The called party, on the same terms as call_id.
Optional[str]
default:"None"
"inbound" or "outbound", on the same terms as call_id.

Input Parameters

Configuration passed via the params constructor argument using DidlogicFrameSerializer.InputParams(...).
didlogic uses a fixed media format: PCM16, 24 kHz, mono, base64-encoded inside JSON messages, one 10 ms frame per media message. Audio sent back may be any length. See the source repository for the authoritative, up-to-date list of parameters.

Usage

Wire the serializer into a FastAPIWebsocketTransport:
Telephony audio carries no WAV header, so add_wav_header must be False. Everything else in the pipeline — STT, LLM, TTS — is ordinary Pipecat.

Waiting for an outbound call to be answered

On an outbound call the platform answers the bot’s leg as soon as it has sent start, which is before the person’s phone has rung. A bot that greets on connect talks to a line nobody is on. The answered event is what says the far end picked up, and it reaches the pipeline as an InputTransportMessageFrame:
Place it directly after transport.input(). On an inbound call the caller is already on the line, so the greeting belongs right after the pipeline starts instead. Interruptions are handled by sending clear, so the platform drops audio it has buffered but not yet played. DTMF arrives as InputDTMFFrame. See the source repository for complete inbound and outbound examples, including the Click2Call request.

Compatibility

Tested with pipecat-ai 1.12.0. Check the source repository for the latest tested version and changelog.