Asterisk Backup Method

Here at work, we’ve been setting up an Asterisk system to run our phones. Its a pretty slick setup, with the server sitting in our rack at Handy Networks’ data center in the big Qwest building in downtown Denver.

Since the system is mission critical, a good backup solution is important. Our current solution, which I’m sure we will revise, is as follows.

We use FreePBX’s backup module to perform daily backups of important data (voicemail, call recordings, etc) at 3:05AM.

At 3:30 AM, a cron job runs and the backup files are copied over to our windows file server. The files will then be ready for saving offline.

Here’s the backup script:

First, it deletes all files older than 7 days.

It then mounts the backup share. An appropriate entry is in /etc/fstab to allow the asterisk user to mount the share.

Then, using rsync, copy the files onto our windows server.

Next, we take the md5sum of each of the files and places the output on the backup server. This helps to ensure our backup’s integrity.

Finally, unmount the backup share.

Restoration would be simple. Install FreePBX + Asterisk onto a server. Copy the backup files into the backup location, and then use FreePBX’s backup and restore module to restore the backups.

Make sure you do proper testing before implementing this into a production system.