> ## Documentation Index
> Fetch the complete documentation index at: https://plivo.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Diagnose a call

> Get a plain-English explanation of what happened on any call to your voice agent (failed, cut short, or completed) and what to fix.

Give `diagnose` any call UUID and it explains what happened: whose side each step was on (your server, Plivo, the carrier), the timeline, and anything unusual. Use it on a failed call to find out why, and on a completed call that ended sooner than expected, had one-way audio, or dropped its stream. For a voice agent the usual culprits are three: Plivo could not reach your answer URL, the XML it returned was not valid, or the WebSocket bot did not answer: `diagnose` tells you which.

```bash theme={null}
plivo voice calls list --limit 5                 # find the UUID
plivo voice calls diagnose <call_uuid>           # usually about a minute; allow 30 to 120 s
```

A typical answer:

```text theme={null}
What happened: This inbound call was terminated because Plivo could not fetch call instructions from your answer URL.
Likely cause: The answer URL https://api.example.com/plivo/answer returned 404. The call was hung up with
              cause 7011 (Error Reaching Answer URL).
Timeline: 07:48:40.600 call received · 07:48:40.630 answer URL responded 404 · 07:48:41.016 call hung up
Suggested next step: Make sure the answer URL is deployed and returns Plivo XML with HTTP 200; every inbound call will fail until it does.
```

The hangup causes you will see most often while building a voice agent:

| Hangup cause                     | Meaning                                                                                     | Fix                                                                                                                             |
| -------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `7011` Error reaching answer URL | Plivo could not fetch your answer URL (down, not public, tunnel closed, 4xx/5xx)            | Check the URL is reachable from the internet; while developing, use [Forward calls to your bot](/docs/cli/voice-agent/forward-calls) |
| `8011` Invalid answer XML        | The answer URL returned something that is not Plivo XML (often JSON, or an HTML error page) | Return `<Response><Stream …>` with `Content-Type: application/xml`; check with `curl -X POST <answer-url>`                      |
| `4010` End of XML instructions   | Normal end; the bot closed the WebSocket, or the XML finished                               | Only a problem if the call ended earlier than you expected: check your bot's logs for why it closed                             |
| `USER_BUSY` (from your XML)      | Your answer URL returned `<Hangup>` or an empty response                                    | Fix the branch of your code that returned it                                                                                    |

If the answer URL and XML are fine but the caller hears silence, the bot is the problem: reproduce without a phone with [Test your WebSocket endpoint](/docs/cli/voice-agent/test-websocket). For the raw record (hangup cause, source, duration) run `plivo voice calls get <call_uuid> -o json`.

<Note>
  The answer is written by Plivo's AI assistant, so treat it as an explanation to read, not a stable schema to parse. `diagnose` and `plivo ask` share a limit of 5 requests per 10 minutes per account. Only calls on your own account can be diagnosed. For messages and general questions see [Diagnose and ask](/docs/cli/apis/diagnose-ask).
</Note>
