PJSIP not refreshing Outbound registrations as expected

I am currently using PJSIP to configure Outbound Registrations to ITSP. The Asterisk version I am using is 18.15. The problem I am facing is that when I register to ITSP with expire=3600, no Re-Register is sent to ITSP before 3600 seconds expire. After 3600 seconds expire, I see a REGISTER packet to re-register. So is there a way or am I missing something in my configuration to be able to renew the registration before it expires? Any help is appreciated. Thanks.

You should provide a SIP trace of the full registration exchange using “pjsip set logger on”.

This is a registered package.

pjsip send register ITSP_0383090005
<--- Transmitting SIP request (511 bytes) to UDP:15.24.0.10:5060 --->
REGISTER sip:0383090005@62.3.14.13:5060 SIP/2.0
Via: SIP/2.0/UDP 184.169.125.124:5060;branch=z9hG4bKPj820fc59e-7dfd-42cc-a7bd-9b1a16924c3b
Route: <sip:15.24.0.10:5060;lr>
From: <sip:0383090005@52.3.184.113>;tag=fd96dda7-548b-4cf8-9ded-86e376775ce5
To: <sip:0383090005@52.3.184.113>
Call-ID: d980eca6-9235-44f2-9063-02d76fa89518
CSeq: 16897 REGISTER
Contact: <sip:ITSP_0383090005@184.169.125.124:5060;line=orgvkay>
Expires: 3600
Max-Forwards: 70
User-Agent: Asterisk
Content-Length:  0


<--- Received SIP response (529 bytes) from UDP:10.45.0.29:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 184.169.125.124:5060;branch=z9hG4bKPj820fc59e-7dfd-42cc-a7bd-9b1a16924c3b;received=10.55.1.84
From: <sip:0383090005@52.3.184.113>;tag=fd96dda7-548b-4cf8-9ded-86e376775ce5
To: <sip:0383090005@52.3.184.113>;tag=91755c8e153a8d24899ac509fd950c6f.207a2632
Call-ID: d980eca6-9235-44f2-9063-02d76fa89518
CSeq: 16897 REGISTER
WWW-Authenticate: Digest realm="52.3.184.113", nonce="Zu1BKWbtP/16X+cR4k1gKEOB+fsMRS77", qop="auth"
Server: kamailio (5.4.4 (x86_64/linux))
Content-Length: 0


<--- Transmitting SIP request (771 bytes) to UDP:15.24.0.10:5060 --->
REGISTER sip:0383090005@62.3.14.13:5060 SIP/2.0
Via: SIP/2.0/UDP 184.169.125.124:5060;branch=z9hG4bKPj61894fb1-1123-430f-ad76-2a1db21ec549
Route: <sip:15.24.0.10:5060;lr>
From: <sip:0383090005@52.3.184.113>;tag=fd96dda7-548b-4cf8-9ded-86e376775ce5
To: <sip:0383090005@52.3.184.113>
Call-ID: d980eca6-9235-44f2-9063-02d76fa89518
CSeq: 16898 REGISTER
Contact: <sip:ITSP_0383090005@184.169.125.124:5060;line=orgvkay>
Expires: 3600
Max-Forwards: 70
User-Agent: Asterisk
Authorization: Digest username="0383090005", realm="52.3.184.113", nonce="Zu1BKWbtP/16X+cR4k1gKEOB+fsMRS77", uri="sip:0383090005@62.3.14.13:5060", response="bbad26c80a34c16c862bca7c6a3659e6", cnonce="0b5359f4e9d0494087ded1ab65201c00", qop=auth, nc=00000001
Content-Length:  0


<--- Received SIP response (418 bytes) from UDP:10.45.0.29:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 184.169.125.124:5060;branch=z9hG4bKPj61894fb1-1123-430f-ad76-2a1db21ec549;received=10.55.1.84
From: <sip:0383090005@52.3.184.113>;tag=fd96dda7-548b-4cf8-9ded-86e376775ce5
To: <sip:0383090005@52.3.184.113>;tag=91755c8e153a8d24899ac509fd950c6f.207a2632
Call-ID: d980eca6-9235-44f2-9063-02d76fa89518
CSeq: 16898 REGISTER
Server: kamailio (5.4.4 (x86_64/linux))
Content-Length: 0

That 200 OK is lacking the added Contact with expires, so that’s probably why. That behavior is against the RFC. It would not surprise me if PJSIP doesn’t handle that scenario since it is against the RFC as I mention.

Thanks for your explanation. The problem you mentioned has been solved. Currently, I see that the REGISTER Refresh time seems to be sent before the registration expires is 10s. I would like to ask if there is a way to change this time to be greater than 10s. This is very important for the system we are using now. I look forward to your help. Best regards

It’s a hardcoded value[1] and not configurable. You would need to modify the source code and rebuild Asterisk.

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

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