No RTP packets received in External Media channel while using ARI and Docker

Hi!

My application creates an External Media channel with these parameters:

  • format: ulaw
  • encapsulation: rtp
  • transport: udp
  • connection_type: client
  • direction: both

The UDP port (1000) is open and listening on my machine (verified with netstat). Asterisk is running in a Docker container, and the logs show it’s trying to send RTP to the correct IP (172.19.80.1:1000 - my development machine’s IP).

However, my UdpClient.ReceiveAsync() never receives any packets. It just hangs waiting for data.

Environment:

  • Asterisk running in Docker
  • C# application running on Windows host
  • Using ARI for call control
  • UDP port 1000 open and listening
  • I use Zoiper 5 utility to simulate the call

Logs in Asterisk:
Activating Stasis app ‘my-websocket-app’
== WebSocket connection from ‘172.17.0.1:39310’ for protocol ‘’ accepted using version ‘13’
– Executing [6001@from-internal:1] Answer(“PJSIP/6001-00000001”, “”) in new stack
> 0x7fb02c0bd1a0 – Strict RTP learning after remote address set to: 127.0.0.1:65008
– Executing [6001@from-internal:2] Stasis(“PJSIP/6001-00000001”, “my-websocket-app”) in new stack
> 0x7fb02c0c71f0 – Strict RTP learning after remote address set to: 172.19.80.1:1000
– Called 172.19.80.1:1000
– UnicastRTP/172.19.80.1:1000-0x7fb02837cb80 answered
> Launching Stasis(my-websocket-app) on UnicastRTP/172.19.80.1:1000-0x7fb02837cb80
– Channel PJSIP/6001-00000001 joined ‘simple_bridge’ stasis-bridge <14eb4fc6-c24d-460a-a477-6598160ae989>
– Channel UnicastRTP/172.19.80.1:1000-0x7fb02837cb80 joined ‘simple_bridge’ stasis-bridge <14eb4fc6-c24d-460a-a477-6598160ae989>

Has anyone encountered similar issues or can point me in the right direction for debugging this?

Thank you in advance!

If you see the packets leaving Asterisk, then that would make it seem as though it is either Docker networking or your application itself.

I ran Wireshark to check some udp traffic from docker IP.
Nothing :frowning:

I have this for you:

RTP Flow testing, for simulate externalchannel RTP connection:

1.- Install Gstreamer, Ubuntu 22/24.

sudo apt update

sudo apt install gstreamer1.0-tools gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly

2.- Run on your Asterisk server:

Server+sink(set your destiny ip host=):

gst-launch-1.0 audiotestsrc wave=sine freq=440 is-live=true ! audioconvert ! audioresample ! audio/x-raw,rate=8000,channels=1 ! mulawenc ! rtppcmupay ! udpsink host=192.168.1.100 port=9000

3.- On destiny host:

RTP Player, as root:

gst-launch-1.0 -v udpsrc port=9000 caps=“application/x-rtp,media=audio,encoding-name=PCMU,payload=0,clock-rate=8000” ! rtppcmudepay ! mulawdec ! audioconvert ! audioresample ! autoaudiosink

If you hear the “beeeeep”, you can effectively transmit the RTP stream between Asterisk and your external media. It could also be 127.0.0.1.

The first attempt could be 2 virtual machines, one sends the audio and the other receives and plays it.
Then, you can try sending from VM1 to your RTP server and observe the RTP traffic flowing to your C# application.
Finally, you send from your Docker instance to your C# application and see what happens.

Cheers!

Thank you for the assistance with my RTP issue!

Тhe problem has been resolved…
After moving my code to a properly configured Asterisk server, the RTP packets are now transmitting correctly.
It seems the issue was with my Docker configuration rather than with the code itself.

Thanks to all!