Ctrl K
ring2all.com

System Cleanup Module Documentation

Table of Contents

  1. Module Overview (Technical)
  2. Module Overview (Commercial/Business)
  3. Module Overview (End User/Administrator)
  4. Configuration Sections
  5. Settings Reference
  6. Common Scenarios & Examples
  7. Limitations & Important Notes
  8. Troubleshooting Tips
  9. Glossary

---

1. Module Overview (Technical)

What Is System Cleanup?

System Cleanup is a maintenance module that automatically removes old system files and data to free up storage space. It supports per-tenant configuration for CDR, recordings, voicemails, SMS, and log events.

Architecture

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              System Cleanup Architecture                       │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Per-Tenant Cleanup Settings                                    │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │                                                          │   │
│  │  Tenant: Acme Corporation                                │   │
│  │  ┌────────────────────────────────────────────────────┐  │   │
│  │  │                                                    │  │   │
│  │  │  Delete Oldest CDR: 90 days                       │  │   │
│  │  │  Delete Oldest Recordings: 30 days                │  │   │
│  │  │  Delete Oldest Voicemails: 60 days                │  │   │
│  │  │  Delete Short Recordings: < 3 seconds             │  │   │
│  │  │  Delete Oldest Log Events: 30 days                │  │   │
│  │  │  Delete Oldest SMS: 90 days                       │  │   │
│  │  │                                                    │  │   │
│  │  │  Schedule: Daily                                   │  │   │
│  │  │  Convert Recordings: Yes (16k quality)            │  │   │
│  │  │                                                    │  │   │
│  │  └────────────────────────────────────────────────────┘  │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼ Scheduled execution                                    │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │        Cleanup Jobs                                      │   │
│  │                                                          │   │
│  │  Daily at 2:00 AM:                                       │   │
│  │  ├─ Delete CDR older than 90 days                       │   │
│  │  ├─ Delete recordings older than 30 days                │   │
│  │  ├─ Delete recordings shorter than 3 seconds            │   │
│  │  ├─ Delete voicemails older than 60 days                │   │
│  │  ├─ Delete log events older than 30 days                │   │
│  │  ├─ Delete SMS older than 90 days                       │   │
│  │  └─ Convert recordings to efficient format              │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│       │                                                         │
│       ▼ Storage freed                                          │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │        Storage Space                                     │   │
│  │                                                          │   │
│  │  Before: █████████████████████ 85% used                 │   │
│  │  After:  ████████              35% used                 │   │
│  │                                                          │   │
│  └──────────────────────────────────────────────────────────┘   │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Key Tables

TablePurpose
public.cleanup_settingsPer-tenant config

Key Files

FileDescription
modules/systemCleanup/Frontend module
---

2. Module Overview (Commercial/Business)

Business Value

System Cleanup provides automated storage management:

Without CleanupWith Cleanup
Storage fills upAuto-managed
Manual deletionScheduled jobs
Compliance riskRetention policies
Server slowdownOptimized storage

Use Cases

  1. Storage Management
- Prevent disk full

- Automated cleanup

  1. Compliance
- Retention policies

- Data lifecycle

  1. Cost Control
- Reduce storage costs

- Optimize space

  1. Performance
- Faster queries

- Less I/O load

Feature Highlights

FeatureBenefit
Per-TenantIndividual policies
Multiple TypesCDR, recordings, etc.
ScheduleDaily/weekly/monthly
Short RecordingsRemove useless files
Audio ConversionSave space
Execute NowManual trigger
---

3. Module Overview (End User/Administrator)

What Can You Do?

  • Configure cleanup per tenant
  • Set retention days for each data type
  • Delete short recordings
  • Schedule automatic cleanup
  • Convert recordings to save space
  • Run cleanup manually
  • Enable/disable cleanup jobs

