Hello list,
I need to send to an external API events when user is registrated and de-registrated. As far as I understand standart behaviour is as follows:
If user is not registered, he sends REGISTER and he is registrated (I can catch that because I make the auth). If user is registered and sends REGISTER he is de-register. (Please correct me if I'm wrong.) How can I catch that? Can I use event_route[usrloc:contact-expired]?
Thanks in advance!
Hi Alexandru,
The Expire header in Register can be your clue here. if it is greater than 0 means its a registration attempt. If the value is 0 then it is un-register request.
This is how you can catch this.
if(is_method("REGISTER") ) { if($hdr(Expire) == 0) { // Un-Registering User $fU } else { // Register request } }
I'd say put it somewhere just before the save("lcoation"); line.
The event for contact-expired will work for a user when its expires timer exceeds and there is no registration refresh from the device and hence Kamailio removes the contact from usrloc records.
Regards, Sammy
On Sun, Jun 19, 2016 at 1:41 PM, Alexandru Covalschi 568691@gmail.com wrote:
Hello list,
I need to send to an external API events when user is registrated and de-registrated. As far as I understand standart behaviour is as follows:
If user is not registered, he sends REGISTER and he is registrated (I can catch that because I make the auth). If user is registered and sends REGISTER he is de-register. (Please correct me if I'm wrong.) How can I catch that? Can I use event_route[usrloc:contact-expired]?
Thanks in advance!
-- Alexandru Covalschi ABRISS-Solutions VoIP engineer and system administrator tel: +37367398493 web: http://abriss.solutions/ http://abs-telecom.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hello,
$expires(min) can be used to see if there is an unregistration going on:
- https://www.kamailio.org/wiki/cookbooks/4.4.x/pseudovariables#expires_key_-_...
It is more safe to use this variable because expire value can be either as Expires header or as parameter in Contact header.
Cheers, Daniel
On 19/06/16 20:31, SamyGo wrote:
Hi Alexandru,
The Expire header in Register can be your clue here. if it is greater than 0 means its a registration attempt. If the value is 0 then it is un-register request.
This is how you can catch this.
if(is_method("REGISTER") ) { if($hdr(Expire) == 0) { // Un-Registering User $fU } else { // Register request } }
I'd say put it somewhere just before the save("lcoation"); line.
The event for contact-expired will work for a user when its expires timer exceeds and there is no registration refresh from the device and hence Kamailio removes the contact from usrloc records.
Regards, Sammy
On Sun, Jun 19, 2016 at 1:41 PM, Alexandru Covalschi <568691@gmail.com mailto:568691@gmail.com> wrote:
Hello list, I need to send to an external API events when user is registrated and de-registrated. As far as I understand standart behaviour is as follows: If user is not registered, he sends REGISTER and he is registrated (I can catch that because I make the auth). If user is registered and sends REGISTER he is de-register. (Please correct me if I'm wrong.) How can I catch that? Can I use event_route[usrloc:contact-expired]? Thanks in advance! -- Alexandru Covalschi ABRISS-Solutions VoIP engineer and system administrator tel: +37367398493 <tel:%2B37367398493> web: http://abriss.solutions/ <http://abs-telecom.com/> _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hello,
On 19/06/16 19:41, Alexandru Covalschi wrote:
Hello list,
I need to send to an external API events when user is registrated and de-registrated. As far as I understand standart behaviour is as follows:
If user is not registered, he sends REGISTER and he is registrated (I can catch that because I make the auth). If user is registered and sends REGISTER he is de-register.
This is not always a de-registration. If the expires value in the new REGISTER is >0, then it is an update of the registration (or re-registration). Only if expires==0, then it is a de-registration.
Cheers, Daniel
(Please correct me if I'm wrong.) How can I catch that? Can I use event_route[usrloc:contact-expired]?
Thanks in advance!
-- Alexandru Covalschi ABRISS-Solutions VoIP engineer and system administrator tel: +37367398493 web: http://abriss.solutions/ http://abs-telecom.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Thanks for the info guys, I've fixed my config to suit the correct logic. Thanks again!
2016-06-23 8:40 GMT+03:00 Daniel-Constantin Mierla miconda@gmail.com:
Hello,
On 19/06/16 19:41, Alexandru Covalschi wrote:
Hello list,
I need to send to an external API events when user is registrated and de-registrated. As far as I understand standart behaviour is as follows:
If user is not registered, he sends REGISTER and he is registrated (I can catch that because I make the auth). If user is registered and sends REGISTER he is de-register.
This is not always a de-registration. If the expires value in the new REGISTER is >0, then it is an update of the registration (or re-registration). Only if expires==0, then it is a de-registration.
Cheers, Daniel
(Please correct me if I'm wrong.) How can I catch that? Can I use event_route[usrloc:contact-expired]?
Thanks in advance!
-- Alexandru Covalschi ABRISS-Solutions VoIP engineer and system administrator tel: +37367398493 web: http://abriss.solutions/ http://abs-telecom.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierlahttp://www.asipto.com - http://www.kamailio.orghttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users