Skip to content

VAPI-4167 feat: per-peer sent/received counters in call stats - #29

Merged
smoghe-bw merged 1 commit into
mainfrom
VAPI-4167_per-peer-call-stats
Oct 14, 2026
Merged

smoghe-bw merged 1 commit into
mainfrom
VAPI-4167_per-peer-call-stats

Conversation

@smoghe-bw

@smoghe-bw smoghe-bw commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Jira: VAPI-4167

Summary

  • Add publishPeer and subscribePeer (new exported PeerCallStats type) to CallStatsSnapshot.
  • Each holds audio RTP packetsSent, bytesSent, packetsReceived, bytesReceived, read only from that peer connection's own stats report, so stats can be attributed to the peer they came from.
  • The publish peer normally only sends and the subscribe peer normally only receives; the other direction is normally 0.
  • Non-breaking: every existing flat field keeps its meaning and value (flat bytesSent is still publish outbound, flat bytesReceived is still subscribe inbound, bitrates unchanged).
  • README getCallStats section documents the new fields.

Example snapshot fragment:

{
  "packetsReceived": 10,
  "bytesReceived": 2000,
  "packetsSent": 20,
  "bytesSent": 4000,
  "publishPeer": { "packetsSent": 20, "bytesSent": 4000, "packetsReceived": 0, "bytesReceived": 0 },
  "subscribePeer": { "packetsSent": 0, "bytesSent": 0, "packetsReceived": 10, "bytesReceived": 2000 }
}

Test plan

  • npm test passes (180 tests)
  • Each peer's counters come only from its own report (distinct numbers for outbound and inbound on both reports)
  • Counters are summed across audio streams
  • Non-audio stats are ignored
  • Missing peer connection gives zeros
  • Flat fields are unchanged (existing tests pass)

🤖 Generated with Claude Code

Add publishPeer and subscribePeer to CallStatsSnapshot, each holding that
peer connection's own audio RTP packets/bytes sent and received, so stats can
be attributed to the peer they came from. Existing flat fields are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@smoghe-bw
smoghe-bw requested review from a team as code owners October 14, 2026 20:37
@bwappsec

bwappsec commented Oct 14, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@smoghe-bw
smoghe-bw merged commit 4571f24 into main Oct 14, 2026
5 checks passed
@smoghe-bw
smoghe-bw deleted the VAPI-4167_per-peer-call-stats branch October 14, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants