<p>Mod_lcr?</p>
<div class="gmail_quote">On Sep 23, 2012 6:01 PM, &quot;Stanislav Sinyagin&quot; &lt;<a href="mailto:ssinyagin@yahoo.com">ssinyagin@yahoo.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:10pt;font-family:arial,helvetica,sans-serif"><div><span>Basically your inbouind and outbound calls should go through the same sequence of checkups, and look for a local user number. Then outbound calls should resort in your PSTN trunk, and inbound calls resort in a 404 Not Found. Also I guess you want to charge your users the same rate regardless if it&#39;s on-net or off-net calls, so CDR need to be taken care of too.<br>
</span></div><div style="font-style:normal;font-size:10.65px;background-color:transparent;font-family:arial,helvetica,sans-serif"><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"> <hr size="1">  <b><span style="font-weight:bold">From:</span></b> Stanislav Sinyagin &lt;<a href="mailto:ssinyagin@yahoo.com" target="_blank">ssinyagin@yahoo.com</a>&gt;<br>
 <b><span style="font-weight:bold">To:</span></b> FreeSWITCH Users Help &lt;<a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a>&gt; <br> <b><span style="font-weight:bold">Sent:</span></b> Sunday, September 23, 2012 10:31 PM<br>
 <b><span style="font-weight:bold">Subject:</span></b> Re: [Freeswitch-users] Keeping local calls local<br> </font> </div> <br>
<div><div><div style="font-size:10pt;font-family:arial,helvetica,sans-serif"><div><span>well, that was only a hint, but not the whole solution :)</span></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:arial,helvetica,sans-serif">
<span>In your case, it would require some database lookup, or maybe the dialplan should go through the customer numbers before sending the call to PSTN. </span></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:arial,helvetica,sans-serif">
<span><br></span></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:arial,helvetica,sans-serif"><span>enum would be a good option instead of database lookup, as was already
 proposed on the list.</span></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:arial,helvetica,sans-serif"><br><span></span></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:arial,helvetica,sans-serif">
<span>In any case, this all requires a bit of engineering and design effort. <br></span></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:arial,helvetica,sans-serif"><br><span></span></div>
<div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:arial,helvetica,sans-serif"><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"> <hr size="1">  <b><span style="font-weight:bold">From:</span></b> D&#39;Arcy Cain &lt;darcy@Vex.Net&gt;<br>
 <b><span style="font-weight:bold">To:</span></b> FreeSWITCH Users Help &lt;<a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a>&gt; <br><b><span style="font-weight:bold">Cc:</span></b> Stanislav Sinyagin &lt;<a href="mailto:ssinyagin@yahoo.com" target="_blank">ssinyagin@yahoo.com</a>&gt; <br>
 <b><span style="font-weight:bold">Sent:</span></b> Sunday, September 23, 2012 10:04 PM<br> <b><span style="font-weight:bold">Subject:</span></b> Re: [Freeswitch-users] Keeping local calls local<br> </font> </div> <br>
On Sun, 23 Sep 2012 11:17:37 -0700 (PDT)<br>Stanislav Sinyagin &lt;<a rel="nofollow" href="mailto:ssinyagin@yahoo.com" target="_blank">ssinyagin@yahoo.com</a>&gt; wrote:<br><br>&gt; here&#39;s a piece of my dialplan in &quot;default&quot; context. It simply catches<br>
&gt; such calls and transfers them directly to the public context. The<br>&gt; public context matches local DID numbers and transfers them to<br>&gt; corresponding extensions in default context:<br>&gt; <br>&gt;     &lt;extension name=&quot;internal_did&quot;&gt;<br>
&gt;       &lt;condition field=&quot;destination_number&quot; expression=&quot;^($${default_did_prefix}\d+)$&quot;&gt;<br>&gt;         &lt;action application=&quot;transfer&quot; data=&quot;$1 XML public&quot;/&gt;<br>&gt;       &lt;/condition&gt;<br>
&gt;     &lt;/extension&gt;<br>&gt; <br>&gt; The &quot;default_did_prefix&quot; variable holds my DID
 number block. <br><br>Looks good
 but my problem is that I do not have a DID block.  Clients<br>are porting their numbers so they are all over the place.  My first<br>three numbers in the system are from three different area codes.  I<br>would need to include all of my numbers in the expression somehow.  Wit<br>
just three I can use &#39;|&#39; but that won&#39;t be practical when I have<br>hundreds or thousands.<br><br>-- <br>D&#39;Arcy J.M. Cain<br>System Administrator, Vex.Net<br><a href="http://www.Vex.Net/" target="_blank">http://www.Vex.Net/</a> IM:<a rel="nofollow" href="mailto:darcy@Vex.Net" target="_blank">darcy@Vex.Net</a><br>
<br><br> </div> </div> </blockquote></div>   </div></div></div><br>_________________________________________________________________________<br>Professional FreeSWITCH Consulting Services:<br><a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com/" target="_blank">http://www.freeswitchsolutions.com</a><br><br>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br><a href="http://www.cudatel.com/" target="_blank">http://www.cudatel.com</a><br>
<br>Official FreeSWITCH Sites<br><a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br><a href="http://wiki.freeswitch.org/" target="_blank">http://wiki.freeswitch.org</a><br><a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com</a><br>
<br>FreeSWITCH-users mailing list<br><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><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></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><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></blockquote></div>