Asterisk 1.6 keep RTP port open even after call is closed

Hi guys
i have asterisk 1.6 working .

the main problem that i have is i have a heavy server and this handle thousands of calls on 1 ip .

the issue is when a call occur , it takes some ports in RTP.conf

but when the call is finish … i still see the session open if i issue
netstat -aun

as example :slight_smile:

udp 0 0 0.0.0.0:18831 0.0.0.0:*
udp 0 0 0.0.0.0:36239 0.0.0.0:*
udp 0 0 0.0.0.0:6671 0.0.0.0:*
udp 0 0 0.0.0.0:9359 0.0.0.0:*
udp 0 0 0.0.0.0:7695 0.0.0.0:*
udp 0 0 0.0.0.0:63759 0.0.0.0:*
udp 0 0 0.0.0.0:62607 0.0.0.0:*
udp 0 0 0.0.0.0:60047 0.0.0.0:*
udp 0 0 0.0.0.0:37391 0.0.0.0:*
udp 0 0 0.0.0.0:62735 0.0.0.0:*
udp 0 0 0.0.0.0:41871 0.0.0.0:*
udp 0 0 0.0.0.0:18575 0.0.0.0:*
udp 0 0 0.0.0.0:52367 0.0.0.0:*
udp 0 0 0.0.0.0:9615 0.0.0.0:*
udp 0 0 0.0.0.0:50319 0.0.0.0:*
udp 0 0 0.0.0.0:12687 0.0.0.0:*
udp 0 0 0.0.0.0:41231 0.0.0.0:*
udp 0 0 0.0.0.0:43279 0.0.0.0:*
udp 0 0 0.0.0.0:51727 0.0.0.0:*
udp 0 0 0.0.0.0:30479 0.0.0.0:*
udp 0 0 0.0.0.0:62223 0.0.0.0:*
udp 0 0 0.0.0.0:16527 0.0.0.0:*
udp 0 0 0.0.0.0:31503 0.0.0.0:*
udp 0 0 0.0.0.0:60431 0.0.0.0:*
udp 0 0 0.0.0.0:21647 0.0.0.0:*
udp 0 0 0.0.0.0:54543 0.0.0.0:*
udp 0 0 0.0.0.0:49167 0.0.0.0:*
udp 0 0 0.0.0.0:28431 0.0.0.0:*
udp 0 0 0.0.0.0:19599 0.0.0.0:*
udp 0 0 0.0.0.0:8335 0.0.0.0:*
udp 0 0 0.0.0.0:18959 0.0.0.0:*
udp 0 0 0.0.0.0:45967 0.0.0.0:*
udp 0 0 0.0.0.0:55951 0.0.0.0:*
udp 0 0 0.0.0.0:31759 0.0.0.0:*
udp 0 0 0.0.0.0:20879 0.0.0.0:*
udp 0 0 0.0.0.0:42767 0.0.0.0:*
udp 0 0 0.0.0.0:48271 0.0.0.0:*
udp 0 0 0.0.0.0:23183 0.0.0.0:*
udp 0 0 0.0.0.0:59791 0.0.0.0:*
udp 0 0 0.0.0.0:25999 0.0.0.0:*
udp 0 0 0.0.0.0:55695 0.0.0.0:*
udp 0 0 0.0.0.0:8591 0.0.0.0:*
udp 0 0 0.0.0.0:24207 0.0.0.0:*
udp 0 0 0.0.0.0:51855 0.0.0.0:*
udp 0 0 0.0.0.0:59663 0.0.0.0:*
udp 0 0 0.0.0.0:8975 0.0.0.0:*
udp 0 0 0.0.0.0:39183 0.0.0.0:*
udp 0 0 0.0.0.0:32271 0.0.0.0:*
udp 0 0 0.0.0.0:64271 0.0.0.0:*
udp 0 0 0.0.0.0:45071 0.0.0.0:*
udp 0 0 0.0.0.0:25231 0.0.0.0:*
udp 0 0 0.0.0.0:64143 0.0.0.0:*

as we see sessions keep opened all the time

i read about RTP time out and sip session time out

i tried both of them but no luck

i used in sip.conf :slight_smile:

session-timers=originate
session-expires=600
session-minse=90
session-refresher=uas

also played with ession-timers=originate and ession-timers=refuse and same result

also added

rtptimeout=60

and rtpholdtimeout

and all seems to same result

the session keep hanged

any solution for that without upgrading asterisk ?

cheers

Asterisk 1.6.2.x is five years past end of life (1.6.0.x and 1.6.1.x expired even earlier). No-one is going to spend any time on this!

david i appreciate your help

david i want to ask if the solution can be from sysct.conf tuning

or from asterisk

assume this issue on asterisk 13

what will you do in this case ?

thanks

Make sure you are using the most recent full release.

Make sure you have allowed long enough for the SIP protocol to timeout. That’s around 30 seconds, I think.

Run sip show channels to see if the problem is due to the channel not having been hungup.

If so, run core show channels to see if you are failing to hangup the channels in your dialplan.

If the version is current, you have allowed time for the session to die properly and there are no channels, or only SIP channels, obtain sip set debug on logging, and raise a bug report on the issue tracker, including the SIP logs, logging output at verbosity 5 and debug level 5, sip.conf for the devices affected, and the relevant parts of your dialplan.

did you mean config below :slight_smile:session-timers=originate
session-expires=600
session-minse=90
session-refresher=uas

?

Session timers are unrelated to session termination, they ensure the session is still alive using the SIP protocol. As part of SIP at the end of calls there’s a period of 32 seconds where some state is retained so that if we get a retransmitted message we respond with the same response as before. After 32 seconds it should be terminated though and resources released, that is what @david551 was referring to.

appreciate your kind helping

could you tell me what asterisk sip settings that affect session termination ?

cheers

I don’t remember what in that version of Asterisk and chan_sip could impact things, but nothing configurable would cause RTP session leaks.

you mean only way is to upgrade asterisk ?

It’s up to you to either determine what in later versions fixed what you are seeing, or upgrading to a supported version which should resolve the problem.

i even tried to fix that from linux sysctl UDP by running UDP timeout for kernel level

but couldn’t fix it so far

I’m having the same problem on 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 etcl) 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 the directrtp.

Rick

so we are on the same boat and i hope to share with us if you could find a solution .