Call Recordings DB Error

Hello FreePBX Community! I appreciate all the hard work you guys have put in to making this software what it is today.

Lately I have been receiving “DB Error: unknown error” when attempting to view my recorded calls. In all honesty I am convinced this is because I have moved some of the recorded calls to a different machine for backup purposes; these things pile up pretty fast and can take up a lot of space.

In order to rectify this issue, I think I might need to ‘reset’ the call recordings database. Anyone know how I might go about accomplishing this?

Thanks in advance,

The database and table that stores the monitored calls are asteriskcdrdb and cdr respectively. You can connect to the mySQL server on your asterisk box by typing:

mysql -h localhost -u asteriskuser -p

This will prompt you for the asteriskuser password. If you do not know the password, it typically can be found in the following locations:


Once you are connected to the server, it is wise to backup the table before attempting a repair. Type the following at the prompt:

mysql> USE asteriskcdrdb;
mysql> BACKUP TABLE cdr TO ‘/some/directory/of/your/choice’;

*** NOTICE: You have to be logged in with a user that has FILE privileges to use the backup command, typically root. If you don’t have root access, just try a simple SELECT statement instead.***

You may get an error that says Can’t open file: ‘cdr.MYI’ (errno: 145). In this case, your table is too corrupted to read data from, so just try to repair it.

mysql> REPAIR TABLE cdr;

If all is well, you will see something like this:

| Table | Op | Msg_type | Msg_text |
| asteriskcdrdb.cdr | repair | status | OK |
1 row in set (0.65 sec)

Good luck!