 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 |
|