Overview
GenesysAudioHookSerializer enables integration with Genesys Cloud Contact Center via the AudioHook protocol (v2), allowing your Pipecat application to handle contact center interactions with bidirectional audio streaming, DTMF event handling, barge-in support, and Architect flow variable passing.
Genesys Serializer API Reference
Pipecat’s API methods for Genesys AudioHook integration
Genesys AudioHook Documentation
Official Genesys AudioHook protocol reference
Installation
TheGenesysAudioHookSerializer does not require any additional dependencies beyond the core Pipecat library:
Prerequisites
Genesys Cloud Setup
Before using GenesysAudioHookSerializer, you need:- Genesys Cloud Organization: Access to a Genesys Cloud org with AudioHook enabled
- AudioHook Integration: Configure an AudioHook integration in Genesys Cloud admin
- Architect Flow: Create an Architect flow that uses the AudioHook action to connect calls to your Pipecat application
- WebSocket Endpoint: A publicly accessible WebSocket endpoint for Genesys to connect to
Key Features
- Bidirectional Audio: Stream audio between Genesys and Pipecat in PCMU format at 8kHz
- Protocol Handshake: Automatic handling of open/opened, close/closed, and ping/pong messages
- DTMF Handling: Process touch-tone events from callers
- Barge-in Support: Notify Genesys when the user interrupts bot audio
- Pause/Resume: Handle hold scenarios, and pause or resume the stream from your bot
- Architect Variables: Pass input/output variables between Architect flows and your bot
- Stereo Support: Process external (customer) audio, internal (agent) audio, or both channels
Configuration
InputParams
default:"None"
Configuration parameters for audio and protocol behavior. See
InputParams below.
InputParams
Usage
Basic Setup
With Language Support
Accessing Call Metadata
After the AudioHook session opens, you can access call metadata from the serializer:Setting Output Variables
Output variables are passed back to the Genesys Architect flow when the session closes, allowing your bot to influence downstream call routing and logic:Server-Initiated Disconnect
To disconnect the session from the server side (e.g., when the bot has finished):Event Handlers
The serializer emits an event for each AudioHook message it receives from Genesys:on_open, on_close, on_ping, on_paused, on_resumed, on_update (participant or configuration changes), on_error, and on_dtmf. Each handler receives the serializer and the Genesys message as a dict:
on_pause is also emitted when Genesys pauses the stream.
event
deprecated
Deprecated since 1.16.0, removed in 2.0.0. Use
on_paused instead.Frames
Sent to the serializer:
Pushed by the serializer:
Methods
create_pause_request()
pause message asking Genesys to pause the audio stream. Genesys answers with paused, which pauses the session. Send it in an OutputTransportMessageUrgentFrame:
create_resume_request()
resume message asking Genesys to resume the audio stream. Genesys answers with resumed, which resumes the session. Send it in an OutputTransportMessageUrgentFrame, including to start a session opened with start_paused=True:
create_resumed_response()
create_resume_request() instead.
Protocol Details
AudioHook v2 Protocol
The Genesys AudioHook protocol uses WebSocket connections with two frame types:- Text frames: JSON control messages for session lifecycle (open, close, ping, pause, resume, etc.)
- Binary frames: Raw audio data in PCMU or L16 format
Message Flow
A typical session follows this sequence:- Genesys connects to your WebSocket endpoint
- Genesys sends an
openmessage with session metadata - The serializer automatically responds with
opened - Bidirectional audio streaming begins via binary frames
- Genesys sends periodic
pingmessages; the serializer responds withpong - When the call ends, Genesys sends
close; the serializer responds withclosed(including any output variables)
Audio Format
- Default encoding: PCMU (mu-law) at 8kHz mono
- Automatic resampling: The serializer converts between the 8kHz Genesys format and your pipeline’s sample rate using Pipecat’s built-in resampling
- Stereo handling: When channel is set to
"both", Genesys sends stereo audio with external (customer) on the left channel and internal (agent) on the right. The serializer extracts the external channel for processing.
Notes
- Fixed packet size: Set
audio_out_10ms_chunks=20on your transport parameters. This sends outbound audio in 200 ms packets, since Genesys rate-limits incoming messages. - No extra dependencies: The serializer uses Pipecat’s built-in G.711 conversion functions (
pcm_to_ulaw,ulaw_to_pcminpipecat.audio.g711) and audio resampler. - Pause/resume: When Genesys pauses the stream (e.g., caller placed on hold) it sends
paused, and the serializer drops incoming and outgoing audio until Genesys sendsresumed. Usecreate_pause_request()andcreate_resume_request()to ask Genesys to pause or resume. - Output variables: Variables set via
set_output_variables()are included in theclosedresponse when Genesys terminates the session. These variables become available in the Architect flow for routing decisions. - L16 format: The serializer accepts
AudioHookMediaFormat.L16as a configuration option but drops all audio in both directions with it. Use PCMU (the default).