PJSIP realtime registration - immediate 'Unavailable'

Hi,

I’m trying to configure PJSIP realtime using Asterisk 16.5.

When a register comes in, authentication takes place and Asterisk returns OK and I see the ‘Added contact’ message. But then immediately after I see a ‘Contact has been deleted’ message and the contact is not there. There is no error logged.

What can cause this?

Here is a console log showing the description:

<— Received SIP request (690 bytes) from UDP:1.1.1.1:5060 —>
REGISTER sip:test.com SIP/2.0
Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bKd80c.ea884331.0
Via: SIP/2.0/UDP 2.2.2.2:57605;received=54.79.42.222;rport=57605;branch=z9hG4bKPjNX.0Xauvvek1UKB7MdcCssU.LbAfSpZQ
Max-Forwards: 69
From: “Peter Piper” sip:5001@test.com;tag=FzrObhWR5zSjixe.tZTsnuY0j3zmF8cg
To: “Peter Piper” sip:5001@test.com
Call-ID: cOICGiIBs0PpjkzSuXjZxazbdoT-Gsvt
CSeq: 53470 REGISTER
User-Agent: Telephone 1.4
Contact: sip:5001%40test.com@1.1.1.1:5060
Expires: 3600
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length: 0
X-USER:5001@test.com

<— Transmitting SIP response (670 bytes) to UDP:1.1.1.1:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 1.1.1.1:5060;rport=5060;received=1.1.1.1;branch=z9hG4bKd80c.ea884331.0
Via: SIP/2.0/UDP 2.2.2.2:57605;rport=57605;received=54.79.42.222;branch=z9hG4bKPjNX.0Xauvvek1UKB7MdcCssU.LbAfSpZQ
Call-ID: cOICGiIBs0PpjkzSuXjZxazbdoT-Gsvt
From: “Peter Piper” sip:5001@test.com;tag=FzrObhWR5zSjixe.tZTsnuY0j3zmF8cg
To: “Peter Piper” sip:5001@test.com;tag=z9hG4bKd80c.ea884331.0
CSeq: 53470 REGISTER
WWW-Authenticate: Digest realm=“test.com”,nonce=“1565690313/e776f30ae0b36e381531ded9e3d4985f”,opaque=“13a566d545b8ac9b”,algorithm=md5,qop=“auth”
Server: The SIM Works
Content-Length: 0

<— Received SIP request (987 bytes) from UDP:1.1.1.1:5060 —>
REGISTER sip:test.com SIP/2.0
Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bKe80c.2dd4f6e2.0
Via: SIP/2.0/UDP 2.2.2.2:57605;received=54.79.42.222;rport=57605;branch=z9hG4bKPj-wJwOtVLcgB-WDbT9AY0TjNshAC3jgAk
Max-Forwards: 69
From: “Peter Piper” sip:5001@test.com;tag=FzrObhWR5zSjixe.tZTsnuY0j3zmF8cg
To: “Peter Piper” sip:5001@test.com
Call-ID: cOICGiIBs0PpjkzSuXjZxazbdoT-Gsvt
CSeq: 53471 REGISTER
User-Agent: Telephone 1.4
Contact: sip:5001%40test.com@1.1.1.1:5060
Expires: 3600
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Authorization: Digest username=“test”, realm=“test.com”, nonce=“1565690313/e776f30ae0b36e381531ded9e3d4985f”, uri=“sip:test.com”, response=“ee688a0193b4f87f243a655f3cd30696”, algorithm=md5, cnonce=“Nc8aIhXgXfejgbcym0KnaQFM6RGogxlH”, opaque=“13a566d545b8ac9b”, qop=auth, nc=00000001
Content-Length: 0
X-USER:5001@test.com

== Endpoint 5001-test.com is now Reachable
<— Transmitting SIP response (630 bytes) to UDP:1.1.1.1:5060 —>
SIP/2.0 200 OK
Via:SIP/2.0/UDP1.1.1.1:5060;rport=5060;received=1.1.1.1;branch=z9hG4bKe80c.2dd4f6e2.0
Via: SIP/2.0/UDP 2.2.2.2:57605;rport=5765;received=54.79.42.222;branch=z9hG4bKPj-wJwOtVLcgB-WDbT9AY0TjNshAC3jgAk
Call-ID: cOICGiIBs0PpjkzSuXjZxazbdoT-Gsvt
From: “Peter Piper” sip:5001@test.com;tag=FzrObhWR5zSjixe.tZTsnuY0j3zmF8cg
To: “Peter Piper” sip:5001@test.com;tag=z9hG4bKe80c.2dd4f6e2.0
CSeq: 53471 REGISTER
Date: Tue, 13 Aug 2019 09:58:34 GMT
Contact: sip:5001%40test.com@1.1.1.1:5060;expires=3599
Expires: 3600
Server: The SIM Works
Content-Length: 0

== Contact 5001@test.com/sip:5001%40test.com@1.1.1.1:5060 has been deleted
== Endpoint 5001-test.com is now Unreachable

Are you using domain support? If you disable it does that alter the behavior?