Connect asterisk to piper (get wav/mp3 trough external linux server)

I currently use the google tts system for asterisk text to speech generation. But now Home assistant comes along i want to migrate to piper. One more system that will work offline,

But how can i get my asterisk server connect to piper to turn text into speech?