---
title: "Let your Pipecat agent know when the call broke up"
description: "A pass-through processor for Pipecat that measures the caller and the bot while they talk: dropouts, clipping, level drops, dead air and hum. Turn an event into a note in the LLM context, so the bot asks the caller to repeat instead of answering half a sentence. The audio stays on your machine."
cluster: VoiceLab
level: Practical
updatedAt: 2026-11-03
lang: en
source: https://audiolab.tools/docs/voicelab/pipecat-agent-hears-a-broken-call
---

When a packet is lost on a call, the caller's sentence arrives with a hole in it. A person on the other end notices and says "sorry, you broke up". A voice agent usually does not: the speech-to-text returns what it got, the LLM answers it, and the caller hears a confident reply to something they did not quite say.

The bot can only ask again if something tells it the audio broke. `audiolabtools-pipecat` is that something for a [Pipecat](https://github.com/pipecat-ai/pipecat) pipeline. It watches the caller and the bot while they talk and calls you back with an event when the audio has a gap, clipping, a level drop, dead air or hum. You decide what the bot does with it.

The events are measurements of the signal, not the guess of a model. A dropout is a run of samples that are exactly zero for 20 ms or more, the hole a lost packet leaves. Clipping is samples stuck at full scale. That is why an event comes with numbers you can check, and also why it has limits, listed below.

## What you need

- A Pipecat pipeline (checked with Pipecat 1.14.0 and 1.15.0 on Python 3.13).
- Node.js 22 or newer on the same machine. The measuring runs in a small local process, `audiolab-live` from npm.
- No key and no account. The audio goes over a pipe to that local process and is thrown away there; only the events come back. Nothing is sent to AudioLab.

```bash
pip install audiolabtools-pipecat
npx -y @audiolabtools/live@0.2 --demo     # optional: see a first event in a few seconds
```

## 1. Put the monitor in the pipeline

`AudioLabMonitor` is a pass-through processor: every frame goes on unchanged, and the raw audio is copied to the monitor. Put one after the input to watch the caller, and one before the output to watch what the bot is about to say:

```python
from audiolab_pipecat import AudioLabMonitor

async def on_event(ev):
    print(ev["stream_id"], ev["type"], ev["update"], ev["reason"])

pipeline = Pipeline([
    transport.input(),
    AudioLabMonitor(on_event, watch=("user",)),   # the caller, as it arrives
    stt, user_aggregator, llm, tts,
    AudioLabMonitor(on_event, watch=("bot",)),    # what the bot is about to say
    transport.output(),
    assistant_aggregator,
])
```

Each event is sent twice: once when the monitor raises it (`"update": "raised"`) and once when it ends (`"closed"`, with `duration_s`). The streams are named `call-user` and `call-bot`. Change the prefix with `stream_prefix=`, and use a code, never a name or a phone number.

## 2. Let the bot act on it

If `on_event` returns a Pipecat frame, the monitor pushes it downstream. Because the caller's monitor sits before the user aggregator, an `LLMMessagesAppendFrame` lands in the LLM context:

```python
from pipecat.frames.frames import LLMMessagesAppendFrame

def on_event(ev):
    if ev["type"] == "dropout" and ev["update"] == "closed" and not ev["evidence"].get("endOfStream"):
        note = (f"The caller's audio was cut for {ev['duration_s']:.1f} s just now, so part of what they said may be missing. "
                "If their last words look incomplete, ask them to repeat that part.")
        return LLMMessagesAppendFrame([{"role": "system", "content": note}], run_llm=False)
```

`run_llm=False` adds the note without making the bot speak. The LLM reads it with the caller's next turn, together with the transcript that has the hole in it. The same pattern works for other events:

| Event | What the bot could say |
|---|---|
| `dropout` | "Sorry, you broke up for a moment. Could you say that last part again?" |
| `level_drop` | "You're getting quieter, could you come a bit closer to the phone?" |
| `dead_air` | "Are you still there?" |

Keep the wording in the note, not in code: the LLM knows the conversation and can decide whether the missing part mattered.

## 3. Know where you measure

The two monitors do not see the same thing. Where you can, measure on the bot side, before the codec. That is where study [Live test4](/evidence/studies#live-test4) met its criteria, with faults planted on purpose: in this pipeline and on a LiveKit track before Opus. After Opus most planted gaps were missed, and after 8 kHz telephone audio (mu-law) the clipping rule missed its criteria.

- **The bot side** sees the PCM before the transport encodes it. Gaps and clipping there are seen exactly: in our pipeline test, the planted gap and the planted clipping were found and a clean control raised neither.
- **The caller side** sees the audio after the transport has decoded it. A gap that arrives as exact zeros is seen, but after Opus a gap often no longer arrives that way: in a first LiveKit trial 26 of 30 gaps were found, and in study Live test4 most planted gaps were missed. Clipping is not seen: Opus rounds off the flat tops, and in that first trial it was found 0 of 30 times. A `hum` event can come from the codec rather than the line, so do not act on `hum` from the caller side.
- A platform that skips frames instead of sending zeros leaves no gap in the audio, so no `dropout`.
- When the call ends in silence, the last dropout is closed with `evidence.endOfStream: true`. Ignore those, as the example does.

## What it does not do

It does not hear a TV in the background or a second voice on the line. Telling one voice from another takes a model, and this monitor only measures the signal. It also does not judge the call: every detector has the status "signals", which means none is validated on live calls yet. Treat an event as a reason for the bot to check, not as a diagnosis.

For a full analysis of a recording after the call (loudness, signal-to-noise, bandwidth, where the audio has been, and the other lenses on [/lenses](/lenses)), send it to the AudioLab API or [MCP server](/connect). That route does upload the audio; see [/privacy](/privacy). For gaps in recordings you already have, see [Find lost packets in a recording](/docs/voicelab/find-lost-packets).

To see what this monitor would have raised on a recording, add `"liveEvents": true` to a request to analyze/profile, or `liveEvents: true` to the MCP tool analyze_profile. The same monitor reads the file as a stream, 20 ms at a time, and returns every event with its time, its reason and its numbers, all with the status "signals". A gap or clipping event also names the field of the file analysis that measures the same fault with a rule of its own (chain.dropoutCount or signal.clipping), with its status and why the two can differ.

## Beta

This is a first version. It was tested in a real Pipecat `PipelineTask` fed from WAV files, and the note from step 2 was checked in a real `LLMContext`. It has not yet run in a live call over a real transport.
