Re: [OpenSIPS-Users] how do you determine first registration of a device
the answer to this problem is NO! there is no sure fire way to do this that will be 100% foolproof ! so my suggestion is... just give up and make your phones subscribe! They'll do it when they boot O_O On Mon, Sep 28, 2009 at 4:59 AM, Bogdan-Andrei Iancu bog...@voice-system.ro wrote: Alex, take care that the functionality I mentioned exists only in 1.6 (if you need a backport to 1.5 let me know). Regards, Bogdan Alex G wrote: ok I will test this method, this seems better than nothing at this point. Thanks Bogdon! On Sun, Sep 27, 2009 at 4:33 AM, Bogdan-Andrei Iancu bog...@voice-system.ro mailto:bog...@voice-system.ro wrote: 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 abalas...@evaristesys.com mailto:abalas...@evaristesys.com mailto:abalas...@evaristesys.com mailto:abalas...@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@lists.opensips.org mailto:Users@lists.opensips.org mailto:Users@lists.opensips.org mailto:Users@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@lists.opensips.org mailto:Users@lists.opensips.org mailto:Users@lists.opensips.org mailto:Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] how do you determine first registration of a device
Alex, take care that the functionality I mentioned exists only in 1.6 (if you need a backport to 1.5 let me know). Regards, Bogdan Alex G wrote: ok I will test this method, this seems better than nothing at this point. Thanks Bogdon! On Sun, Sep 27, 2009 at 4:33 AM, Bogdan-Andrei Iancu bog...@voice-system.ro mailto:bog...@voice-system.ro wrote: 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 abalas...@evaristesys.com mailto:abalas...@evaristesys.com mailto:abalas...@evaristesys.com mailto:abalas...@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@lists.opensips.org mailto:Users@lists.opensips.org mailto:Users@lists.opensips.org mailto:Users@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@lists.opensips.org mailto:Users@lists.opensips.org mailto:Users@lists.opensips.org mailto:Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org mailto:Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org mailto:Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] how do you determine first registration of a device
El Sábado, 26 de Septiembre de 2009, Alex G escribió: i have a 60 second expire on my location table, but some phones still will reboot in less time than that. especially soft phones like xlite. i need to know when this first registration is in order to trigger a script that send mwi notification if that device has new messages. none of my devices subscribe for it, therefore i have to send notifications to them. Why don't you send the NOTIFY to the AOR of the user rather than to the real location of it? Sending the NOTIFY to the AOR it will be received by all the devices registered for that AOR. What you are trying to achieve seems a bit dirty to me. There is no way to have full control on when a registered user is still online or not. -- Iñaki Baz Castillo i...@aliax.net ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] how do you determine first registration of a device
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 abalas...@evaristesys.com mailto:abalas...@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@lists.opensips.org mailto:Users@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@lists.opensips.org mailto:Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] how do you determine first registration of a device
ok I will test this method, this seems better than nothing at this point. Thanks Bogdon! On Sun, Sep 27, 2009 at 4:33 AM, Bogdan-Andrei Iancu bog...@voice-system.ro wrote: 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 abalas...@evaristesys.com mailto:abalas...@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@lists.opensips.org mailto:Users@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@lists.opensips.org mailto:Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] how do you determine first registration of a device
Hi Alex, Can anyone provide advice on how to determine first registration of a phone coming back online in another way? Depends on the phone I would say. From my point of view I would say, that is very hard to track, since some phones acts very strange in that case. Maybe short expire would help? Can you tell more about your setup? BR Uwe -- kiste lat: 54.322684, lon: 10.13586 ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] how do you determine first registration of a device
i have a 60 second expire on my location table, but some phones still will reboot in less time than that. especially soft phones like xlite. i need to know when this first registration is in order to trigger a script that send mwi notification if that device has new messages. none of my devices subscribe for it, therefore i have to send notifications to them. On Sat, Sep 26, 2009 at 3:44 AM, Uwe Kastens ki...@kiste.org wrote: Hi Alex, Can anyone provide advice on how to determine first registration of a phone coming back online in another way? Depends on the phone I would say. From my point of view I would say, that is very hard to track, since some phones acts very strange in that case. Maybe short expire would help? Can you tell more about your setup? BR Uwe -- kiste lat: 54.322684, lon: 10.13586 ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] how do you determine first registration of a device
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@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@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] how do you determine first registration of a device
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 abalas...@evaristesys.comwrote: 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@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@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] how do you determine first registration of a device
A new REGISTER request will certainly have a different Call-ID. However, I think the correct way to handle this is to just live with it. If the phone did not unregister, then it will be subject to the consequences of that, and it's okay. Kamailio 1.5.x's registrar module has a function called reg_free_contacts() which you could use if a save() fails due to a contact already existing in memory or database and then call save(). Perhaps OpenSIPS will implement something like this at some point. 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 abalas...@evaristesys.com mailto:abalas...@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@lists.opensips.org mailto:Users@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@lists.opensips.org mailto:Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users ___ Users mailing list Users@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@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Re: [OpenSIPS-Users] how do you determine first registration of a device
Alex Balashov wrote: A new REGISTER request will certainly have a different Call-ID. However, I think the correct way to handle this is to just live with it. If the phone did not unregister, then it will be subject to the consequences of that, and it's okay. Kamailio 1.5.x's registrar module has a function called reg_free_contacts() which you could use if a save() fails due to a contact already existing in memory or database and then call save(). Perhaps OpenSIPS will implement something like this at some point. It actually has an unregister() function as well. -- Alex Balashov - Principal Evariste Systems Web : http://www.evaristesys.com/ Tel : (+1) (678) 954-0670 Direct : (+1) (678) 954-0671 ___ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users
[OpenSIPS-Users] how do you determine first registration of a device
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@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users