<div dir="ltr">Thanks for the reply, Daniel. <div>We're using db_mode: 3</div><div><br></div><div>modparam("usrloc", "db_mode", 3)<br></div><div><br></div><div>Please let me know if you need more information.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><span style="font-family:Arial;font-size:12px">Best regards,</span></div><div><span style="font-family:Arial;font-size:12px"><br></span></div><div dir="ltr"><span style="font-family:Arial;font-size:12px"><b>MRIDUL</b> | SOFTWARE ENGINEER</span><br style="font-family:Arial;font-size:12px"><span style="font-family:Arial;font-size:12px">Plivo, Inc. 340 Pine St, San Francisco - 94104, USA</span><br style="font-family:Arial;font-size:12px"><span style="font-family:Arial;font-size:12px">Web: </span><a href="http://www.plivo.com/" rel="noreferrer" style="color:rgb(17,85,204);font-family:Arial;font-size:12px" target="_blank">www.plivo.com</a><span style="font-family:Arial;font-size:12px"> | Twitter: @plivo</span></div></div><div dir="ltr"><span style="font-family:Arial;font-size:12px"><br></span></div><a href="http://zentrunk.plivo.com/?utm=emailsig" target="_blank">Signup for Zentrunk - Plivo's SIP Trunking service</a></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Mon, Feb 20, 2017 at 2:47 PM, Mridul B <span dir="ltr"><<a href="mailto:mridul@plivo.com" target="_blank">mridul@plivo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><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" target="_blank">sip:mridul@127.0.0.1</a>:<wbr>37881;rinstance=b841a8c916e47d<wbr>fa']</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_6970246366418684508m_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>
</div></div></blockquote></div><br></div>