<div class="gmail_quote">On Wed, Apr 11, 2012 at 4:11 PM,  <span dir="ltr">&lt;<a href="mailto:lists65@gmail.com">lists65@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Here is an example.<u></u><u></u></span></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Let’s say that I want to send all calls to a context that would answer the call via voicemail.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Let’s say that I want to only right a SIP phone if calls cam from a particular Area Code (maybe the Area Codes in your state).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Let’s say that I would want to send calls from a particular A/C and certain NNX’s to a particular sales group.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Does that help define the purpose of directing calls *<b>from</b>* different Area Codes and NNX’s?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"></span></p></div></div></blockquote><div><br><br>You&#39;ve got a few ways you can do this:<br><br>1 - In the dialplan with ex-girlfriend logic.  You should be able to use patterns with your ex-girlfriend logic matches, as so:<br>
<br>exten =&gt; 15558675309/_255NXXXXXX,1,Verbose(Calls to 867-5309 from area code 255 end up here)<br>exten =&gt; 15558675309/_256123XXXX,1,Verbose(Calls to 867-5309 from phone numbers 256123XXXX end up here)<br><br>etc.  <br>
<br>2 - In the dialplan with GotoIf logic:<br><br>exten =&gt; 15558675309,1,Verbose(Call from ${CALLERID(num)} to 867-5309)<br>exten =&gt; 15558675309,n,GotoIf($[&quot;${CALLERID(num):1:3}&quot;=&quot;255&quot;]?areacode255)<br>
exten =&gt; 15558675309,n,GotoIf($[&quot;${CALLERID(num):1:6}&quot;=&quot;256123&quot;]?num256123)<br>exten =&gt; 15558675309,n(areacode255),Verbose(Calls to 867-5309 from area code 255 end up here)<br>exten =&gt; 15558675309,n(num256123),Verbose(Calls to 867-5309 from phone numbers 256123XXXX end up here)<br>
<br>etc.<br><br>3 - Outside the dialplan with an AGI that allows you many more conditional logic choices (plus keeps your dialplan nice and clean):<br><br>exten =&gt; 15558675309,1,Verbose(Call from ${CALLERID(num)} to 867-5309)<br>
 same =&gt; n,AGI(route_by_clid)<br><br>In your AGI, you&#39;ll be most interested in the agi_callerid environment variable and you can control where the call goes next using the SET CONTEXT and SET EXTENSION agi commands, or simply EXEC a GoTo command (either way works).<br>
<br>Ultimately, I would go with the AGI option, because that then allows you to do things like use a database to store your routing information, use case statements, create routing loops, etc.  It&#39;s up to you though.  <br>
</div></div><br>-- <br>Thanks,<br>--Warren Selby, dCAP<br><a href="http://www.selbytech.com" target="_blank">http://www.SelbyTech.com</a><br><br>