PJSIP and session timers on incoming calls

Hi there.

I’m using Asterisk 16 and need my Asterisk for testing purposes to reject inbound trunk calls where for ex. Min-SE is set to 90 secs. with “422 Session Timer too Small” message, when Min-SE on the PBX is set higher.

I have tried multiple variations, but without success: when the timer on Asterisk side is set within the range that is accepted by the trunk provider, the call is answered, unless the invite includes smaller timer; otherwise there is no response for the invite from Asterisk and the call is canceled by the provider after the maximum retry interval.

I have configured the timers in the pjsip.endpoint_custom_post.conf, which is included in the pjsip.conf as follows:

/MY_TRUNK_NAME/
timers=yes
timers_min_se=2400
timers_sess_expires=3600

I have also tried with “timers=always” and “timers=required”: on outbound calls “yes” and “required” act as expected (on both options the timers are set - on “yes” timers appear as value at the “Support” header and on “required” at the “Require” header), but on inbound calls there is no difference; setting timers to “always” seems to have no effect in both directions, like setting to “no”…

As I remember, on the old chan_sip you could set “session-refresher=uas” to achieve the expected behavior, but I didn’t find any instruction how to reach the same effect using pjsip…

I would be very appreciated for some advice, what I’m doing wrong here!

Asterisk 16 is in security fixes only mode.

This file will not be read unless there is an include for it somewhere. It looks like you are probably using FreePBX, which has its own forum.

422 isn’t used for Min-SE too low, it is used for Session-Expires too low.

No Min-SE header is equivalent to one of 90 seconds. If Min-SE is too low, the UAS simply uses its own Min-SE setting, instead.

What is the problem you are trying to solve?

RFC 4028

1 Like

Yes, I’m using FreePBX and the file has its include by default…
Never the less, I simply need a 422 reply from Asterisk on incoming calls, when the session timers I set with Asterisk/ FreePBX are set higher than the session timers in the INVITE.

Originally you said the minimum in the INVITE (Min-SE). Are you now saying that

was wrong?

Also, what is the problem that you are trying to solve? I could imagine that anyone setting a very low timer might well abort a call if you try to override them to a much higher value. It rather looks like you are trying to disable timers, by setting a very high value, rather than completely disabling them.

If someone tries to force a very low value, there is probably a reason for it.

Yes, there is a reason: I’m working for an ISP and we need such a behavior for testing purposes…
I thought the question is quite simple: for. ex. I set my PBX to Min-SE=8000 and Session-Expire=14400, there is an incoming INVITE with Min-SE=1800 and Session-Expire=3600 - how do I get my PBX to reply to this INVITE with 422 message instead of ignoring it?
The reason doesn’t matter! If I wouldn’t nead it, I wouldn’t ask! Don’t you think? :smile:

By the way, here is an example with a Cisco gateway:

SIP/2.0 422 Session Timer too small
Via: SIP/2.0/UDP 100.91.65.109:5060;branch=z9hG4bKb1rk46104o470u56dcb0.1
From: sip:+49401234567@Provider.com;user=phone;tag=28h2zlji-CC-28
To: sip:+49307654321@192.168.133.32;transport=udp;user=phone;tag=47553E8-1599
Date: Thu, 21 Oct 2021 09:33:31 GMT
Call-ID: xl0lpkmi3iq0qjk90kqmi1m29mj21qjv@B.5.220.voice.huawei.provider.mpls
CSeq: 1 INVITE
Allow-Events: presence
Min-SE: 8000
Session-ID: 00000000000000000000000000000000;remote=6745a92dc1c75c9aaf56319b5eaaf048
Server: Cisco-SIPGateway/IOS-17.3.3
Content-Length: 0

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.