<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hi,<div><br></div><div>We've noticed a case where the <b>location_attrs</b> 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). </div><div><br></div><div>We're using Kamailio v4.3.x</div><div><br></div><div>When the SIP device shuts down ungracefully. The location table is updated using DELETE query</div><div>This is done by the timer which deletes the expired contacts, by default the timer_interval is set as 60.</div><div><br></div><div>Here, the logs of auto-removal of expired contacts entries by the timer</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>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']<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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'] </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> </blockquote><div><br></div><div>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?</div><div><br></div><div>We're getting duplicate entries in the location_attrs table of the same sip user after it registers.</div><div><br></div><div>But when the SIP device un-registers, the entries in the location as well as in the location_attrs table is deleted</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Feb 17 18:14:32 localhost kamailio[23249]: DEBUG: usrloc [ucontact.c:1725]: uldb_delete_attrs(): trying to delete location attributes<br>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']<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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='<a href="mailto:sip%3Amridul@127.0.0.1">sip:mridul@127.0.0.1</a>:<wbr>37881;rinstance=<wbr>b841a8c916e47dfa']</blockquote><div><br></div><div><br></div><div>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.</div><div><br></div><div>Thanks for the help.</div><div><br clear="all"><div><div class="m_4978146786914061378gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-family:arial;font-size:12px">Best regards,</span></div>MRIDUL</div></div></div></div></div></div></div></div></div></div>
</div></div>
</div><br></div>