Reading the source, FS will only periodically scan the database for expired registrations and fire the sofia::expire event then. The period between polling the database will cause a delay between the registration expiring and the event being raised.<div>
<br></div><div>The default is to check every 30s, but can be adjusted with the sofia profile param registration-thread-frequency. Remember lower values may raise the event sooner, but will increase load because you're checking the DB more often. Since the expiry is already going to be a certain amount after the device disappears a few seconds probably won't make much difference - 10s vs 30s may sometimes save up to 20s but if the expiry period was 30 minutes that's not going to be enough to care about since it may already have been offline for almost half an hour at that point.</div>
<div><br></div><div>The registration expiry time comes from the client, but you can override it from FS:</div><div><a href="http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files#sip-force-expires">http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files#sip-force-expires</a></div>
<div><br></div><div>-Steve</div><div><div><br></div><div><br><div class="gmail_quote">On 12 December 2012 19:47, Steven Ayre <span dir="ltr"><<a href="mailto:steveayre@gmail.com" target="_blank">steveayre@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You'll need to manage your expectations here.<div><br><div>SIP registrations start when the client sends a REGISTER, with an expiry time. They then periodically send additional REGISTERs to remain registered. They can be spread quite a long way apart - several minutes.</div>
<div><br></div><div>A client explicitly unregisters by sending a REGISTER with a 0 expiry time, ie the registration expires immediately.</div><div><br></div><div>If the client has gone offline because of reboot, network problem etc it won't send that final REGISTER. You won't see the client unregister until the end of the expiry time when the client hasn't renewed its registration.</div>
<div><br></div><div>Since that's several minutes later, there's no way to see that they have unregistered <i>immediately</i>. You may be able to reduce the expiry time to detect they're offline quicker, but that will increase bandwidth and load.</div>
<div><br></div><div><br></div><div><br></div><div>As for actually how to detect the unregistration... I suspect the 2 events you want to listen for are sofia::unregister and sofia::expire. The names suggest the 1st will be for an explicit unregister and the 2nd for when the client fails to reregister within the expiry time. That means the 2nd'll be the one you'd see if the client goes unexpectedly offline.</div>
<div><br></div><div><br></div><div>-Steve</div><div><br></div><div><br></div><div><br></div><div><br><div class="gmail_quote"><div><div class="h5">On 12 December 2012 17:52, 王理 <span dir="ltr"><<a href="mailto:itispip-qq@hotmail.com" target="_blank">itispip-qq@hotmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div><div dir="ltr">
Hi Freeswtich Master,<div><br></div><div>I'm in a situation where I need to proactively moniter whether some device/extension is on in my local network; If for some reason the devices are offline, I need to be noticed immediately so that I can restart the device;</div>
<div><br></div><div>Previously I use xlite client to suscribe to the presence notification of the devices, but recently added some devices which not supporting presence notification, so I want FreeSwitch to send an email notification when some user/extention are getting unregistered;</div>
<div><br></div><div>How can I capture a Feeswtich user unregister event & launch a LUA script then?</div><div><br></div><div>Happy days!</div><div><br></div><div>/Brgds, Alex</div>                                            </div></div>
<br></div></div>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div></div>