System Cleanup - Tenant List

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              System Cleanup                                     │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Configure automatic cleanup of old system files and recordings│
│                                                                 │
│  [🔍 Search tenants...]                                         │
│                                                                 │
│  ┌───────────────────────────────────────────────────────────┐  │
│  │ Tenant Name      │ Maintenance State│ Status             │  │
│  ├──────────────────┼──────────────────┼────────────────────┤  │
│  │ Acme Corporation │ ● Enabled        │ Last: Today 2:00   │  │
│  │ Beta Company     │ ● Enabled        │ Last: Today 2:00   │  │
│  │ Test Tenant      │ ○ Disabled       │ Never              │  │
│  │ Main             │ ● Enabled        │ Last: Today 2:00   │  │
│  └───────────────────────────────────────────────────────────┘  │
│                                                                 │
│  Click a tenant to configure cleanup settings                   │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Cleanup Settings

Plaintext
┌─────────────────────────────────────────────────────────────────┐
│              System Cleanup                                     │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  [← List]  Tenant: Acme Corporation                             │
│                                                                 │
│  ▼ Cleanup Settings                                             │
│                                                                 │
│  ┌─────────────────────────────────────────────────────────────┐│
│  │                                                             ││
│  │  Enabled: ✓                                                ││
│  │    Enable or disable the automatic cleanup job              ││
│  │                                                             ││
│  │  Schedule: [Daily ▼]                                       ││
│  │    None | Daily | Weekly | Monthly                          ││
│  │                                                             ││
│  │  ────────────────────────────────────────────────────────── ││
│  │                                                             ││
│  │  Delete Oldest CDR: [90         ] days                     ││
│  │    Delete CDR records older than this many days             ││
│  │    (Leave empty to keep all records)                        ││
│  │                                                             ││
│  │  Delete Oldest Recordings: [30         ] days              ││
│  │    Delete call recordings older than this many days         ││
│  │                                                             ││
│  │  Delete Oldest Voicemails: [60         ] days              ││
│  │    Delete voicemail messages older than this many days      ││
│  │                                                             ││
│  │  Delete Short Recordings: [3          ] seconds            ││
│  │    Delete recordings shorter than this (removes empty files)││
│  │                                                             ││
│  │  Delete Oldest Log Events: [30         ] days              ││
│  │    Delete log events older than this many days              ││
│  │                                                             ││
│  │  Delete Oldest SMS: [90         ] days                     ││
│  │    Delete SMS messages older than this many days            ││
│  │                                                             ││
│  │  ────────────────────────────────────────────────────────── ││
│  │                                                             ││
│  │  Convert Recordings: ✓                                     ││
│  │    Convert recordings to efficient format to save space    ││
│  │                                                             ││
│  │  Audio Quality: [Good (16k) ▼]                             ││
│  │    Good (16k) | High (32k) | Lossless (WAV)                ││
│  │                                                             ││
│  └─────────────────────────────────────────────────────────────┘│
│                                                                 │
│  [Save] [Execute Now]                                           │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Quick Tips

TIP
Leave Empty: Leave days empty to keep all records.
TIP
Short Recordings: Set to 3 seconds to remove empty recordings.
WARNING
Permanent Deletion: Deleted data cannot be recovered!

---

4. Configuration Sections

Data Type Settings

FieldDescription
Delete Oldest CDRCDR retention (days)
Delete Oldest RecordingsRecording retention
Delete Oldest VoicemailsVoicemail retention
Delete Short RecordingsMin duration (seconds)
Delete Oldest Log EventsLog retention
Delete Oldest SMSSMS retention

Schedule Settings

FieldDescription
EnabledJob on/off
ScheduleRun frequency

Audio Settings

FieldDescription
Convert RecordingsEnable conversion
Audio QualityConversion quality
---

5. Settings Reference

Schedule Options

OptionDescription
NoneManual only
DailyRun every day
WeeklyRun every week
MonthlyRun every month

Audio Quality Options

