[asterisk-users] SIP RTP ports not released when channel is hung up

Olle E. Johansson oej at edvina.net
Thu Feb 11 14:09:22 CST 2010


11 feb 2010 kl. 13.30 skrev Klaus Darilion:

> Am 11.02.2010 11:21, schrieb Armin Schindler:
>> Hello,
>> 
>> using Asterisk 1.4.28, I encountered a problem with SIP
>> RTP port allocation.
>> 
>> I found some entries in mailinglist and bugtracker regarding
>> this issue, but only old ones.
>> 
>> My rtp.conf has
>>   [general]
>>   rtpstart=30000
>>   rtpend=30100
>> 
>> so 100 ports available. I know that up to 4 ports per channel can be used
>> and so up to 25 channels are possible.
4 ports only if you use audio and video. We use two ports per RTP stream - and send on two ports, but this is for incoming media.
So 100 ports is enough for 50 audio calls.

>> But even earlier I often get the error about "No RTP ports remaining".
>> 
>> I had a look at
>>   netstat -nuap
>> and it shows that a lot of ports are still assigned, even if there is no
>> channel in use.
>> But "sip show channels" show a lot of (unused) entries with no
>> codec/Format and "Last Message" like INVITE, REGISTER, OPTIONS.
REGISTER and OPTIONS allocate no RTP ports, so those are not a problem. If you have a SIP channel that has a last message being INVITE and still say you have no calls, you have a problem right there.
> 
> If the channels exists even after 32 seconds after BYE, and BYE was 
> signaled correctly, I would file a bug report.

Yes, the RTP ports should be closed at least at that point, when we destroy the SIP channel. Anything else is a bug. I am not really sure about when they're closed, but I'm trying to understand that in my RTCP adventures since I want to change it.

While we are discussing this, I would like some feedback.

If we receive RTCP bye from the other end, we can close the port at that point. 
When we hang up the call, we send RTCP BYE and a final RTCP report.

If we don't receive the RTCP BYE or a final report - I would like to keep the RTCP port open a bit longer - but at maximum up to the destruction of the SIP channel - so I can have a chance of receiving a final RTCP report from the other end or/and RTCP BYE.

What do you think?

/O


More information about the asterisk-users mailing list