Skip to main content

Generate SIP call-flow (ladder) diagrams from pcap files. Mermaid + SVG output.

Project description

sip-ladder

Generate SIP call-flow (ladder) diagrams from pcap files.

Reads a pcap, parses SIP messages, groups them into calls by Call-ID, and renders the resulting message flow as either a Mermaid sequence diagram (text, embeddable in Markdown) or a standalone SVG.

The diagram algorithm is ported from sngrep's ncurses "Call Flow" view (src/curses/ui_call_flow.c), with one improvement: sngrep treats every distinct IP:port as a separate actor column, so a proxy listening on :5060 and originating on :5061 shows up twice. sip-ladder uses Via and Contact headers to merge those into a single logical actor.

Install

uv tool install sip-ladder
# or, ad-hoc:
uvx sip-ladder trace.pcap -o flow.mmd

Example output

Given a pcap containing a basic INVITE flow, sip-ladder produces:

---
title: demo-1-simple@atlanta.example INVITE → 200
---
sequenceDiagram
    autonumber
    participant A as alice@192.0.2.10
    participant B as 192.0.2.20:5060
    A->>B: INVITE
    B-->>A: 100 Trying
    B-->>A: 180 Ringing
    B-->>A: 200 OK (INVITE)
    A->>B: ACK
    A->>B: BYE

The pcap that produced this — plus a redirect call and a REFER-based transfer — lives in examples/build_demo_pcap.py. Run it locally to regenerate:

uv run python examples/build_demo_pcap.py
# Produces examples/demo-call-flow.{pcap,mmd,svg}

GitHub, GitLab, Obsidian, and most modern Markdown viewers render the Mermaid block above as a sequence diagram. On platforms that don't (PyPI's README renderer, plain-text consumers), the fenced code block remains readable as-is.

CLI

sip-ladder trace.pcap                   # render all calls as Mermaid to stdout
sip-ladder trace.pcap -o flow.mmd       # write Mermaid to file
sip-ladder trace.pcap -o flow.svg       # extension drives format
sip-ladder trace.pcap --list            # list calls without rendering
sip-ladder trace.pcap --call-id abc...  # render just one call

Library

from sip_ladder import read_pcap, render_mermaid, render_svg

for call in read_pcap("trace.pcap"):
    print(f"{call.call_id}  {call.from_uri} -> {call.to_uri}  ({call.final_response})")
    open(f"{call.call_id}.mmd", "w").write(render_mermaid(call))
    render_svg(call, f"{call.call_id}.svg")

Scope

In-scope for the initial release:

  • Offline pcap analysis (UDP and best-effort TCP)
  • SIP message parsing (RFC 3261 — common cases)
  • Mermaid + SVG renderers
  • Via-aware actor reconciliation
  • Retransmit detection via CSeq match

Out-of-scope (deferred):

  • Live capture (libpcap, HEP/EEP listener, sngrep subprocess streaming)
  • RTP / MOS analysis
  • TLS decryption
  • SIP-over-WebSocket
  • Interactive HTML

The architecture leaves clean seams to add these later without restructuring.

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sip_ladder-2026.5.25.5.tar.gz (64.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sip_ladder-2026.5.25.5-py3-none-any.whl (32.2 kB view details)

Uploaded Python 3

File details

Details for the file sip_ladder-2026.5.25.5.tar.gz.

File metadata

  • Download URL: sip_ladder-2026.5.25.5.tar.gz
  • Upload date:
  • Size: 64.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"EndeavourOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sip_ladder-2026.5.25.5.tar.gz
Algorithm Hash digest
SHA256 bdd76780eaa4fb4a0cedf7f0aa1be5a989fdf3e8f141ed6582976dc320421d61
MD5 ff4cbc38879ee2ba683be96c4ea06246
BLAKE2b-256 ecdf59f2d40dfdf9ea69012256ae4d7fa69c573d014c1e8f3e1be0abe7ab015b

See more details on using hashes here.

File details

Details for the file sip_ladder-2026.5.25.5-py3-none-any.whl.

File metadata

  • Download URL: sip_ladder-2026.5.25.5-py3-none-any.whl
  • Upload date:
  • Size: 32.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"EndeavourOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sip_ladder-2026.5.25.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c59716cac9fb35a912cd3a3605495c1f0d7d3a88b5ff82ae419cc62863f8bb9c
MD5 f5cba1476b88a18229c1a83c8768b4cb
BLAKE2b-256 912d3e48b156f0dc0baeba7e402e3fec2dbdd9571b5d00ff8af2bc9204728d7f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page