QualityBitrateUse Case
Good (16k)16 kbpsMaximum space saving
High (32k)32 kbpsBalance quality/size
Lossless (WAV)OriginalKeep quality

Retention Guidelines

Data TypeMinimumTypicalCompliance
CDR30 days90 days1-7 years
Recordings30 days90 daysPer policy
Voicemails30 days60 days30-90 days
Log Events7 days30 daysPer policy
SMS30 days90 daysPer policy

Storage Impact

Data TypeSize ImpactCleanup Benefit
RecordingsLargestHighest savings
CDRMediumFaster queries
VoicemailsMediumGood savings
LogsSmallImproved performance
SMSSmallMinor savings
---

6. Common Scenarios & Examples

Scenario 1: Standard Cleanup Policy

  1. Select tenant
  2. Enable = ✓
  3. Schedule = Daily
  4. CDR = 90 days
  5. Recordings = 30 days
  6. Voicemails = 60 days
  7. Short recordings = 3 seconds
  8. Save

Scenario 2: Compliance (Keep Long)

  1. CDR = 365 days (1 year)
  2. Recordings = 365 days
  3. Voicemails = 90 days
  4. Short recordings = 0 (keep all)
  5. Schedule = Weekly
  6. Save

Scenario 3: Space Emergency

  1. CDR = 30 days (minimum)
  2. Recordings = 7 days (aggressive)
  3. Voicemails = 30 days
  4. Short recordings = 5 seconds
  5. Convert Recordings = ✓
  6. Audio Quality = Good (16k)
  7. Save
  8. Execute Now

Scenario 4: Convert Without Deleting

  1. CDR = (leave empty)
  2. Recordings = (leave empty)
  3. Convert Recordings = ✓
  4. Audio Quality = High (32k)
  5. Save
  6. Only converts, no deletions

---

7. Limitations & Important Notes

Technical Notes

NOTE
Per-Tenant: Each tenant has separate settings.
NOTE
Schedule Time: Usually runs at 2:00 AM.
CAUTION
Irreversible: Deleted data cannot be recovered!

Best Practices

  1. Backup First: Ensure backups before aggressive cleanup
  2. Start Conservative: Begin with longer retention
  3. Monitor Storage: Watch disk usage trends
  4. Test Execute: Run Execute Now to verify
  5. Compliance Check: Verify retention requirements

Data Types Explained

Data TypeWhat It Is
CDRCall Detail Records (metadata)
RecordingsAudio files of calls
VoicemailsUser voicemail messages
Log EventsSystem and audit logs
SMSText messages (if enabled)
---

8. Troubleshooting Tips

Common Issues

SymptomPossible CauseSolution
Disk still fullShort retentionReduce days
Job not runningDisabledEnable cleanup
Wrong files deletedWrong settingsCheck config
Slow cleanupMany filesWait or schedule

Check Storage

Bash
# Check disk usage
df -h

# Check recordings folder
du -sh /var/lib/freeswitch/recordings/

# Check voicemails
du -sh /var/lib/freeswitch/voicemail/

# List large files
find /var/lib/freeswitch -size +100M -type f

Check Cleanup Status

Bash
# View cleanup log
tail -f /var/log/ring2all/cleanup.log

# Check cron schedule
crontab -l | grep cleanup

---

9. Glossary

TermDefinition
CDRCall Detail Records
RetentionHow long to keep data
CleanupAutomatic deletion
ConversionChange audio format
Execute NowManual cleanup run
---

Lua Script Status ℹ️

Maintenance Module

ComponentStatus
System Cleanupℹ️ Data maintenance - no Lua handler required
System Cleanup is a maintenance configuration module. It manages automatic data cleanup and retention. No Lua handlers are used - cleanup jobs are executed by the backend scheduler.

---

Documentation last updated: January 2026
AI Assistant

👋 Hello! I'm your Ring2All documentation assistant. I can help you find information about configuring and using the Ring2All PBX platform.

How can I help you today?