SIP: two networks as one logical network?

I’ve been learning SIP for a while now but I can’t think of a way to accomplish a scenario which I have in my mind.

Lets assume I have a number of SIP clients and a SIP server at home, in a private network (behind a NAT/firewall, inaccessible from the public Internet). Then there’s a SIP server in the public Internet which I also have access to. Now assume I also have a mobile device with a SIP client. I’m interested in the ability to make and receive phone calls between all SIP clients in this one logical network, regardless of the mobile SIP client being connected to the private network or to the public Internet (the system should adapt to changes in the environment). Additionally, I need to make sure that the SIP server in the private network could work on its own, when the connection to the public Internet is not available. That is, the connection to the public Internet is an optional extension in this setup, which possibly enables mobile SIP clients to be connected to the private network.

I don’t really know if that’s possible with SIP protocol and its extensions. I’m curious how these two SIP servers would be connected (in what “mode”?) so that it could work.

Does Asterisk support such a scenario?

Any hints would be appreciated.