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 when audio streaming is temporarily suspended
- 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
Configuration parameters for audio and protocol behavior. See
InputParams below.
InputParams
| Parameter | Type | Default | Description |
|---|---|---|---|
genesys_sample_rate | int | 8000 | Sample rate used by Genesys (Hz). |
sample_rate | int | None | Optional override for pipeline input sample rate. When None, uses the pipeline’s configured rate. |
channel | AudioHookChannel | "external" | Which audio channels to process: "external" (customer), "internal" (agent), or "both" (stereo). |
media_format | AudioHookMediaFormat | "PCMU" | Audio format: "PCMU" (mu-law) or "L16" (16-bit linear PCM). |
process_external | bool | True | Whether to process external (customer) audio. |
process_internal | bool | False | Whether to process internal (agent) audio. |
supported_languages | list[str] | None | List of language codes the bot supports (e.g., ["en-US", "es-ES"]). |
selected_language | str | None | Default language code to use. |
start_paused | bool | False | Whether to start the session in paused state. |
ignore_rtvi_messages | bool | True | Whether to ignore RTVI protocol messages during serialization. |
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 events that you can handle for custom logic: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, 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 SOXR 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_fixed_packet_size=1600on your transport parameters. This batches outbound audio into consistent chunks and prevents 429 rate limiting from Genesys. - No extra dependencies: The serializer uses Pipecat’s built-in audio conversion utilities (
pcm_to_ulaw,ulaw_to_pcm) and SOXR resampler. - Barge-in: When the pipeline emits an
InterruptionFrame, the serializer automatically sends a barge-in event to Genesys, which stops any queued audio playback on the Genesys side. - Pause/resume: When Genesys sends a
pausemessage (e.g., caller placed on hold), audio processing is suspended. The serializer drops incoming and outgoing audio while paused. Use theon_pauseevent handler andcreate_resumed_response()to control when streaming resumes. - 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. - DTMF support: Phone keypad events are converted to
InputDTMFFrameobjects and can be processed in your pipeline. - L16 format: While the serializer accepts
AudioHookMediaFormat.L16as a configuration option, L16 support is not yet fully implemented. Use PCMU (the default) for production deployments.