ok I will test this method, this seems better than nothing at this point. Thanks Bogdon!<br><br><div class="gmail_quote">On Sun, Sep 27, 2009 at 4:33 AM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Alex,<br>
<br>
As said, from SIP point of view, a registrar cannot tell (in a reliable<br>
way) if a registration is a first registration or a re-registration.<br>
Simply there is no information to help with this. No hocus-pocus with<br>
deleting the previous registrations or unregister will not help.<br>
<br>
BUT, the only thing you can use is that during a re-registration the<br>
callid may be preserved (and cseq increased), while during a fast<br>
reboot, the callid (in REGISTER) will be definitely a new one.<br>
<br>
So, as you can see, you can make 100% distinction between the two cases,<br>
but you can identify a first registration (when a new callid is received<br>
from the client). So , if it is not a big issue that you may detect<br>
"supplementary" first-register events (like a re-register when the<br>
client simply decide to change the callid), you can use in 1.6 the new<br>
"callid" parameter on the "registered()" param:<br>
<br>
<a href="http://www.opensips.org/html/docs/modules/devel/registrar.html#id271243" target="_blank">http://www.opensips.org/html/docs/modules/devel/registrar.html#id271243</a><br>
<br>
like:<br>
if (registered("location","$to","$ci")) { -> received callid is<br>
already registered -> not a first registration}<br>
<br>
<br>
Regards,<br>
Bogdan<br>
<div class="im"><br>
Alex G wrote:<br>
> this still does not solve the issue of a reboot that occurs in under<br>
> 60 seconds. if a phone does not unregister on reboot, the record<br>
> remains in the db for those 60 seconds. if it comes back up in under<br>
> 60 seconds, then to opensips it looks like a reregistration.<br>
><br>
> is there someway to discern this scenario from the info in the<br>
> location table that is already there? maybe the callid or cseq or<br>
> something?<br>
><br>
> On Sat, Sep 26, 2009 at 1:43 PM, Alex Balashov<br>
</div><div><div></div><div class="h5">> <<a href="mailto:abalashov@evaristesys.com">abalashov@evaristesys.com</a> <mailto:<a href="mailto:abalashov@evaristesys.com">abalashov@evaristesys.com</a>>> wrote:<br>
><br>
> As Inaki said, what you're trying to achieve is a little ridiculous.<br>
><br>
> But, if you must do it, I recommend using a database capable of<br>
> advanced triggers and decent stored procedures (PostgreSQL) and using<br>
> usrloc and registrar with full database backing and no caching or<br>
> synchronisation (changes immediately reflected in database). Then put<br>
> a trigger on your 'location' table. Trying to do this from the route<br>
> script is silly.<br>
><br>
> Alex G wrote:<br>
><br>
> > I have a scenario where I'm trying to fire a script based on the<br>
> first<br>
> > registration of a device. In normal circumstances I can check the<br>
> > location table using registered() function and if there is an<br>
> entry i<br>
> > know it's not the first registration. My problem is when a phone<br>
> does a<br>
> > quick reboot., it sometimes comes back on line before the<br>
> phone's entry<br>
> > is removed from the location table. In this case, the above solution<br>
> > does not work.<br>
> ><br>
> > Can anyone provide advice on how to determine first registration<br>
> of a<br>
> > phone coming back online in another way?<br>
> ><br>
> ><br>
> ><br>
> ------------------------------------------------------------------------<br>
> ><br>
> > _______________________________________________<br>
> > Users mailing list<br>
</div></div>> > <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
<div class="im">> > <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
><br>
> --<br>
> Alex Balashov - Principal<br>
> Evariste Systems<br>
> Web : <a href="http://www.evaristesys.com/" target="_blank">http://www.evaristesys.com/</a><br>
> Tel : (+1) (678) 954-0670<br>
> Direct : (+1) (678) 954-0671<br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
</div>> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
<div><div></div><div class="h5">> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
><br>
> ------------------------------------------------------------------------<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>
><br>
<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>
</div></div></blockquote></div><br>