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

Armin Schindler armin at melware.de
Fri Feb 12 04:37:56 CST 2010


>>> 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.

Even if it isn't a video call, I think as soon as videosupport is activated,
the additional 2 ports are allocated.

>>> 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.

I just see these entries with "sip show channels", but cannot tell if
e.g. the REGISTER listed channels have RTP ports allocated.
Who can I find out which SIP channel allocated which port?
Or which SIP channel belongs to the ports I see with 'netstat -nuap'?

I do have a sip channels like
  172.21.4.114    666    0430c3a638e  00102/00000  0x0 (nothing)    No   Init: INVITE
in 'sip show channels' and they don't go away for a long time.
Shouldn't there be a timeout to destroy such a channel even if somehow
the phone was 'disconnected' in during a call?

>> 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.

Before filing a bug, I would like to be sure that I have checked all 
possibilities here.

To me it looks like that some special event leaves a sip channel activ and 
not be destroyed. So when Asterisk runs for a longer time, more and more 
channels like this occur.
Ayn idea how to check this?

Armin




More information about the asterisk-users mailing list