How do I forward incoming calls over VOIP to another client? Is there any way I can take an incoming call and use an app or a system feature to turn my Android phone into a forwarding client so that I can then forward this via VOIP to any other client in the world?

What I'd like to do is very similar to OS X's continuity feature, but instead of requiring the phone to be on the same Wi-Fi network, I'd like it to be able to be anywhere in the world. Imagine if you could buy a phone, a local SIM card (that could be topped up via the internet), and leave the phone plugged in all the time and connected to Wi-Fi so that it can forward any incoming calls over VOIP to any other VOIP client in the world. What I'm trying to build is a dedicated DID (direct inward dialing) number but using my current local number in whatever country I am.

Is this possible? The closest thing I've seen is Google Voice or Skype's incoming numbers or even regular DID numbers, but they're not offered for all locations, so that's why I'd like to build this solution if possible.
Android phone is technically handicapped to do this. There is no google API to playback an audio stream instead of the mic recording. You would have to rewrite the android's telephony stack to achieve this. And this will be dependent on the hardware and so cannot be a generic solution for all android phones. You cannot find a answering machine android app with recorded voice playback for the same reason.

You can buy a raspberry pi, a USB data dongle with voice calling and supported by chan_dongle project, install RasPBX (based on the open source PBX Asterisk) and redirect GSM calls via VOIP and vice versa. This is pretty easy to setup and cheaper than an android phone.

https://web.archive.org/web/20180306230858/http://blog.carrier-connect.com/raspberry-gsm-gateway/

http://www.raspberry-asterisk.org/documentation/