Hi,We've noticed a case where the location_attrs table isn't updated when there's an unexpected shutdown of a SIP device (here there'll be no REGISTER message sent with expires=0).We're using Kamailio v4.3.xWhen the SIP device shuts down ungracefully. The location table is updated using DELETE queryThis is done by the timer which deletes the expired contacts, by default the timer_interval is set as 60.Here, the logs of auto-removal of expired contacts entries by the timer
Feb 17 17:16:13 localhost kamailio[23273]: DEBUG: db_postgres [km_dbase.c:272]: db_postgres_submit_query(): sending query ok: 0x7f34969433c8 (1) - [delete from location where expires<'2017-02-17 17:16:14' AND expires<>'1970-01-01 00:00:00']Feb 17 17:16:14 localhost kamailio[23272]: DEBUG: db_postgres [km_dbase.c:272]: db_postgres_submit_query(): sending query ok: 0x7f34969433c8 (1) - [delete from location where expires<'2017-02-17 17:16:15' AND expires<>'1970-01-01 00:00:00']The delete operation is only on location table, shouldn't we have the same implementation on the location_attrs table based upon ruid or username?We're getting duplicate entries in the location_attrs table of the same sip user after it registers.But when the SIP device un-registers, the entries in the location as well as in the location_attrs table is deletedFeb 17 18:14:32 localhost kamailio[23249]: DEBUG: usrloc [ucontact.c:1725]: uldb_delete_attrs(): trying to delete location attributes
Feb 17 18:14:32 localhost kamailio[23249]: DEBUG: db_postgres [km_dbase.c:272]: db_postgres_submit_query(): sending query ok: 0x7f3496941888 (1) - [delete from location_attrs where username='mridul' AND ruid='uloc-58a72243-5ace-2']Feb 17 18:14:32 localhost kamailio[23249]: DEBUG: db_postgres [km_dbase.c:272]: db_postgres_submit_query(): sending query ok: 0x7f3496941888 (1) - [delete from location where username='mridul' AND contact='sip:mridul@127.0.0.1:37881;rinstance=b841a8c916e47d fa'] I think the usrloc module should have the implementation of deleting the entries of expired sip users based on its ruid/username in the location_attrs table also.Thanks for the help.Best regards,MRIDUL