Need help with backup/restore from primary site to secondary site with different SIP trunks and NAT IPs

I currently have two FreePBX distro servers (1.814.210.58-2) running at two locations. Each location has a unique set of SIP trunks and the NAT IP is different at each location. I think those are the only two issues that I need to overcome outside of the backup and restore module via SSH method.

I’m not sure how to exlcude or update the trunks because they are stored with the extensions and I always want the extensions to be restored.

For the SIP setting I was going to do a MySQL script in the post hook to update it but from what I read that won’t work.

Does anyone know how I can work around these two issues and if there are other issues I might run into?

Maybe “bulk extensions” module is enough for you?

Ideally both systems would be identical with the exception of the trunks and SIP settings. I would need queue, ring groups, etc to be the same.

Wouldn’t your outbound route table be different also?

What I am thinking is you could run a post installation script that restores just the trunks and routes from a DB export file.

I think the outbound routes will be the same, at least in the sense of naming convention. I did a backup/restore manually and the trunks are named the same on both systems which is how I think the outbound routes associates them?

If that is the case the only 3 things that need to change are the two trunk IPs and the SIP setting NAT IP.

I think so but you better do a ‘select * from incoming;’ from mysql just to be sure.

Thanks Scott, can you let me know what I should be looking for in that table please?

I just did some testing and it looks like if I update the sipsetting table with the correct IP then the sip table with the correct trunk IPs then reload asterisk it updates the files and the DB remains correct.

The next thing I need to do is figure out how to script this as part of the backup.

why don’t you configure all the trunks on both machines but disable the trunks that should not be used.
the restore is then simple. restore, change the ip address and enable the appropriate trunks.

or am i missing something here?

I would like the entire process to automated on a daily basis. The goal is that the secondary server is a passive failover unit.

that you need to do this daily? the log files and voice mail files are the only things that change on an ongoing basis. i understand the desire to do this in an automated fashion but once the back up system is up and running, you do not need to update it unless/until you make changes to the production system. in my humble opinion i would set up the backup routine on the production server to backup the cdrs and voicemail to the failover server nightly and to restore those files to the failover server nightly. i would then mandate that when changes are made to the system (extensions, etc.) that a full back up be done and restored to the back up server. just one man’s opinion