CDR Processing¶
Overview¶
Call Detail Record (CDR) processing is a critical component of the offline charging system. This document describes the CDR processing pipeline and best practices for handling charging data records.
CDR Types¶
Voice CDRs¶
- Mobile Originated Calls (MOC)
- Mobile Terminated Calls (MTC)
- Roaming Calls
- Supplementary Services
Data CDRs¶
- GPRS/Data Usage
- Packet Data Protocol (PDP) Context
- Serving Gateway Records
- PDN Gateway Records
Messaging CDRs¶
- SMS Records
- MMS Records
- Messaging Gateway Records
Processing Pipeline¶
interface CDRProcessingStage {
id: string;
name: string;
status: 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED';
startTime: string;
endTime?: string;
error?: string;
metadata: Record<string, unknown>;
}
interface CDRBatch {
id: string;
source: string;
recordCount: number;
fileSize: number;
checksum: string;
stages: CDRProcessingStage[];
createdAt: string;
completedAt?: string;
}
Stages¶
- Collection
- Receive raw CDR files
- Validate file integrity
-
Store in staging area
-
Validation
- Schema validation
- Mandatory field checks
- Data type verification
-
Duplicate detection
-
Enrichment
- Add subscriber information
- Resolve reference data
- Apply business rules
-
Calculate derived fields
-
Aggregation
- Group related records
- Calculate summaries
- Apply rating rules
-
Generate invoicing data
-
Storage
- Archive raw CDRs
- Store processed records
- Update billing database
- Generate reports
Error Handling¶
enum CDRError {
INVALID_FORMAT = 'INVALID_FORMAT',
MISSING_FIELDS = 'MISSING_FIELDS',
DUPLICATE_RECORD = 'DUPLICATE_RECORD',
PROCESSING_ERROR = 'PROCESSING_ERROR',
STORAGE_ERROR = 'STORAGE_ERROR'
}
interface CDRErrorReport {
batchId: string;
recordId?: string;
error: CDRError;
message: string;
timestamp: string;
retryCount: number;
rawData?: string;
}
Implementation¶
File Processing¶
interface CDRFile {
id: string;
filename: string;
format: 'ASN1' | 'CSV' | 'XML' | 'JSON';
size: number;
recordCount: number;
checksum: string;
status: 'NEW' | 'PROCESSING' | 'COMPLETED' | 'FAILED';
createdAt: string;
processedAt?: string;
}
interface CDRProcessor {
validateFile(file: CDRFile): Promise<boolean>;
processRecords(file: CDRFile): Promise<CDRBatch>;
handleErrors(errors: CDRErrorReport[]): Promise<void>;
generateReports(batch: CDRBatch): Promise<void>;
}
Performance Optimization¶
- Batch Processing
- Optimal batch sizes
- Parallel processing
-
Resource management
-
Caching
- Reference data caching
- Rate plan caching
-
Subscriber info caching
-
Storage
- Efficient indexing
- Partitioning strategy
- Archive management
Monitoring¶
Key metrics to track: - Processing throughput - Error rates - Processing latency - Resource utilization - Queue lengths
Best Practices¶
- Data Integrity
- Implement checksums
- Validate record counts
-
Maintain audit trails
-
Error Recovery
- Implement retry logic
- Store failed records
-
Alert on failures
-
Performance
- Monitor system load
- Optimize queries
- Scale horizontally
References¶
- 3GPP TS 32.297: Charging Data Record (CDR) file format and transfer
- 3GPP TS 32.298: Charging Data Record (CDR) parameter description
- 3GPP TS 32.240: Charging architecture and principles