Dialplan FollowMe
From FreeSWITCH Wiki
FollowMe Dialplan Example 1
The following example shows how a DID can bridge to multiple extensions or gateways sequentially in a hunt pattern. In Asterisk, this feature is called FollowMe. If none of the bridges are successful the caller is sent to voicemail.
I wanted each target number to have its own call_timeout value, which is why they are not contained in a single bridge action. This can be used to prevent your cellphone voicemail from answering the call, for example.
<!-- this is in public.xml. The number below is my DID ->>
<extension name="2531234567">
<condition field="destination_number" expression="2531234567">
<action application="set" data="hangup_after_bridge=true"/>
<action application="set" data="continue_on_fail=true"/>
<!-- this is needed to allow call_timeout to work after bridging to a gateway -->
<action application="set" data="ignore_early_media=true"/>
<!-- ring my desk extension for 10 seconds. -->
<action application="set" data="call_timeout=10"/>
<action application="bridge" data="sofia/$${domain}/1001"/>
<!-- Now try my cell phone, hangup before cellphone voicemail picks up. -->
<!-- Dial out through my voicepulse gateway -->
<action application="set" data="call_timeout=13"/>
<action application="bridge" data="sofia/gateway/voicepulse/16501234567" />
<!-- No answer, transfer to voicemail -->
<action application="answer"/>
<action application="sleep" data="1000"/>
<action application="voicemail" data="default $${domain} 1001"/>
</condition>
</extension>
FollowMe Dialplan Example 2
The following example shows how to call multiple targets at the same time. It first tries my VoIP phones/extensions for just a few seconds, and then tries those same extensions again with my cell involved. Using the bind_meta_app it is possible for me to transfer the call once it arrives at any of those extensions, or when it arrives on my cell. You can also start recording a call at any time, and more. See Misc. Dialplan Tools bind meta app for more information.
If you don't have Cepstral installed, you will probably want to comment out the "speak" and "sleep" action lines. I find it better to tell the caller that they're being transferred to an outside line when branching to my cell, otherwise they may get impatient and hang up. See Session speak for more information on Cepstral and how to use it in Freeswitch.
<!-- in dialplan/public.xml -->
<extension name="KJV">
<condition field="destination_number" expression="^(0)$">
<!-- Make sure the caller hears ringing if we're ringing a phone and we already answered -->
<action application="set" data="transfer_ringback=${us-ring}"/>
<!-- This was added some time ago, not sure if it's still needed -->
<action application="ring_ready"/>
<!-- Hanging up after the bridge is generally a good idea -->
<action application="set" data="hangup_after_bridge=true"/>
<!-- Now that we're not dealing with VoicePulse let's see if things are sane again -->
<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/>
<!-- Voicepulse workaround - Seems they always answer regardless of whether or not they managed to place the call. -->
<!--<action application="set" data="continue_on_fail=true"/>-->
<!-- For the first try, let's set the call timeout to 12 seconds-->
<action application="set" data="call_timeout=12"/>
<!-- Add in some features that help make freeswitch exceptionally versatile -->
<action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
<action application="bind_meta_app" data="2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
<action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
<!-- Now we try the VoIP phones only. -->
<action application="bridge" data="{ignore_early_media=true}user/7001@$${domain},user/7010@$${domain},user/7022@$${domain},user/7007@$${domain}"/>
<!-- Now we will try all VoIP phones, AND the cell phone -->
<!-- Subsequently we want the timer a little longer than 12 seconds -->
<!-- If you don't want it to hit your cell or work voice mail try a lower setting than 60 seconds below-->
<action application="set" data="call_timeout=60"/>
<!-- Make sure we have Allison tell the caller what's happening so they don't get impatient and hang up while I'm out driving around -->
<action application="speak" data="cepstral|allison|outside transfer"/>
<action application="sleep" data="1000"/>
<!-- This next line may not be necessary -->
<action application="ring_ready"/>
<!-- Perform the bridge to all VoIP and Cell -->
<action application="bridge" data="{ignore_early_media=true}user/7001@$${domain},user/7010@$${domain},user/7022@$${domain},user/7007@$${domain},sofia/gateway/flowroute/12345678901"/>
<!-- You can put other stuff here, but I happen to like iPhone voice mail -->
</condition>
</extension>
