<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt">here's a piece of my dialplan in "default" context. It simply catches such calls and transfers them directly to the public context. The public context matches local DID numbers and transfers them to corresponding extensions in default context:<br><br>&nbsp;&nbsp;&nbsp; &lt;extension name="internal_did"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;condition field="destination_number" expression="^($${default_did_prefix}\d+)$"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;action application="transfer" data="$1 XML public"/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/condition&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/extension&gt;<br><div><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;">The "default_did_prefix" variable holds my
 DID number block. <br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: arial,helvetica,sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> D'Arcy Cain &lt;darcy@Vex.Net&gt;<br> <b><span style="font-weight: bold;">To:</span></b> FreeSWITCH-users@lists.freeswitch.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Sunday,
 September 23, 2012 5:01 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> [Freeswitch-users] Keeping local calls local<br> </font> </div> <br>
The first thing I found with the basic setup of FreeSWITCH was that<br>calls between my own clients still went to my provider.&nbsp; This seemed<br>like a waste to me.&nbsp; To handle calls coming in I generate an XML file<br>called dialplan/public/00_Local.xml.&nbsp; Here is an example entry from it.<br><br>&lt;extension name="Local_4164251212"&gt;<br>&nbsp; &lt;condition field="destination_number" expression="^(4164251212)$"&gt;<br>&nbsp; &nbsp; &lt;action application="export" data="dialed_extension=$1"/&gt;<br>&nbsp; &nbsp; &lt;action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/&gt;<br>&nbsp; &nbsp; &lt;action application="bind_meta_app" data="2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/&gt;<br>&nbsp; &nbsp; &lt;action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/&gt;<br>&nbsp; &nbsp; &lt;action application="bind_meta_app" data="4 b s
 execute_extension::att_xfer XML features"/&gt;<br>&nbsp; &nbsp; &lt;action application="set" data="ringback=${us-ring}"/&gt;<br>&nbsp; &nbsp; &lt;action application="set" data="transfer_ringback=$${hold_music}"/&gt;<br>&nbsp; &nbsp; &lt;action application="set" data="call_timeout=30"/&gt;<br>&nbsp; &nbsp; &lt;action application="set" data="hangup_after_bridge=true"/&gt;<br>&nbsp; &nbsp; &lt;action application="set" data="continue_on_fail=true"/&gt;<br>&nbsp; &nbsp; &lt;action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/&gt;<br>&nbsp; &nbsp; &lt;action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/&gt;<br>&nbsp; &nbsp; &lt;action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/&gt;<br>&nbsp; &nbsp; &lt;action application="hash"
 data="insert/${domain_name}-last_dial_ext/${called_party_callgroup}/${uuid}"/&gt;<br>&nbsp; &nbsp; &lt;action application="hash" data="insert/${domain_name}-last_dial_ext/global/${uuid}"/&gt;<br>&nbsp; &nbsp; &lt;action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/&gt;<br>&nbsp; &nbsp; &lt;action application="bridge" data="user/${dialed_extension}@${domain_name}"/&gt;<br>&nbsp; &nbsp; &lt;action application="answer"/&gt;<br>&nbsp; &nbsp; &lt;action application="sleep" data="1000"/&gt;<br>&nbsp; &nbsp; &lt;action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_extension}"/&gt;<br>&nbsp; &lt;/condition&gt;<br>&lt;/extension&gt;<br><br>I am still trying to figure out exactly what everything in there does<br>but it seems to do the job.&nbsp; Calls originating outside get delivered to<br>the correct client's phone.&nbsp; Calls between clients go out to the<br>provider and then
 come back in as if it was external.<br><br>I worked around this by symlinking this file to the dialplan/default<br>directory.&nbsp; This works but I wonder if this is the best way to<br>accomplish this.<br><br>Side question, can I create a simple alias for all of my DIDs and make<br>one condition that tests that alias somehow?<br><br>Cheers.<br><br>-- <br>D'Arcy J.M. Cain<br>System Administrator, Vex.Net<br>http://www.Vex.Net/ IM:<a ymailto="mailto:darcy@Vex.Net" href="mailto:darcy@Vex.Net">darcy@Vex.Net</a><br><br>_________________________________________________________________________<br>Professional FreeSWITCH Consulting Services:<br><a ymailto="mailto:consulting@freeswitch.org" href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>http://www.freeswitchsolutions.com<br><br>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>http://www.cudatel.com<br><br>Official FreeSWITCH
 Sites<br>http://www.freeswitch.org<br>http://wiki.freeswitch.org<br>http://www.cluecon.com<br><br>FreeSWITCH-users mailing list<br><a ymailto="mailto:FreeSWITCH-users@lists.freeswitch.org" href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br><br><br> </div> </div> </blockquote></div>   </div></body></html>