RTP port allocaton issue

I am running the 10.2.0 version.
Asterisk works fine for few calls and then I get:

Mar 12 16:19:22] ERROR[12131]: res_rtp_asterisk.c:568 ast_rtp_new: Oh dear… we couldn’t allocate a port for RTP instance ‘0x9aa65b8’

I have a rtp range from 10000-10009 which is 10 ports which should cover easily 2,3 channels.
Once i restart all is good for some times and then it dies again.
Any ideas why this is happening?

It looks like asterisk is not releasing the ports correctly?

thx

That’s only enough for 5 sessions. Sessions persist for some time after the BYE, to allow for missing/delayed packets.

Most people would allocate 1000s.

I had it running like this in older versions for almost 4 years with no issues.
It started with 1.6 and then 10.0

Hello!

I am seeing the same error now:

[Jun 26 11:05:51] ERROR[2010]: res_rtp_asterisk.c:568 ast_rtp_new: Oh dear… we couldn’t allocate a port for RTP instance ‘0x15fb4f8’
[Jun 26 11:05:51] NOTICE[2010]: chan_sip.c:22617 handle_request_invite: Failed to authenticate device …

This is happening with Asterisk 1.8.13.1 under Debian unstable.

I have 100 ports allocated for RTP (19900 - 20000), and calls on the system are relatively rare.

The output of ‘netstat -an’ shows all the UDP ports allocated for RTP occupied (see the pasted output below).

Trying to unload the res_rtp_asterisk.so module fails with the following error:

debilina*CLI> module unload res_rtp_asterisk.so
Unable to unload resource res_rtp_asterisk.so
Command ‘module unload res_rtp_asterisk.so’ failed.
[Jun 26 11:14:04] WARNING[29094]: loader.c:538 ast_unload_resource: Soft unload failed, ‘res_rtp_asterisk.so’ has use count 51

Whereas sip show channels shows no active channels:

debilina*CLI> sip show channels
Peer User/ANR Call ID Format Hold Last Message Expiry Peer
0 active SIP dialogs

To me, clearly this is clearly a bug, and a long-standing one, since I’ve seen this with several versions of 1.8 and looks like it persists into newer versions too.

Here is the output of netstat:
udp 27060 0 0.0.0.0:19900 0.0.0.0:*
udp 0 0 0.0.0.0:19901 0.0.0.0:*
udp 4032 0 0.0.0.0:19902 0.0.0.0:*
udp 0 0 0.0.0.0:19903 0.0.0.0:*
udp 18576 0 0.0.0.0:19904 0.0.0.0:*
udp 0 0 0.0.0.0:19905 0.0.0.0:*
udp 4032 0 0.0.0.0:19906 0.0.0.0:*
udp 0 0 0.0.0.0:19907 0.0.0.0:*
udp 5760 0 0.0.0.0:19908 0.0.0.0:*
udp 0 0 0.0.0.0:5060 0.0.0.0:*
udp 0 0 0.0.0.0:19909 0.0.0.0:*
udp 20708 0 0.0.0.0:19910 0.0.0.0:*
udp 0 0 0.0.0.0:19911 0.0.0.0:*
udp 4320 0 0.0.0.0:19912 0.0.0.0:*
udp 0 0 0.0.0.0:19913 0.0.0.0:*
udp 4320 0 0.0.0.0:19914 0.0.0.0:*
udp 0 0 0.0.0.0:19915 0.0.0.0:*
udp 4320 0 0.0.0.0:19916 0.0.0.0:*
udp 0 0 0.0.0.0:19917 0.0.0.0:*
udp 4032 0 0.0.0.0:19918 0.0.0.0:*
udp 0 0 0.0.0.0:19919 0.0.0.0:*
udp 17652 0 0.0.0.0:19920 0.0.0.0:*
udp 0 0 0.0.0.0:19921 0.0.0.0:*
udp 20596 0 0.0.0.0:19922 0.0.0.0:*
udp 0 0 0.0.0.0:19923 0.0.0.0:*
.
.
.
.
udp 4320 0 0.0.0.0:20000 0.0.0.0:*
udp 0 0 0.0.0.0:20001 0.0.0.0:*

The original thread was clearly due to a misconfiguration, not to a resource leak.

The correct place to report bugs is issues.asterisk.org/jira/

Your port allocation is only enough for 50 RTP sessions (although that doesn’t invalidate that it is indicating a resource leak).

Can you reproduce this in a lab environment, as without that, it is probably going to be very difficult to debug.

Are there any unusual messages before it leaks?

I’m assuming that you are only using SIP.

Hi David,

Yes, I am aware of the bug-tracker and I’ve posted a bug-report and comments there. If I am able to reproduce this, I will definitely post there. I wanted to get more information into this discussion so that people searching for some key strings would encounter it and join in to see whether others are seeing it too.

Thanks!
iordan