I have a SIP account at a provider, which supports only UDP as transport protocol.
I read that for mobile client apps, like CSipSimple and the others, UDP transport requires a very frequent keep-alive packet sending, and that affects battery usage heavily.
Apparently, TCP protocol would be much better in this case, because keep-alive frequency is lower.
I was wondering... can I setup a SIP proxy on a server and make it connect to my provider and also offer a TCP connection to the clients? Some kind of "man in the middle" server. How can I do that?
(Maybe I misunderstood the "proxy" term of "SIP proxy"?)
You can put SIP proxy(Kamailio for example) in the middle, or even PBX(Asterisk, Freeswitch for example).
Probably easiest way for you will be to use Asterisk in between, it is very easy to configure. Nevertheless switching to TCP might not help you. It depends on mobile which you plan to use - Android or iPhone. For iPhone TCP works pretty well, but in latest Android version 6.0 is new doze mode which will kill all connections, including even TCP, so for Android you will need to add push functionality which will wake-up CSipSimple on Android. On iPhone push is not necessary, but probably it is recommended too.