Hi Uwe,<div>This will not work well if i use db_mode as 2 in the usrloc module.</div><div>db_mode 1 does lot of DB queries !!!</div><div><br></div><div>--- Jay<br><br><div class="gmail_quote">On Wed, Jun 17, 2009 at 4:33 PM, Uwe Kastens <span dir="ltr"><<a href="mailto:kiste@kiste.org">kiste@kiste.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
You could solve this by working with AVP and sql. The idea could be:<br>
<br>
if (method=="REGISTER"){<br>
Authentication goes here<br>
$avp(s:user)=$aU;<br>
avp_db_query("select count() from location where<br>
username='$avp(s:user)'","var(x)");<br>
<br>
if var(x) > 0 {<br>
avp_db_query("delete from location where username='$avp(s:user)'");<br>
}<br>
<br>
save("location");<br>
Untested!<br>
<br>
BR<br>
<br>
Uwe<br>
Jayesh Nambiar schrieb:<br>
<div><div></div><div class="h5">> Hi All,<br>
> I had a requirement of allowing only one registration per user in a<br>
> particular scenario. I did not want to use the max_contacts parameter of<br>
> registrar module as it wont work right !!! The drawback was:<br>
> If device A had registered successfully and for some reason got<br>
> disconnected from the internet, the device won't unregister itself.<br>
> Opensips still has the record in the location table for that device, now<br>
> if the internet comes back and when the device tries to register again,<br>
> opensips will not allow since it already has the record in the location.<br>
> The device will have to wait until the earlier registration expires in<br>
> the opensips.<br>
> The idea was to have a way of updating the location table if same user<br>
> is trying to REGISTER from same location or different location. Meaning<br>
> if user A is registered from location A and someone else using same<br>
> credentials of user A tries to register from location B, the location<br>
> table should only update the earlier record to location B and not keep<br>
> location A and location B both for user A.<br>
><br>
> Is there a way to do this. Any help will be highly appreciiated.<br>
><br>
> Thanks in advance.<br>
><br>
> --- Jay<br>
><br>
><br>
</div></div>> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<font color="#888888"><br>
<br>
--<br>
<br>
kiste lat: 54.322684, lon: 10.13586<br>
</font></blockquote></div><br></div>