Live audio data transmission

I want to transmit audio packets in real-time to a socket on a different system when a call comes in. Then, I want to play the audio received from the opposite socket to the caller. Is this possible on Asterisk? Can you provide hints on which APIs to use and how?

https://docs.asterisk.org/Development/Reference-Information/Asterisk-Framework-and-API-Examples/External-Media-and-ARI/

I think you missed part of the requirement, as this description includes normal SIP to SIP and SIP to H.323 calls. It actually also includes SIP to IAX2.