[OpenSIPS-Users] how do you determine first registration of a device

Bogdan-Andrei Iancu bogdan at voice-system.ro
Sun Sep 27 10:33:53 CEST 2009


Hi Alex,

As said, from SIP point of view, a registrar cannot tell (in a reliable 
way) if a registration is a first registration or a re-registration. 
Simply there is no information to help with this. No hocus-pocus with 
deleting the previous registrations or unregister will not help.

BUT, the only thing you can use is that during a re-registration the 
callid may be preserved (and cseq increased), while during a fast 
reboot, the callid (in REGISTER) will be definitely a new one.

So, as you can see, you can make 100% distinction between the two cases, 
but you can identify a first registration (when a new callid is received 
from the client). So , if it is not a big issue that you may detect 
"supplementary" first-register events (like a re-register when the 
client simply decide to change the callid), you can use in 1.6 the new 
"callid" parameter on the "registered()" param:
          
http://www.opensips.org/html/docs/modules/devel/registrar.html#id271243

like:
       if (registered("location","$to","$ci")) { -> received callid is 
already registered -> not a first registration}


Regards,
Bogdan

Alex G wrote:
> this still does not solve the issue of a reboot that occurs in under 
> 60 seconds. if a phone does not unregister on reboot, the record 
> remains in the db for those 60 seconds. if it comes back up in under 
> 60 seconds, then to opensips it looks like a reregistration.
>
> is there someway to discern this scenario from the info in the 
> location table that is already there? maybe the callid or cseq or 
> something?
>
> On Sat, Sep 26, 2009 at 1:43 PM, Alex Balashov 
> <abalashov at evaristesys.com <mailto:abalashov at evaristesys.com>> wrote:
>
>     As Inaki said, what you're trying to achieve is a little ridiculous.
>
>     But, if you must do it, I recommend using a database capable of
>     advanced triggers and decent stored procedures (PostgreSQL) and using
>     usrloc and registrar with full database backing and no caching or
>     synchronisation (changes immediately reflected in database).  Then put
>     a trigger on your 'location' table.  Trying to do this from the route
>     script is silly.
>
>     Alex G wrote:
>
>     > I have a scenario where I'm trying to fire a script based on the
>     first
>     > registration of a device. In normal circumstances I can check the
>     > location table using registered() function and if there is an
>     entry i
>     > know it's not the first registration. My problem is when a phone
>     does a
>     > quick reboot., it sometimes comes back on line before the
>     phone's entry
>     > is removed from the location table. In this case, the above solution
>     > does not work.
>     >
>     > Can anyone provide advice on how to determine first registration
>     of a
>     > phone coming back online in another way?
>     >
>     >
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > Users mailing list
>     > Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>     --
>     Alex Balashov - Principal
>     Evariste Systems
>     Web     : http://www.evaristesys.com/
>     Tel     : (+1) (678) 954-0670
>     Direct  : (+1) (678) 954-0671
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   




More information about the Users mailing list