Which file holds registration timersetting?

I was told that the registration timer setting in Asterisk is fixed at t-10 seconds. My server requires the “standard setting” which appears to be time \ 2. If Asterisk doesn’t report by t \ 2 the server doesn’t accept it. I would lke to change the asterisk setting. What file would I look in to find the setting?

If you are referring to re-registration time. It’s a fixed 10 seconds in res_pjsip_outbound_registration[1]. You would need to change the code itself to have it be dynamic. I’ve never heard of " \ 2" as a standard.

[1] asterisk/res_pjsip_outbound_registration.c at master · asterisk/asterisk · GitHub

The purpose of recommending t / 2 is to ensure that a re-registration occurs by t. Any registrar that is insisting that the re-registration arrive any earlier than t - epsilon is broken.

I would agree. The [newer] Obi ATA allows the user to set it to whatever you like and defaults to t \ 2. . The current situation forces Asterisk to reregister every 40 seconds which seems like overkill. I’m quizzing my trunk provider. Thanks

Looking at the code I think I can see an issue
next_registration_round = response->expiration - REREGISTER_BUFFER_TIME;

the Ok never gives the specified pjsip expiration. Which causes a loop. Should it?

<— Received SIP response (363 bytes) —>
SIP/2.0 200 Ok
CSeq: 54565 REGISTER
m: ;expires=40
l: 0

I don’t understand the question. The remote side can choose a different expiration time. The value from the response is what the remote side chose, and what has to be followed. I also don’t know what “causes a loop” means.

That was what I thought. I wanted a long[er] time between registration to improve network security but this server demands 30-60 seconds. I need to talk to them some more. Thanks.

What threat do you see? Generally it is outgoing calls that can incur you costs and registration isn’t needed to make those (although some providers might require it).

The main problem I would see with short registration intervals is that the interval is less than the time to give up re transmitting a request, and that temporary network outages are more likely to result in a registration drop out (and assuming that failed registration retried quickly, a high percentage of down time).

My Public address & password string used for every attempt? Plus my address hasn’t changed in 3 years but this provider doesn’t use IP authentication.

Anyone eavesdropping will have the public address.

The password string is never transmitted, only a hash, based on a changing nonce, is ever sent.

This information is also present in every outbound call.

Pjsip.conf under ‘type=registration’ you’ll probably see ‘expiration=40’ (because you noted it occurs every 40 seconds).
The default (“standard setting”) is 3600 (1 hour) if you comment out that line.

The remote side still ultimately controls it. You can ask for an expiration, it doesn’t mean they’ll obey what you’ve asked.

Good to know.
Asterisk itself does not precisely obey the request either. It sets a random value in a limited range lower than the requested interval for each register.

PJSIP doesn’t do that itself. It will enforce the expirations as configured on the AOR[1] and the resulting Contact sent back may be a second less, due to time spent processing and rounding.

[1] Asterisk 12 Configuration_res_pjsip - Asterisk Project - Asterisk Project Wiki

If I set ‘expiration=7200’ I see expiration timeouts between about 5400-7195.

You’re going to need to clarify what “see expiration timeouts” means and where you see it. On an outbound registration it would request 7200 but as I’ve stated before the remote side can choose to have it be lower.

I just configured an outbound registration with 7200 and confirmed our REGISTER contains it:

REGISTER sip:172.16.199 SIP/2.0
Via: SIP/2.0/UDP;rport;branch=z9hG4bKPj8987d30f-9362-4daa-96d1-94d6f4a93f15
From: <sip:1000@>;tag=4c036535-03ea-4ea0-bcb5-f7d9f5c0448c
To: <sip:1000@>
Call-ID: af01a0ff-1e54-416a-874e-d38c70450556
CSeq: 42459 REGISTER
Contact: <sip:s@>
Expires: 7200
Max-Forwards: 70
User-Agent: Asterisk PBX 18.14.0
Content-Length:  0

I use ‘pjsip show registrations’ on the CLI.

That shows outbound registrations and the time until they expire. It does not show what the original expiration was.

It consistently re-registers at the expiration time shown.

I’m not sure what this conversation is about anymore.