Skip to content

feat: Advanced call-stats REST coverage - #4

Merged
Nash0x7E2 merged 8 commits into
mainfrom
cursor/ai-769-sip-and-advanced-call-stats-17e5
Sep 4, 2026
Merged

feat: Advanced call-stats REST coverage#4
Nash0x7E2 merged 8 commits into
mainfrom
cursor/ai-769-sip-and-advanced-call-stats-17e5

Conversation

@Nash0x7E2

@Nash0x7E2 Nash0x7E2 commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

Expands the server-side video REST surface to close the coverage gap versus the reference Go server SDK (GetStream/getstream-go), adding the advanced call statistics / reporting suite. All additions are additive — no changes to existing public API.

Endpoint paths, request/response field names, and query-parameter encoding follow the existing VideoClient / Call REST conventions and typed model style.

Advanced call statistics & reporting

Application-level, on VideoClient:

  • get_active_calls_status
  • query_aggregate_call_stats
  • query_call_session_stats
  • get_daily_digest
  • query_user_feedback
  • report_client_call_event

Call-session-scoped, on Call:

  • get_call_participant_session_metrics
  • query_call_participant_sessions
  • get_call_session_participant_stats_details
  • query_call_session_participant_stats
  • get_call_session_participant_stats_timeline

Consistent with the existing stats/report types, deeply nested analytics payloads are kept as serde_json::Value while envelope, identity, and pagination fields are typed. query_user_feedback sends full as a query parameter and the remaining fields as the JSON body; the GET query endpoints encode filter_conditions (JSON object) and sort (comma-joined JSON entries) the same way the Go SDK does.

The call-session-scoped queries take the coordinator call session id (get().call.session.id). This is distinct from Call::session_id(), which is the caller's own SFU session and is reported as user_session_id within these payloads.

sort and filter_conditions are encoded as JSON query parameters (sort as a JSON array). Sorting is supported on the query_call_session_stats / query_user_feedback request bodies; query_call_session_participant_stats currently answers any non-empty sort with custom sorting is not supported, which is documented on the field.

Scope

SIP telephony is not part of this PR and will ship separately.

Tests

  • Unit tests for request serialization / wire shapes and for the query-parameter encoding helpers.
  • Live integration test (tests/video_stats.rs) that skips cleanly without credentials and deletes the call it creates on every exit path:
    • Active-calls status structural invariants.
    • Session-scoped participant stats after a real join, asserting the identity-echo fields and that the participant session carries the join's SFU session id. The query populates limit and filter_conditions so the query-parameter encoding is validated against the server rather than only against its own unit test. Because analytics can trail the call, the queries retry on 404 for a bounded window and then fail — a persistent 404 is a test failure, not a skip.

Verification

  • cargo fmt --all --check
  • cargo clippy --locked --all-targets --all-features -- -D warnings
  • cargo test --locked (full suite, live credentials configured)
  • RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps

All pass.

Refs AI-769.

Open in Web Open in Cursor 

cursoragent and others added 4 commits September 4, 2026 17:11
Co-authored-by: nash <nash@getstream.io>
Co-authored-by: nash <nash@getstream.io>
Co-authored-by: nash <nash@getstream.io>
@Nash0x7E2 Nash0x7E2 self-assigned this Sep 4, 2026
…hunks)

Co-authored-by: nash <nash@getstream.io>
@Nash0x7E2
Nash0x7E2 marked this pull request as ready for review September 4, 2026 17:31
@Nash0x7E2 Nash0x7E2 changed the title feat: SIP telephony and advanced call-stats REST coverage feat: Advanced call-stats REST coverage Sep 4, 2026
Nash0x7E2 and others added 3 commits September 4, 2026 12:34
The call-session-scoped stats endpoints are keyed by the coordinator call
session id (`get().call.session.id`). The integration test passed
`Call::session_id()`, which is the caller's own SFU session and is reported
as `user_session_id` within those payloads, so both queries returned 404.
The test's unconditional 404 skip then let it pass without asserting
anything, leaving the endpoints effectively uncovered.

Use the call session id, replace the blanket skip with a bounded retry that
still fails on a persistent 404, and assert that the returned participant
session carries this join's SFU session id so the two cannot be conflated
again.

Also drop `resolve_sip_auth` and `resolve_sip_inbound` along with their
models; these endpoints are not supported through the server client. The
eight trunk and routing-rule CRUD methods are unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Removes the SIP trunk and inbound routing-rule surface, its models, and its
integration test, narrowing this change to the advanced call-stats REST
coverage. SIP will ship separately.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`sort_query` comma-joined the encoded entries, which is not valid JSON for
either a single entry or several; the coordinator rejected it with "is not
a valid JSON for field 'sort'". Encode the list directly instead, and pin
the array shape in a test that parses the output rather than comparing it
against the encoder's own formatting.

Also align the stats surface with the conventions around it: time-range
request params take `Timestamp` like their siblings in `models::call`,
`call_stats` paths go through a `stats_path` helper alongside `path`, and
optional query params are pushed by a shared `push_opt`. The live test now
populates `filter_conditions` and `limit` so the encoding is exercised
end to end, and runs its two independent reads concurrently.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Nash0x7E2
Nash0x7E2 merged commit 6df4384 into main Sep 4, 2026
3 checks passed
@Nash0x7E2
Nash0x7E2 deleted the cursor/ai-769-sip-and-advanced-call-stats-17e5 branch September 4, 2026 21:10
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.

2 participants