1. Bicom Systems
  2. Solution home
  3. Quick problem solving documents
  4. Quick problem solving documents



What is CDR archiving and why is it necessary?

For partners and systems that have been in use for an extended period, processing large volumes of calls can lead to a bloated Call Detail Record (CDR) table, consuming significant disk space.

In some cases, CDR tables can grow to sizes exceeding 100 GBs. This can pose challenges during upgrade processes, particularly if a new version of PBXware introduces additional columns to the CDR data. Altering the CDR table in MySQL to accommodate these changes can take hours, especially when dealing with large tables.

To address this issue, we have developed a script designed to archive older CDRs, reducing disk usage. The duration for retaining CDRs varies from partner to partner. A good practice is to align CDR retention periods with those of call recordings. This ensures that CDRs required for downloading recordings via the GUI remain accessible. While recordings can be downloaded manually, locating them without precise timestamps can be challenging.


To utilize the script for archiving your CDR table and optimizing disk usage, follow these steps:

1. Accessing the Script:

If using a VPS, log in via the host and initiate a tmux session.

For PBXware not hosted within SERVERware, SSH directly into the system.

2. Downloading the Script:

Start a tmux session: tmux

Download the script: wget downloads.bicomsystems.com/backup-cdr/backup-cdr.tar.gz

Extract the files: tar -xzvf backup-cdr.tar.gz

3. Executing the Script:

Navigate to the script folder.

Run the appropriate script based on your PBXware version:

For PBXware 4.x: ./backup-cdr-4x.sh <duration>

For PBXware 5.x: ./backup-cdr-5x.sh <duration>

Replace <duration> with a positive number followed by "day", "year", or "month". For example, ./backup-cdr-5x.sh 6 month archives CDRs older than 6 months.

Please note that the version 5 script is usable on both version 6 and 7.

4. Archived Files Location:

Archived files are stored in /opt/pbxware/pw/var/log/cdr_dump/

Reconnecting to a Disconnected Session:

If your connection is interrupted, you can easily reattach to the tmux session:

List existing sessions: tmux ls

Reattach to the session: tmux attach -t SESSION_ID

Replace SESSION_ID with "0" if no other sessions were started previously.

Please note that you'll need approximately twice the size of your CDR table initially to complete the process successfully.

To check the size of your CDR table, use the command: 

ls -lah /opt/pbxware/pw/var/lib/mysql/pbxware/cdr*