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