Basic example using a DPDT relay which is mains powered. When mains drops out the relay switches the modem to battery power. The relay's coil is connected to mains power. I just show a wall wart and omitted any battery charging.
After some trial and error (turns out that black smoke is a big no no XD), I figured out how the relay worked. The store was out of DPDT so I got one with 14 pins including 4 commons (twice the pins I needed), but I got it working.
I used a 12v relay instead of a 220v one and connected it to an old adapter I had laying around (I'm kind of paranoid about playing with 220v).
I appreciate your help guys! Fingers crossed the house won't burn down tonight