<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html><head><meta http-equiv="Content-Type" content="text/html;charset=us-ascii">
<style>BODY{font:10pt Tahoma, Verdana, sans-serif}</style></head><body>
<DIV>Thaddeus & Michael:</DIV>
<DIV> </DIV>
<DIV>As Michael stated there are many ways to fail over if a phone/user isn't registered. However sometimes you may want to actually check the registration yourself. Or even do something based on a contact being registered, that has nothing to do with the actual one you are calling.</DIV>
<DIV> </DIV>
<DIV>I normally use the API: sofia_contact([profile/]<user>@domain). It returns the channel string you would pass to bridge. If the user isn't registered it returns "error/<the error>" so it would use the logical "error" endpoint to handle the right treatment. If the regex "^error" match is true, then the user isn't registered. </DIV>
<DIV> </DIV>
<DIV>The extra thing you get from that API call is that you can use a "*" for the profile, and find out which SIP profile the user is registered in. For example in the case of an Android client, that may be using WIFI or 3G, and you have an external and internal profile they can register, you can tell if the user is "on site" or "off site" by the profile it returns, and can be more restrictive of the calls you send to someone when they're out of the office.</DIV>
<DIV> </DIV>
<DIV>--Dave</DIV><BR>
<BLOCKQUOTE style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<HR>
<B>From:</B> Michael Collins [mailto:msc@freeswitch.org]<BR><B>To:</B> FreeSWITCH Users Help [mailto:freeswitch-users@lists.freeswitch.org]<BR><B>Sent:</B> Fri, 04 May 2012 10:34:31 -0700<BR><B>Subject:</B> Re: [Freeswitch-users] Dialplan condition to test if SIP client is registered<BR><BR>Hi Thaddeus,<BR><BR>You definitely have several options here. While you could use the sofia_contact API, I'm wondering if perhaps you could let the dialplan and the bridge app do the work for you.<BR><BR>You could bridge directly to the Android user and then if it fails it could then continue in the dialplan and ring the mobile number. This is covered briefly on the <A href="http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_bridge#Implementing_Failover">wiki</A>, however <shameless_plug>it is covered very nicely in the new FreeSWITCH Cookbook</shameless_plug> in chapter 1.<BR><BR>Try out the basic failover (pipe-separated list of endpoints) and if that doesn't work let us know. Maybe you could hop on IRC and talk live with other community members. Of course, it can't hurt to raise your karma by getting the FreeSWITCH books. :) (See <A href="http://freeswitch.org/">freeswitch.org</A>, upper left corner.)<BR><BR>Thanks,<BR>Michael<BR><BR>
<DIV class=gmail_quote>On Fri, May 4, 2012 at 10:10 AM, <A href="mailto:thaddeus@thogan.com">thaddeus@thogan.com</A> <SPAN><<A href="mailto:thaddeus@thogan.com">thaddeus@thogan.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>I was wondering if there is a way to tell if a SIP client is registered with a dialplan condition? Or maybe a better way to accomplish the following?:<BR><BR>The users' cell phones (Android) are running a SIP client and connect to freeswitch via Wifi when in the office. I want calls destined for a given user to ring only their extension if they are connected via SIP, and ring only their mobile number when they are not connected.<BR><BR>Currently I just take every incoming call and bridge it back out to their mobile number, but 95% of the time these users are on the Wifi network, and I could just pass the call to their phones via SIP.<BR><BR>I have tested hunt groups but the callers hear ringing for far too long. Ring groups don't work because it is confusing when the user simultaneously receiving the same call via SIP and mobile on the same phone.<BR><BR>Thanks in advance for any insights and help!<SPAN class=HOEnZb><FONT color=#888888><BR><BR>-- Thaddeus </FONT></SPAN><BR>_________________________________________________________________________<BR>Professional FreeSWITCH Consulting Services:<BR><A href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</A><BR><A href="http://www.freeswitchsolutions.com/">http://www.freeswitchsolutions.com</A><BR><BR>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR><A href="http://www.cudatel.com/">http://www.cudatel.com</A><BR><BR>Official FreeSWITCH Sites<BR><A href="http://www.freeswitch.org/">http://www.freeswitch.org</A><BR><A href="http://wiki.freeswitch.org/">http://wiki.freeswitch.org</A><BR><A href="http://www.cluecon.com/">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">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A><BR>UNSUBSCRIBE:<A href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</A><BR><A href="http://www.freeswitch.org/">http://www.freeswitch.org</A><BR><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE>
<STYLE>
</STYLE>
<DIV> </DIV>
<DIV> </DIV></body></html>