Want To Stream The Audio Through RTP on External Media

Hi Team, I am Creating the External Media Channel, where i have
use the configuration

return await channel.externalMedia({
channelId : uniqueIdGeneratorV4(),
external_host : ${rtpDetails.rtpIp}:${rtpDetails.rtpPort},
format : “slin16”,
transport : “udp”,
encapsulation : “rtp”,
connection_type: “client”,
direction : “both”
});

now i want to steam the audio back to the asterisk
I got the packets from the asterisk but no audio is heard the same i

Got  RTP packet from    192.168.24.202:42655 (type 11, seq 009244, ts 2958080, len 000640)
Sent RTP packet to      192.168.24.16:34274 (type 00, seq 008291, ts 1759680, len 000320)
Got  RTP packet from    192.168.24.202:42655 (type 11, seq 009245, ts 2958400, len 000640)
Got  RTP packet from    192.168.24.202:42655 (type 11, seq 009246, ts 2958720, len 000640)
Sent RTP packet to      192.168.24.16:34274 (type 00, seq 008292, ts 1760000, len 000320)
Sent RTP packet to      192.168
19 audio g729         g729             (G.729A)
       9 audio slin         slin             (16 bit Signed Linear PCM)
      10 audio slin         slin12           (16 bit Signed Linear PCM (12kHz))
      11 audio slin         slin16           (16 bit Signed Linear PCM (16kHz))
      12 audio slin         slin24           (16 bit Signed Linear PCM (24kHz))
      13 audio slin         slin32           (16 bit Signed Linear PCM (32kHz))
      14 audio slin         slin44           (16 bit Signed Linear PCM (44kHz))
      15 audio slin         slin48           (16 bit Signed Linear PCM (48kHz))
      16 audio slin         slin96           (16 bit Signed Linear PCM (96kHz))
      17 audio slin         slin192          (16 bit Signed Linear PCM (192kHz))
       3 audio ulaw         ulaw             (G.711 u-law)

these are the codec my asterisk support
so is there any format i am missing in order to play the audio please help

also i am sending the packets in every 20 ms

There have been so very many other posts about this with comments and debugging steps. I’d suggest searching and reading them.

I tried to search over the topics , it will be really helpful if you can share the direct link for that @jcolp

If you’re expecting a step by step here’s how to fix it, though, you’re probably out of luck. You do need to do investigation and understand what is going on.

Thanks @jcolp it helps a lot

But @jcolp , i event tried to send back the same rtp packet which i am receving to the external media then also it is not playable this is the simple code can you guide me if i am doing something wrong?

   this.server.on("message", (message, rInfo) => {
            this.server.send(message, 0, message.length, rInfo.port, rInfo.address, (err) => {
                if (err) {
                    console.error("❌ Error forwarding RTP:", err.message);
                } else {
                    console.log(`✅ Forwarded RTP to Asterisk at `,rInfo);
                }
            });
        });

Would it be easier to use an AudioSocket to send and receive audio? That’s just a simple TCP connection.

I can be currenly my current architeture on rtp server only

@jcolp In a previous thread you wrote this:

Dynamic payloads, such as those used by opus, are not currently supported. Only statically defined payloads (such as ulaw, alaw, g722) are supported.

Is this still the case? I’m currently debugging a ARI ExternalMedia system where alaw, ulaw and g722 works flawlessly bidirectionally, but slin16/slin24 and opus (which both uses dynamic RTP types) does not. I assumed that they would work the same as the static codec types as the documentation states:

format: Any standard format/codec supported by Asterisk is supported here

I have like gauravs456 verified that the packets arrive correctly both via wireshark and the rasterisk CLI, and get no hints of anything being wrong except that the returning audio does not work with the dynamic codec types I have tried (everything works with alaw/ulaw/g722).

The documentation should maybe be updated with which codecs works if this is the case to save some more people the headache of debugging this.

Dynamic codec types remain unsupported. If you want to update the documentation you can submit a PR in the documentation repo, or file an issue.

Thanks for the quick answer!

edit: I have created a issue in the asterisk documentation repo: Add information about which codecs are supported for two-directional audio with ExternalMedia · Issue #142 · asterisk/documentation · GitHub

Thank you so much @alge , for your support so i assume that till today date slin16, opus will not work in bidirectional streaming , for further , as @jcolp mentioned for Raise the PR for that , we believe the we will soon be having the feature of using slin16 and other in streaming with a proper documentation ,"
one more information i am using asterisk 16.3 CERT , Version , but still i believe that this is not related to version ,
@jcolp please correct me if i am wrong it will work on this version as well in future right?

And thanks to you guys i have been try to debug this issue for last 5 days continuously, now i can sleep peacefully
And thanks once again @jcolp , and @alge and all other community members

If any changes were made, they would not be in Asterisk 16 be it normal or certified. It hasn’t been supported in years.

I also did not say that I would be raising a PR to add support.

okay noted that thanks