<div dir="ltr">Hi Alexandru,<br><br><div>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.</div><div><br>This is how you can catch this.</div><div><br></div><div><font face="monospace, monospace">if(is_method("REGISTER")  ) {</font></div><div><font face="monospace, monospace"> if($hdr(Expire) == 0) {</font></div><div><font face="monospace, monospace"> // Un-Registering User $fU</font></div><div><font face="monospace, monospace"> } else {<br> // Register request<br> } </font></div><div><font face="monospace, monospace">}</font></div><div><br></div><div>I'd say put it somewhere just before the save("lcoation"); line.</div><div><br></div><div>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.</div><div><br></div><div><br></div><div>Regards,</div><div>Sammy</div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 19, 2016 at 1:41 PM, Alexandru Covalschi <span dir="ltr"><<a href="mailto:568691@gmail.com" target="_blank">568691@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello list,<br><br>I need to send to an external API events when user is registrated and de-registrated.<br>As far as I understand standart behaviour is as follows:<br><br>If user is not registered, he sends REGISTER and he is registrated (I can catch that because I make the auth).<br>If user is registered and sends REGISTER he is de-register. <br>(Please correct me if I'm wrong.)<br>How can I catch that? <br>Can I use event_route[usrloc:contact-expired]?<br><br>Thanks in advance!<span class="HOEnZb"><font color="#888888"><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Alexandru Covalschi<br>ABRISS-Solutions<div>VoIP engineer and system administrator<br>tel: <a href="tel:%2B37367398493" value="+37367398493" target="_blank">+37367398493</a><br>web: <a href="http://abs-telecom.com/" target="_blank">http://abriss.solutions/</a></div></div></div></div></div>
</font></span></div>
<br>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>