Session timers in asterisk 16 / bundled pjsip


I recently upgraded to the latest version of 16 with pjsip bundled. Install seemed to go fine. I was running 15.2 and a slightly earlier version of pjsip. It seemed to me there was a bug affecting session timers in 12 or 13 that I thought was fixed around 13.6. But in my current install, I had calls dropped at the 15 minute mark the same as was happening before. I found a workaround [maybe?] using a predial gosub & PJSIP_SEND_SESSION_REFRESH()=invite. Wondering if this is a documented issue in 16 and whether or not the work around will work as I don’t really want to back out.


Any known bugs are always present in JIRA[1]. I’m not aware of anything along those lines, though. What is the actual SIP exchange? What is your configuration?



type = endpoint
allow = ulaw
from_domain =
outbound_auth = flowroute
aors = flowroute
timers_sess_expires = 840
rtp_timeout = 120
allow_transfer = no

Sorry, I didn’t have debug running when the call dropped. I will try a few calls and see what happens. Thanks.



Did you learn anything more about this problem? I have it with Flowroute too and had to drop back to the SIP channel driver just for Flowroute. I am running asterisk 16.1.0.


I think it is a work around and not really a fix but I set “rtp_keepalive=125”. That seems to have taken care of it but I haven’t done a lot of testing.


Thanks. I spent the afternoon trying to figure this out. rtp_keepalive doesn’t help me, so perhaps we have different problems.

In case you are interested in debugging further, I’ve found it helpful to set this in my Flowroute outbound endpoint:


This will speed up the time to failure to 5 minutes rather than 15 that is the default with Flowroute’s 1800 second session timer. This will only work on outgoing calls. (I have the problem in both directions, however.)

I’ve determined that my problem likely has nothing to do with RTP traffic itself which is why rtp_keepalive does nothing for me.

What I did discover is that if I move to a UDP transport from TLS, my problems go away. This led me to debug what is different between the dialogs for UDP and TLS and what I discovered is that it appears Flowroute does send the in-dialog INVITE for the UDP transport that is used to solicit a response from my Asterisk to reset the session timer, but does NOT send it for TLS. I determined this by looking at the results of both “pjsip set history on” and “pjsip set logger on”. Both methods show the expected periodic INVITEs for UDP but not for TLS. It’s possible that Asterisk is doing something to squash the TLS INVTITEs though and I can’t use Wireshark to confirm they are being sent since the connection is encrypted. (Actually it just occurred to me I can switch to TCP instead of TLS and then be able to use Wireshark to see what’s happening… maybe I’ll try that tomorrow.)

But my bottom line so far is that the only thing I think I see working at this point is to give up the encryption and use UDP as the transport.

What transport are you using with Flowroute when you are experiencing your problem?


I’m using udp. I tried setting up TLS a while back and it wouldn’t even register but I really had no idea where to start with the configuration so didn’t spend much time. I’ve never used tcp. I thought I saw where using tcp could be a minus for sip so never really gave it much thought. I only have a single ethernet interface and thought I read that it could be tricky to set up more than one transport on the same interface. I use 2 ITSP’s and supposedly both support tls but I thought maybe it was still in testing with one or both so just went back to UDP.