Sofia's gateways achieve this by doing a SIP OPTIONS ping. Gateway is marked as down if several timeout or return errors in a row (1 on its own isn't enough as it's a single UDP packet - you don't want to mark it as down if a single packet is lost).<div>
<br></div><div>That's only for outbound registrations though, AFAIK FS cannot do the same for inbound registrations. Though it could, in theory.</div><div><br></div><div>The time to detect they're offline will still not be immediate though - you need to periodically do the OPTIONS ping and have several fail before marking it as unregistered - so it'd still be say half a minute before FS saw it had gone.</div>
<div><br></div><div>-Steve</div><div><br></div><div><br></div><div><br><br><div class="gmail_quote">On 12 December 2012 20:43, Sean Devoy <span dir="ltr"><<a href="mailto:sdevoy@bizfocused.com" target="_blank">sdevoy@bizfocused.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I have looked into this a few times, sip messaging does not lend itself well to detecting a missing client – until you actually try to reach it! I have pondered some kind of a SIP message to use like an IP “ping”, but I have nothing yet. Maybe someone who actually knows “sip messaging” could suggest an innocuous sip message to send as a means of testing availability.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">In the meantime, my best suggestion is a DIALPLAN that has some redundancy for failed bridge connections. That is if the initial bridge fails (continue on fail), send yourself an email indicating that EXT is DOWN and redirect the call with another bridge statement. It is Reactive rather than Proactive, but it is very simple to setup and extremely reliable. You can even include playing a message like “There is a problem reaching that extension, please hold while we redirect your call.”<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hope that helps.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Sean<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b>On Behalf Of </b>Avi Marcus<br>
<b>Sent:</b> Wednesday, December 12, 2012 3:13 PM<br><b>To:</b> FreeSWITCH Users Help<br><b>Subject:</b> Re: [Freeswitch-users] Email notification when user unregistered?<u></u><u></u></span></p><div><div class="h5"><p class="MsoNormal">
<u></u> <u></u></p><div><p class="MsoNormal">That expiry event is something to watch.<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Also, you might want to monitor your CDRs if a call to a registered device doesn't respond:<u></u><u></u></p>
</div><div><p class="MsoNormal">if variables->progress_mediamsec + variables->progressmsec = 0, then that means the remote destination never sent a progress media. Although, that seems to also occur if it replies with a "user_busy" so I haven't fully nailed this one down yet. Let me know if you figure that one out.<u></u><u></u></p>
</div><div><p class="MsoNormal"><br clear="all"><u></u><u></u></p><div><div><p class="MsoNormal"><span style="font-family:"Verdana","sans-serif"">-Avi</span><u></u><u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12.0pt">
<u></u> <u></u></p><div><p class="MsoNormal">On Wed, Dec 12, 2012 at 9:55 PM, Steven Ayre <<a href="mailto:steveayre@gmail.com" target="_blank">steveayre@gmail.com</a>> wrote:<u></u><u></u></p><p class="MsoNormal">
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.<u></u><u></u></p>
<div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">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.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">The registration expiry time comes from the client, but you can override it from FS:<u></u><u></u></p></div><div><p class="MsoNormal"><a href="http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files#sip-force-expires" target="_blank">http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files#sip-force-expires</a><u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">-Steve<u></u><u></u></p></div><div><div><div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p>
<div><p class="MsoNormal">On 12 December 2012 19:47, Steven Ayre <<a href="mailto:steveayre@gmail.com" target="_blank">steveayre@gmail.com</a>> wrote:<u></u><u></u></p><p class="MsoNormal">You'll need to manage your expectations here.<u></u><u></u></p>
<div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">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.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">A client explicitly unregisters by sending a REGISTER with a 0 expiry time, ie the registration expires immediately.<u></u><u></u></p></div>
<div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">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.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">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.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">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.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">-Steve<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div>
<p class="MsoNormal">
<u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p><div><div><div><p class="MsoNormal">On 12 December 2012 17:52, <span style="font-family:"MS Gothic"">王理</span> <<a href="mailto:itispip-qq@hotmail.com" target="_blank">itispip-qq@hotmail.com</a>> wrote:<u></u><u></u></p>
</div></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in"><div><div><div><div><p class="MsoNormal">Hi Freeswtich Master,<u></u><u></u></p><div>
<p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">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;<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">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;<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">How can I capture a Feeswtich user unregister event & launch a LUA script then?<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p>
</div><div><p class="MsoNormal">Happy days!<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">/Brgds, Alex<u></u><u></u></p></div></div></div><p class="MsoNormal"><u></u> <u></u></p>
</div></div><p class="MsoNormal" style="margin-bottom:12.0pt">_________________________________________________________________________<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><u></u><u></u></p>
</blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>_________________________________________________________________________<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><u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">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">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>