> ## 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.

# Check and diagnose a SIP call

> Find a call over your SIP trunk, see which side hung up, read the call quality Plivo measured, and get a plain-English explanation of what happened.

Find a SIP trunk call and inspect its result. After [logging in](https://plivo.com/docs/cli/install.md#log-in-with-a-browser), list recent calls and copy a call UUID, its unique identifier:

```bash theme={null}
plivo sip calls list --limit 5
plivo sip calls insights "<call_uuid>"
```

Replace `"<call_uuid>"` with an ID from the list. SIP means Session Initiation Protocol, which controls calls between Plivo and your platform.

Once your number is connected to a voice-agent platform (see [Test and connect a platform](https://plivo.com/docs/cli/voice-agent/connect-sip-platform.md)), these commands tell you what happened on any call over the trunk:

| Step | Command | What it tells you |
| - | - | - |
| 1 | `plivo sip calls list` | Finds the call and its UUID |
| 2 | `plivo sip calls get <call_uuid>` | The call record, ending with which side hung up |
| 3 | `plivo sip calls insights <call_uuid>` | Round-trip time, jitter, packet loss, post-dial delay and the quality score |
| 4 | `plivo sip calls diagnose <call_uuid>` | Plivo's AI assistant explains the call and what to fix |

## Find the call

```bash theme={null}
plivo sip calls list --since 2026-10-01
plivo sip calls list --direction inbound --hangup-source carrier --since 2026-10-14
```

`--since` and `--until` (or `--from-date` and `--to-date`) filter on when a call ended, in UTC. You can also filter by `--from-number`, `--to-number`, `--hangup-cause-code`, `--hangup-source` and `--stir-verification`. See [SIP trunking](https://plivo.com/docs/cli/apis/sip.md#trunk-calls) for every flag.

## See which side hung up

`sip calls get` and `sip calls insights` both end with the side that ended the call:

```text theme={null}
Plivo: Normal Hangup (4000), hung up by customer (your infrastructure)
Platform's final SIP response: not available
```

| Hangup source | Means |
| - | - |
| `customer` | Your side: the voice-agent platform or your own SIP infrastructure |
| `carrier` | The phone network on the caller's or callee's side |
| `zentrunk` | Plivo's SIP trunking platform |

The platform's final SIP response always reads "not available", because no API returns it. The SIP logs in the console have it: `plivo open sip-call <call_uuid>` opens that call there.

## Check call quality

```bash theme={null}
plivo sip calls insights "<call_uuid>"
```

| Field | What it holds |
| - | - |
| `rtt` | Round-trip time, in ms |
| `jitter` | Variation in packet arrival, in ms |
| `packet_loss` | Share of audio packets lost, in % |
| `post_dial_delay` | Time from dialling to ringing, in ms |
| `plivo_quality_score` | Plivo's score from 1 to 5. A value outside that range is labelled as such. |
| `from.carrier`, `from.region`, `to.carrier`, `to.region` | The carrier and region of each side of the call |

These field paths are relative to `data` in JSON output. Values are printed as the API returns them; the CLI does not calculate new quality scores. For example, use `--query 'data.from.carrier'` to select the originating carrier.

## Ask what happened

```bash theme={null}
plivo sip calls diagnose "<call_uuid>"      # usually about a minute
```

`diagnose` reads the trunk call and explains what happened, the likely cause and the next steps. It works on SIP trunk calls only; for a Voice API call use `plivo voice calls diagnose`.

With `-o json` it prints one result with `what_happened`, `likely_cause`, `timeline`, `next_steps`, `hangup_cause_code`, `hangup_source`, `confidence` and `answer`. It exits `3` if the analysis fails or stops early. The fields are described on [Diagnose a call](https://plivo.com/docs/cli/voice-agent/diagnose-call.md#read-the-result-in-a-script).

> [!NOTE]
>
> `diagnose` and `plivo ask` share a limit of 5 requests per 60 seconds per account. Only calls on your own account can be diagnosed.
