[Freeswitch-users] Dialplan condition to test if SIP client is registered

Dave R. Kompel drk at drkngs.net
Fri May 4 22:24:45 MSD 2012


Thaddeus & Michael:  
   
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.  
   
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.   
   
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.  
   
--Dave
      _____  

  From: Michael Collins [mailto:msc at freeswitch.org]
To: FreeSWITCH Users Help [mailto:freeswitch-users at lists.freeswitch.org]
Sent: Fri, 04 May 2012 10:34:31 -0700
Subject: Re: [Freeswitch-users] Dialplan condition to test if SIP client is registered

Hi Thaddeus,

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.

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 wiki, however <shameless_plug>it is covered very nicely in the new FreeSWITCH Cookbook</shameless_plug> in chapter 1.

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 freeswitch.org, upper left corner.)

Thanks,
Michael

  
On Fri, May 4, 2012 at 10:10 AM, thaddeus at thogan.com <thaddeus at thogan.com> wrote:
  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?:

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.

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.

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.

Thanks in advance for any insights and help!

-- Thaddeus 
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org


      
   
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120504/ecf7126e/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list