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

Michael Collins msc at freeswitch.org
Wed May 9 04:41:25 MSD 2012


Thaddeus,

FYI, doing an API from the dialplan is a piece of cake:
http://wiki.freeswitch.org/wiki/Mod_commands#From_the_Dialplan

In your case put this line in your dialplan before you do the sofia_contact
check:
<action application="set" data="api_result=${sofia profile internal
check_sync}"/>

That should solve the problem of people wandering off and their SIP clients
not unregging. Give it a try and let us know how it works.

-MC

On Tue, May 8, 2012 at 8:11 AM, thaddeus at thogan.com <thaddeus at thogan.com>wrote:

>
> Thanks for the information, I have explored the sofia_contact option and
> it is promising, but I am unsure of how to make it work in my dialplan.
>
> I think I need to elaborate on the indended behavior some more. A user
> will have three possible routes by which they can be reached. Two SIP
> accounts and a POTS number. Each user has three routes but only two
> devices, a desk phone and a cell phone. The cell phone is a target of the
> POTS number and is also one of the SIP clients. I am afraid I did not
> mention the desk phone initially, and I apologize for my question being
> incomplete.
>
> Given this setup I want to select one of these two dialplans:
>
> 1. If SIP on cell phone is registered, ring <DESK SIP> && <CELL SIP>.
>
> 2. If SIP on cell is not registered, ring <DESK SIP> && <CELL POTS>
>
> sofia_contact looks promising, however it returns a string indicating that
> a user is registered long after they have become unavailable. Example: User
> walks out of building and cell phone loses the Wifi connection. The SIP
> client did not un-register, it just went away. I have found that "sofia
> check_sync" will check all registrations and correctly identify clients
> that have gone off the network as no longer being registered.
>
> However, I cannot figure out how to run sofia_check sync before testing
> the output of sofia_contact in my dialplan, any thoughts on how to do this?
> Or is there a better way to get my above listed call routing to occur based
> on the availability of a SIP client?
>
> Also, I did investigate using continue_on_fail to check for hangup causes
> that did involve the SIP client being unreachable, but I could not make the
> above logic occur using only that setting. That is, I always want to ring
> <DESK SIP>, but only one of <CELL POTS> or <CELL SIP>, and never both
> simultaneously or in sequence.
>
> Might I need to go into a Lua script for this kind of logic?
>
> Thanks again for your responses!
>
> -- Thaddeus
>
>
>
> On Friday, May 4, 2012 12:34 PM CDT, Michael Collins <msc at freeswitch.org>
> wrote:
>
>  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 **it is covered very nicely in the new FreeSWITCH
> Cookbook** 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 **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
> >
> >****
>
>
>
>
> _________________________________________________________________________
> 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/20120508/4983e2a9/attachment.html 


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