OnlineSolution Forum IndexOnlineSolution Forum Index
OnlineSolution
FAQ  FAQ   Search  Search   Memberlist  Memberlist   Usergroups  Usergroups   Register  Register  
Register::  Log in Log in to check your private messages


 Advertisement

Post new topic  Reply to topic
 [ VoIP ] FreeSWITCH Tutorial 6 - Handling Inbound Calls (Diplan XML) « View previous topic :: View next topic » 
Author Message
Paul
PostPosted: Mon Jul 26, 2010 11:51 pm    Post subject: FreeSWITCH Tutorial 6 - Handling Inbound Calls (Diplan XML) Reply with quote

Site Admin

Joined: 10 Dec 2007
Posts: 143
Location: New Zealand

In FreeSWITCH Tutorial 2, you've learnt how set internal extensions, its time to learn how to handle inbound calls.

In order to setup inbound dialplan XML files, firstly you'll need to set SIP Trunks to your SIP provider.

If you successfully registered to your SIP provider, its time to setup dialplans for inbound calls.


Firstly, lets start with very basic inbound dialplan, bridge call to extension 1000 when a call comes in.

Goto [FreeSWITH Path]/conf/dialplan/public and create a new XML file (Default_Inbound.xml in my case).

Code:
<extension name="Default_Inbound">
  <condition field='destination_number' expression='[SIP Number]'>
    <action application="bridge" data="sofia/internal/1000%${local_ip_v4}"/>
  </condition>
</extension>

The above dialplan will bridge any inbound calls to extension 1000.


Secondly, lets try stepping extensions, try extension 1000, 1001 then 1002 when a call comes in.

Goto [FreeSWITH Path]/conf/dialplan/public and create a new XML file (Default_Stepping.xml in my case).

Code:
<extension name="Default_Stepping">
  <condition field='destination_number' expression='[SIP Number]'>
    <action application="set" data="call_timeout=20"/>
    <action application="set" data="continue_on_fail=true"/>
    <action application="set" data="hangup_after_bridge=true"/>
    <action application="bridge" data="sofia/internal/1000%${local_ip_v4}"/>
    <action application="set" data="call_timeout=20"/>
    <action application="set" data="continue_on_fail=true"/>
    <action application="set" data="hangup_after_bridge=true"/>
    <action application="bridge" data="sofia/internal/1001%${local_ip_v4}"/>
    <action application="set" data="call_timeout=20"/>
    <action application="set" data="continue_on_fail=false"/>
    <action application="set" data="hangup_after_bridge=true"/>
    <action application="bridge" data="sofia/internal/1001%${local_ip_v4}"/>
  </condition>
</extension>

<action application="set" data="call_timeout=20"/> tells FreeSWITCH to try 20 seconds to ring,

<action application="set" data="continue_on_fail=true"/> tells FreeSWITCH to continue even if it cannot bridge to specified extension,

<action application="set" data="hangup_after_bridge=true"/> tells FreeSWITCH to hangup the call after bridge so it cannot try next steps.


Thirdly, lets try to ring multiple extensions, try all extension 1000, 1001 and 1002 when a call comes in.

Code:
<extension name="Default_Ring_All">
  <condition field='destination_number' expression='[SIP Number]'>
    <action application="bridge" data="sofia/internal/1000%${local_ip_v4},sofia/internal/1001%${local_ip_v4},sofia/internal/1002%${local_ip_v4}"/>
  </condition>
</extension>

As you can see above, you're able to ring multiple extensions at a time by using commas between the extensions.


Lastly, lets try to stepping to each extensions then ring all numbers.

Code:
<extension name="Default_Stepping_Then_Ring_All">
  <condition field='destination_number' expression='[SIP Number]'>
    <action application="set" data="call_timeout=20"/>
    <action application="set" data="continue_on_fail=true"/>
    <action application="set" data="hangup_after_bridge=true"/>
    <action application="bridge" data="sofia/internal/1000%${local_ip_v4}"/>
    <action application="set" data="call_timeout=20"/>
    <action application="set" data="continue_on_fail=true"/>
    <action application="set" data="hangup_after_bridge=true"/>
    <action application="bridge" data="sofia/internal/1001%${local_ip_v4}"/>
    <action application="set" data="call_timeout=20"/>
    <action application="set" data="continue_on_fail=false"/>
    <action application="set" data="hangup_after_bridge=true"/>
    <action application="bridge" data="sofia/internal/1001%${local_ip_v4}"/>
    <action application="bridge" data="sofia/internal/1000%${local_ip_v4},sofia/internal/1001%${local_ip_v4},sofia/internal/1002%${local_ip_v4}"/>
  </condition>
</extension>


Optionally you can forward it voicemail or call park after all of the steppers.

------------------------------------------------------------------------------------

FreeSWITCH Tutorials

- Tutorial 1 : Installation
- Tutorial 2 : Internal Extensions
- Tutorial 3 : Provider (SIP Trunk Registration)
- Tutorial 4 : NAT settings
- Tutorial 5 : fs_cli
- Tutorial 6 : Handling Inbound Calls
_________________
Paul KH Kim

http://www.onlinesolution.co.nz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

 Sponsor Link

Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



OnlineSolution - Since 2007
DAJ Glass (1.0.8) template by Dustin Baccetti
EQ graphic based off of a design from www.freeclipart.nu
Powered by phpBB © 2001, 2005 phpBB Group