From: D'Arcy Cain <darcy@Vex.Net>
To: FreeSWITCH-users@lists.freeswitch.org
Sent: Sunday,
September 23, 2012 5:01 PM
Subject: [Freeswitch-users] Keeping local calls local
The first thing I found with the basic setup of FreeSWITCH was that
calls between my own clients still went to my provider. This seemed
like a waste to me. To handle calls coming in I generate an XML file
called dialplan/public/00_Local.xml. Here is an example entry from it.
<extension name="Local_4164251212">
<condition field="destination_number" expression="^(4164251212)$">
<action application="export" data="dialed_extension=$1"/>
<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::$${recordings_dir}/${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"/>
<action application="bind_meta_app" data="4 b s
execute_extension::att_xfer XML features"/>
<action application="set" data="ringback=${us-ring}"/>
<action application="set" data="transfer_ringback=$${hold_music}"/>
<action application="set" data="call_timeout=30"/>
<action application="set" data="hangup_after_bridge=true"/>
<action application="set" data="continue_on_fail=true"/>
<action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
<action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
<action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>
<action application="hash"
data="insert/${domain_name}-last_dial_ext/${called_party_callgroup}/${uuid}"/>
<action application="hash" data="insert/${domain_name}-last_dial_ext/global/${uuid}"/>
<action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>
<action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
<action application="answer"/>
<action application="sleep" data="1000"/>
<action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_extension}"/>
</condition>
</extension>
I am still trying to figure out exactly what everything in there does
but it seems to do the job. Calls originating outside get delivered to
the correct client's phone. Calls between clients go out to the
provider and then
come back in as if it was external.
I worked around this by symlinking this file to the dialplan/default
directory. This works but I wonder if this is the best way to
accomplish this.
Side question, can I create a simple alias for all of my DIDs and make
one condition that tests that alias somehow?
Cheers.
--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:
darcy@Vex.Net_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.orghttp://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com
Official FreeSWITCH
Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:
http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.freeswitch.org