FreePBX restore kit for https://srvscripts.com/guides/restore-a-freepbx-backup/

state.sh                         configuration fingerprint (read-only, prints no passwords). Read it first, then:
                                   old server, before the backup:   bash ./state.sh > before.txt
                                   copy before.txt to the new server (scp)
                                   new server, after the restore:   bash ./state.sh > after.txt && diff before.txt after.txt
lab-1-before-backup.txt          our lab before the backup (16 Oct 2026)
lab-2-blank-server.txt           the reinstalled server with a fresh FreePBX 17, before the restore
lab-3-after-restore.txt          right after fwconsole backup --restore and fwconsole reload
lab-4-after-custom-files.txt     after copying the two non-empty _custom.conf files back
lab-diff-before-vs-restore.txt   what the restore did not bring back
lab-diff-before-vs-final.txt     what was still different at the end

Reading the lab outputs: d41d8cd98f00 is the checksum of an empty input, so a custom file showing it is missing or
empty. The last line of "pjsip registrations" ends in a timer value ("192s)" or "ago)") that changes on every run;
that difference means nothing. All names, numbers and addresses are from our lab (synthetic).

Tested environment (one lab server, 16-17 October 2026)
  Debian 12, FreePBX 17.0.33.2, Asterisk 22.11.0, 77 modules, Backup module 17.0.13, 4 vCPU / 4 GB RAM.
  Backup restored onto the same VPS reinstalled with a blank Debian 12 and the official FreePBX 17 installer
  (open-source modules only), same versions, same IP address. Trunk and phones were SIPp processes on the same server.

What came back: extensions, devices, the trunk row, 3 outbound routes, the inbound DID route, extension settings,
  the admin user and all 998 CDR rows.
What did not: every _custom.conf file (the backup contained none; our trunk's PJSIP objects and the fail2ban log
  channel lived in two of them) and the 100 test call recordings. Copy both separately.

Failure checks before you trust a restore
  1. Backup log:   grep -E "returned no data|provided cwd" backup.log   -> nothing for core, cdr or cel
                   (running fwconsole backup from a folder under /root skipped them and still exited 0)
  2. Archive:      tar -tzf FILE.tar.gz | grep -E "modulejson/Core.json|Devices.sql|cdr.sql"
  3. Restore:      exit code 0 AND the end of the log read; ours exited 0 with "There were errors during the
                   restore process" (voicemail module, no visible effect on a system without mailboxes)
  4. Fingerprint:  diff before.txt after.txt shows only what you expect to copy by hand
  5. Calls:        phones and trunk Avail/Registered, then one outbound and one inbound call

Not tested (treat these as checklists, not tested procedures): a new server with a different public IP, a different
FreePBX version or OS, commercial modules, voicemail and recording restores, audio from real phones across NAT.

Licence: free to copy and reuse. Use at your own risk and read state.sh before you run it.
