RTP Ports not closing Asterisk 11.23.0

I’m having an rtp port leak problem since going to 11.23.0. We had been running version 4 for about 6+ years with no issues, we recently upgraded to 11.23.0 (new server hardware, new firewall etc) and yesterday all 10,000 RTP ports I have allocated, depleted with the message;

res_rtp_asterisk.c: Oh dear… we couldn’t allocate a port for RTP instance

I was forced to restart Asterisk in the middle of the day, this cleared up the ports. I can now see new rtp ports are slowly starting to hang around again.

This system has 4300+ phones and makes around 10,000 calls per day. The server had been up and running for about 6 weeks with nearly 500K calls processed, so the hanging process is quite slow. I have directrtp setup so the server itself does not participate in many of the calls (just ones like VM etc).

Curious if this is a bug or config issue? My config did not change much from my 1.4 version with the exception of adding the directrtp for all non-natted devices.


That version is in the security fixes only part of its lifecycle, so won’t receive fixes for resource leaks unless they can be remotely exploited.

1 Like

Do you think this a version issue (ie leaking ports) or a configuration issue?

If you aren’t leaking channels, it is an Asterisk bug. If you are leaking channels, it might be your bug.

My previous version of Asterisk (1.4) used to hang a lot of channels, but I’m now not getting any hung channels.

I’ve done some traces and log captures.

I can see Asterisk answers the call, Asterisk initially opens the RTP ports for both the from and to channel, then initiates the directrtp connection between (bridges) the “from” and “to” channels". At which point Asterisk should jump out of the RTP stream.

ie - Remotely bridging SIP/xxxxxxx-0000e3fe and SIP/xxxxxxx-0000e3ff"

It is these initial RTP ports that asterisk opens before the bridging that are sometimes not closing. I can see the call completes normally, my CDR does not show any issues and there are no networking issues. After 6 days I already have over 700 open RTP ports, (but no hung channels).