Unregistered device with PJSIP realtime

I tried changing the database from MySQL to SQLite3. Then I tried to use Zoiper to register using the registered pjsip number. Problems arise when unregistered devices. Data on ps_contacts is not automatically deleted when the device is unregistered, but the contact on the endpoints will disappear after 1 minute. I have tried changing the minimum expiration value to 5 in ps_aors as an example, but it has no effect. When I activate :

core set debug 1
core set verbose 3

And register new device for example using sipNumber 1004, it show :

Added contact 'sip:1004@192.168.100.52:52422;transport=UDP;rinstance=af2f6c3e9b721646' to AOR '1004' with expiration of 60 seconds

When I unregistered that device, it show :

Removed contact 'sip:1004@192.168.100.52:52422;transport=UDP;rinstance=af2f6c3e9b721646' from AOR '1004' due to request

But still in the ps_contacts that data still exist.
Anybody can help ?

Can you post the contents of your /etc/asterisk/sorcery.conf file ?

There are settings in there for memory caching that you may want to adjust.

this my sorcery.conf file :

[res_pjsip]
endpoint=realtime,ps_endpoints
auth=realtime,ps_auths
aor=realtime,ps_aors
domain_alias=realtime,ps_domain_aliases
contact=realtime,ps_contacts

[res_pjsip_endpoint_identifier_ip]
identify=realtime,ps_endpoint_id_ips

[test_sorcery_section]
test=memory

[test_sorcery_cache]
test/cache=test
test=memory

This is log in asterisk cli if required :

Received SIP request (873 bytes) from UDP:192.168.100.52:34243
REGISTER sip:192.168.100.79;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 192.168.100.52:34243;branch=z9hG4bK-524287-1—1cc45b75b471ce30;rport
Max-Forwards: 70
Contact: sip:1003@192.168.100.52:34243;transport=UDP;rinstance=418c7c2c163368cf;expires=0
To: sip:1003@192.168.100.79;transport=UDP
From: sip:1003@192.168.100.79;transport=UDP;tag=1696060e
Call-ID: h5ZtH1g43eDYIXtTcj8PlA…
CSeq: 3 REGISTER
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
User-Agent: Zoiper rv2.10.3.0
Authorization: Digest username=“1003”,realm=“asterisk”,nonce=“1571653374/f902aeb25741d1efbf8d31d848fa5998”,uri=“sip:192.168.100.79;transport=UDP”,response=“fd56ec17547963ef19721cdfed7f760b”,cnonce=“213008975c9625a54b9f8ea3afc458ae”,nc=00000002,qop=auth,algorithm=md5,opaque=“2ea22d6c3d79aeb4”
Allow-Events: presence, kpml, talk
Content-Length: 0

Removed contact ‘sip:1003@192.168.100.52:34243;transport=UDP;rinstance=418c7c2c163368cf’ from AOR ‘1003’ due to request
Transmitting SIP response (392 bytes) to UDP:192.168.100.52:34243
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.100.52:34243;rport=34243;received=192.168.100.52;branch=z9hG4bK-524287-1—1cc45b75b471ce30
Call-ID: h5ZtH1g43eDYIXtTcj8PlA…
From: sip:1003@192.168.100.79;tag=1696060e
To: sip:1003@192.168.100.79;tag=z9hG4bK-524287-1—1cc45b75b471ce30
CSeq: 3 REGISTER
Date: Mon, 21 Oct 2019 10:23:20 GMT
Server: Asterisk PBX 16.5.0
Content-Length: 0

Sqlite3 isn’t something that has really been tested against realtime like that, so it may not be compatible in the way that we need to use it. You are in uncharted/untested territory.

1 Like

Depending on your other requirements, you might try changing that to:

contact=astdb,registrator

…then you’ll be using the internal Asterisk database (probably still sqlite ;–) to store contacts, same as stock installs.

thank for your answer. I decide to use mysql again as realtime database. I found out, that sqlite3 file too much complicated cause database locked when I running asterisk and my backend. Thank you very much for answered my question.