feat(cdr): capture caller/callee SIP peer addresses on call records - #276
Open
ftong2010 wants to merge 1 commit into
Open
feat(cdr): capture caller/callee SIP peer addresses on call records#276ftong2010 wants to merge 1 commit into
ftong2010 wants to merge 1 commit into
Conversation
- callerPeer: transport source of the inbound INVITE (connection remote addr, top-Via fallback), riding the transaction cookie (CallerPeerContext) so early-failure CDRs — reported before any SipSession exists — keep it - calleePeer: outbound INVITE destination stashed into CallMeta at dial time (cleanup() clears the leg dialogs before CDR reporting; last dial wins; URI-routed legs fall back to the request-URI host — exact for IP-literal trunk hosts) - surfaced onto CallDetails by the reporter via cookie extension + CallSessionRecordSnapshot, serialized as callerPeer/calleePeer, so consumers (Grafana plugin top-N, IP filtering) need no join against the signaling table - signaling-plane addresses only: never the ICE/STUN-selected media path — IP-granular grouping is valid, ports are not media ports - also init trace_id (field from 1c127eed) in the common_selftest CDR fixture, which that commit missed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two signaling-plane fields to call records (CDRs), serialized as
callerPeerandcalleePeer:ip:port: the transport source of the inbound INVITE (connection remote address, top-Via fallback when the connection is unavailable).ip:port: where the outbound INVITE was sent (dial-target destination; URI-routed legs fall back to the request-URI host — exact for IP-literal trunk hosts). Not populated for PBX-originated (RWI) calls that have no inbound-leg pairing at report time.Why
Consumers (dashboards, top-N source analysis, IP filtering) currently need a join against the signaling capture table to answer "which IP did this call come from / go to". With the peers on the record itself, CDR queries are self-contained.
How
handle_inviteand rides the transaction cookie (CallerPeerContextextension), so early-failure CDRs — reported before any SipSession exists — keep it.CallMetaat dial time, becausecleanup()clears the leg dialogs before CDR reporting; last dial wins on re-dials.CallDetailsvia the cookie extension +CallSessionRecordSnapshot; the SQL model is unchanged (peers live in the JSON saver payloads only).Semantics
These are signaling addresses (INVITE transport source/destination), never media endpoints: for WebRTC callers the value is the WebSocket connection's public NAT address, which deliberately does not reflect ICE/STUN-selected media candidates. IP-granular grouping is valid; ports are not media ports.
Testing
cargo test --lib cdr_capture— 3/3 passcargo test --test common_selftest cdr_capture— 3/3 passcargo checkclean on default features