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 PyPIProtocol Reference
The WebSocket call protocol this serializer implements
didlogic
didlogic telephony platform and account signup
Installation
This is a community-maintained package distributed separately frompipecat-ai:
Prerequisites
didlogic Account Setup
Before using the didlogic serializer, you need:- 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. - 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. - 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 callsDIDLOGIC_SIP_ACCOUNT: the SIP account the call is billed and routed againstPUBLIC_WSS_URL: the publicwss://base the platform dials back onDIDLOGIC_STREAM_TOKEN: optional, sent to your endpoint asAuthorization: Bearer <token>on the WebSocket upgrade
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 thestart 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 theparams 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 aFastAPIWebsocketTransport:
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 sentstart, 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:
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 withpipecat-ai 1.12.0. Check the
source repository for the
latest tested version and changelog.