Cheapo suggestion, get two $5 droplets and a floating IP from DO. Move your DNS nameservers to DO
Set up an A record for your pbx pointing at your floating IP and SRV records for sip using udp and tcp and the port of your choice for both Adrop and Bdrop
Install doctl, set up an api key. and initialize doctl with it
cd /usr/local/bin;curl -sL https://github.com/digitalocean/doctl/releases/download/v1.46.0/doctl-1.46.0-linux-amd64.tar.gz | tar -xzv
cd ~
#have your API key handy and paste it
doctl auth init
(
extra credit section :-
You can add ‘completions’ to your .shellrc file for most folks that will be ~/.bashrc and/or ~/.bash_profile
source <(doctl completion bash)
or if you use zsh (good idea IMHO) ~/.zshrc
source <(doctl completion zsh )
)
Get your droplet ids and flloating ip and remember them
doctl compute droplet list
doctl compute floating-ip list
Assign that floating ip to one of the droplets and Install your FreePBX of choice and set it up as you care.
Make sure everything is working.
snapshot the machine and use that snapshot to create the second droplet. Apart from the MachineID and the IP address they will be identical
when all done then test it with
doctl compute floating-ip-action assign fl.oat.ing.ip 1000001
# you are using droplet 1000001
doctl compute floating-ip-action assign fl.oat.ing.ip 1000002
# what do you know, using the other one.
Now you need to define what a ‘failure is’ Easily if you can no longer ping the floater , but what if it responds but has gone rogue , maybe asterisk isn’t running but maybe it has been penetrated and is making thousands of call from Reykjavik to Palestine, this needs further discussion, no matter how you do high/medium/lowish-Availibility
You also need to keep the machine without the floating address attached synced to the one that is active ,
rsync -a othermachine:/var/spool/asterisk /var/spool/asterisk
will do that.
We can add backup and restore on an as needed basis , daily might work but with the new notepad mysql feature I would build a mysql trigger to watch an injected ‘note’ set by the switch script.
We are left with the “State” of the machine, which is in the sqlite3 astdb table. This is a little tricky as Asterisk is written thread safe but not multiuser safe in its database. so ideally you could wrap that up in a "rasterisk -x ‘database query …’ " export and corollary import, but given that complexity and the likelihood of a ‘switch’ I personally just apologise for a missed CF or DND and blame cloudflare
Whoops I was going to paste a few lines, but it “Topsy’d” In 2013 I was running 3 Proxmox boxes with zfs over glusterfs and dozens of FreePBI that would flawlessy move between any machine on command or on corosync detected failure. Pros) it worked, Cons) it was expensive in maintainance time, power and hardware (and everything went to hell at 00:00 until cronjobs are fixed, but that is another story). So by 2014 I had moved to this kinda solution, Pros) its cheap, switching takes a second or two and IP authed trunks and domain authed extensions wo’t ever know, moreover total disaster recovery is never more than 20 minutes away. Cons) Everything in one DO datacenter.
So to harden all that always have SRV pointing to something that works, try and fing VSP’s who will honor your SRV records for IP auth, Add BGP routing if possible.
(Another JM2CWAE)