Unbillable traffic is lost revenue. Audit failures are compliance risk. SIPswarm generates rated CDRs in the same Rust process that handles the SIP transaction — then proves their integrity with cryptographic hash chains, cross-node Merkle verification, and at-least-once delivery.
A CDR is born at session start and accumulates data through every phase of the transaction. No data is written after the fact. No log scraping. No reconstruction.
Every CDR captures the complete story of a transaction — identity, timing, pricing in all directions, quality metrics per traffic type, routing decisions, and a cryptographic audit trail.
Who, what, and the bilateral proof
Microsecond-precise session boundaries
How and why the session ended
Both sides of every transaction
Revenue in all three directions
Per-traffic-type quality envelope
The complete routing decision path
SHA-256 chain + migration evidence
Originating leg capture
Terminating leg capture
Every CDR and bid log entry carries a SHA-256 hash of its predecessor. This is not blockchain. There is no consensus, no mining, no distributed ledger. It is a single-writer-per-node append chain — the simplest possible tamper-evident structure.
Periodically, each node computes a Merkle tree over its chain and exchanges roots with peers via admin SIP PUBLISH. Any discrepancy between nodes triggers an immediate audit alert.
The MQAL (Message Queue Abstraction Layer) provides pluggable streaming for CDRs, bid logs, and rate sync. Backend selectable per stream: LocalBackend for dev, NATS JetStream for production.
The CdrFileWriter maintains two open file handles per type (CDR and attempt): current and next. Records hit local disk within the harvest cycle. When a file reaches its threshold, rotation swaps next to current in under 1 millisecond — the pre-created file is already open and ready.
If local writes fail 3 consecutive times, the CDR Restriction triggers: the node drains all active sessions to prevent unbillable traffic. This is a financial safety mechanism — a node that cannot record transactions must not accept new ones.
The Receipt GUID is a bilateral proof of the negotiated rate. The terminating carrier proposes it in the 200 OK. The originator confirms it by echoing in the ACK. From that point, both parties hold the same GUID — immutable evidence of the agreed price.
Terminator generates GUID on acceptance. Not yet binding. Either party can still withdraw.
Originator echoes in ACK. Agreement is now binding. Negotiated rate cached for future reference.
Both parties hold the same GUID. Matches the CDR audit trail. Settlement evidence built into the protocol.
Every CDR passes through multiple independent integrity mechanisms before it leaves the node. No single point of failure in the data path.
CDRs created in the same Rust process that handles SIP. No sidecar. No log scraper. No separate system that might miss a record.
Append-only data structures. Once a CDR or bid log entry is written, it is never modified. Rust ownership model enforces this at compile time.
SHA-256 prev_hash on every record. Alter one entry and the entire chain breaks. Detectable in microseconds.
Periodic Merkle trees per node. Roots exchanged via admin SIP PUBLISH. Mismatch triggers immediate audit.
MQAL re-stores CDRs on publish failure. Records loop back to CdrStore for the next drain cycle. Zero loss.
3 consecutive local write failures triggers node drain. Node will not accept traffic it cannot record. Financial safety net.
Receipt GUID bilateral proof. BidLogEntry immutable per round. Rated CDR with customer + provider + spread. SOC 2 ready.
Local filesystem always. Plus S3, Azure Blob, GCS, SFTP. Retry buffer with exponential backoff. Every record arrives.
SIPswarm generates, secures, and delivers rated CDRs with cryptographic proof. No billing system does this.