Hmm… Maybe I’m supposed to use the new external media functionality for this? Should I write the incoming data packets to a UDP socket and then connect to that socket from an externalMedia channel?
The docs say RTP is the only encapsulation supported by externalMedia right now, and I’m not quite sure how to encapsulate the audio data as RTP in my node app. I’m receiving it from my TTS server in Ogg/Opus.
If I have to use RTP for external media, it might make more sense to enable my TTS server (in C++) to write RTP directly and give the externalMedia channel the address:port of my TTS server. However, I’m not very familiar with RTP. I’m using George Joseph’s asterisk_external_media example to help me figure all this out, but that example reads RTP from the externalMedia channel, and I need to write it. According to George’s source, reading RTP seems to be as simple as stripping off the 12 byte RTP header. I assume writing it should be as simple as adding some sort of 12 byte header to each block of audio.
However, I’m looking at RFC3550 for RTP and it says I need an even numbered port for RTP and an odd numbered port one higher for RTCP. But I don’t see anything about RTCP in George’s example code, so maybe that isn’t necessary?
Anyway, do I need to use external media for this situation? And, if so, could I please get a few hints about encapsulating my audio as RTP?