Skip to content

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

  1. Collection
  2. Receive raw CDR files
  3. Validate file integrity
  4. Store in staging area

  5. Validation

  6. Schema validation
  7. Mandatory field checks
  8. Data type verification
  9. Duplicate detection

  10. Enrichment

  11. Add subscriber information
  12. Resolve reference data
  13. Apply business rules
  14. Calculate derived fields

  15. Aggregation

  16. Group related records
  17. Calculate summaries
  18. Apply rating rules
  19. Generate invoicing data

  20. Storage

  21. Archive raw CDRs
  22. Store processed records
  23. Update billing database
  24. 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

  1. Batch Processing
  2. Optimal batch sizes
  3. Parallel processing
  4. Resource management

  5. Caching

  6. Reference data caching
  7. Rate plan caching
  8. Subscriber info caching

  9. Storage

  10. Efficient indexing
  11. Partitioning strategy
  12. Archive management

Monitoring

Key metrics to track: - Processing throughput - Error rates - Processing latency - Resource utilization - Queue lengths

Best Practices

  1. Data Integrity
  2. Implement checksums
  3. Validate record counts
  4. Maintain audit trails

  5. Error Recovery

  6. Implement retry logic
  7. Store failed records
  8. Alert on failures

  9. Performance

  10. Monitor system load
  11. Optimize queries
  12. Scale horizontally

References

  1. 3GPP TS 32.297: Charging Data Record (CDR) file format and transfer
  2. 3GPP TS 32.298: Charging Data Record (CDR) parameter description
  3. 3GPP TS 32.240: Charging architecture and principles