<div dir="ltr">Ha, that was a tricky one!<div><br></div><div>Here&#39;s the issue - he dialed: <span style="font-family:arial,sans-serif;background-color:rgb(255,255,255)">1-800-336-940 -- that&#39;s too few digits!</span></div>

<div><span style="font-family:arial,sans-serif;background-color:rgb(255,255,255)">So your optional one made it match anyway.</span></div><div><span style="font-family:arial,sans-serif;background-color:rgb(255,255,255)"><br>

</span></div><div><span style="font-family:arial,sans-serif;background-color:rgb(255,255,255)">Your matching is too allowing - here&#39;s the regex I use:</span></div><div><span style="font-family:arial,sans-serif;background-color:rgb(255,255,255)"><br>

</span></div><div><font face="arial, sans-serif">^(?:1|\+1|001)?([2-9]\d\d[2-9]\d{6})$</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">That matches [nothing, 1, +1 or 001] prefix for USA. Then, bridge like now to &quot;1$1&quot;.</font></div>

<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">btw, if you want a separate match for USA toll-free it&#39;s: </font><span style="font-family:arial,sans-serif">^(?:1|\+1|001)?</span><font face="arial, sans-serif">(8(00|55|66|77|88)[2-9]\d{6})$</font></div>

<div><br></div><div>There&#39;s also some good example on this page, the link goes directly to USA: <a href="http://wiki.freeswitch.org/wiki/Regular_Expression#NANPA_.2B1NxxNxxXXXX_E.164_Dialstring">http://wiki.freeswitch.org/wiki/Regular_Expression#NANPA_.2B1NxxNxxXXXX_E.164_Dialstring</a></div>

<div><br clear="all"><div><div dir="ltr"><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small">-Avi Marcus</span><br>BestFone</div></div><br><div class="gmail_quote">On Wed, Jan 9, 2013 at 9:48 PM, Sean Devoy <span dir="ltr">&lt;<a href="mailto:sdevoy@bizfocused.com" target="_blank">sdevoy@bizfocused.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 lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal">HI,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p>

<p class="MsoNormal">I really hope this question is not as dumb as some of my recent questions (Anybody else wiped out you O/S lately?)!<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Anyway,  I have an xml dial plan:<u></u><u></u></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">  &lt;</span><span style="font-size:9.5pt;font-family:Consolas;color:#a31515">extension</span><span style="font-size:9.5pt;font-family:Consolas;color:blue"> </span><span style="font-size:9.5pt;font-family:Consolas;color:red">name</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">=</span><span style="font-size:9.5pt;font-family:Consolas">&quot;<span style="color:blue">ten_or eleven_digiti_dial</span>&quot;<span style="color:blue"> &gt;</span><u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">    &lt;</span><span style="font-size:9.5pt;font-family:Consolas;color:#a31515">condition</span><span style="font-size:9.5pt;font-family:Consolas;color:blue"> </span><span style="font-size:9.5pt;font-family:Consolas;color:red">field</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">=</span><span style="font-size:9.5pt;font-family:Consolas">&quot;<span style="color:blue">destination_number</span>&quot;<span style="color:blue"> </span><span style="color:red">expression</span><span style="color:blue">=</span>&quot;<span style="color:blue">^1?(\d{10})$</span>&quot;<span style="color:blue">&gt;</span><u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">      &lt;</span><span style="font-size:9.5pt;font-family:Consolas;color:#a31515">action</span><span style="font-size:9.5pt;font-family:Consolas;color:blue"> </span><span style="font-size:9.5pt;font-family:Consolas;color:red">application</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">=</span><span style="font-size:9.5pt;font-family:Consolas">&quot;<span style="color:blue">set</span>&quot;<span style="color:blue"> </span><span style="color:red">data</span><span style="color:blue">=</span>&quot;<span style="color:blue">ringback=${us-ring}</span>&quot;<span style="color:blue">/&gt;</span><u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">      &lt;</span><span style="font-size:9.5pt;font-family:Consolas;color:#a31515">action</span><span style="font-size:9.5pt;font-family:Consolas;color:blue"> </span><span style="font-size:9.5pt;font-family:Consolas;color:red">application</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">=</span><span style="font-size:9.5pt;font-family:Consolas">&quot;<span style="color:blue">set</span>&quot;<span style="color:blue"> </span><span style="color:red">data</span><span style="color:blue">=</span>&quot;<span style="color:blue">effective_caller_id_number=${outbound_caller_id_number}</span>&quot;<span style="color:blue">/&gt;</span><u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">      &lt;</span><span style="font-size:9.5pt;font-family:Consolas;color:#a31515">action</span><span style="font-size:9.5pt;font-family:Consolas;color:blue"> </span><span style="font-size:9.5pt;font-family:Consolas;color:red">application</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">=</span><span style="font-size:9.5pt;font-family:Consolas">&quot;<span style="color:blue">set</span>&quot;<span style="color:blue"> </span><span style="color:red">data</span><span style="color:blue">=</span>&quot;<span style="color:blue">ani=${outbound_caller_id_number}</span>&quot;<span style="color:blue">/&gt;</span><u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">      &lt;</span><span style="font-size:9.5pt;font-family:Consolas;color:#a31515">action</span><span style="font-size:9.5pt;font-family:Consolas;color:blue"> </span><span style="font-size:9.5pt;font-family:Consolas;color:red">application</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">=</span><span style="font-size:9.5pt;font-family:Consolas">&quot;<span style="color:blue">set</span>&quot;<span style="color:blue"> </span><span style="color:red">data</span><span style="color:blue">=</span>&quot;<span style="color:blue">effective_caller_id_name=${outbound_caller_id_name}</span>&quot;<span style="color:blue">/&gt;</span><u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">      &lt;</span><span style="font-size:9.5pt;font-family:Consolas;color:#a31515">action</span><span style="font-size:9.5pt;font-family:Consolas;color:blue"> </span><span style="font-size:9.5pt;font-family:Consolas;color:red">application</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">=</span><span style="font-size:9.5pt;font-family:Consolas">&quot;<span style="color:blue">set</span>&quot;<span style="color:blue"> </span><span style="color:red">data</span><span style="color:blue">=</span>&quot;<span style="color:blue">hangup_after_bridge=true</span>&quot;<span style="color:blue">/&gt;</span><u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">      &lt;</span><span style="font-size:9.5pt;font-family:Consolas;color:#a31515">action</span><span style="font-size:9.5pt;font-family:Consolas;color:blue"> </span><span style="font-size:9.5pt;font-family:Consolas;color:red">application</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">=</span><span style="font-size:9.5pt;font-family:Consolas">&quot;<span style="color:blue">bridge</span>&quot;<span style="color:blue"> </span><span style="color:red">data</span><span style="color:blue">=</span>&quot;<span style="color:blue">sofia/gateway/vitelity-inbound/1$1</span>&quot;<span style="color:blue">/&gt;</span><u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">    &lt;/</span><span style="font-size:9.5pt;font-family:Consolas;color:#a31515">condition</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">&gt;</span><span style="font-size:9.5pt;font-family:Consolas"><u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">  &lt;/</span><span style="font-size:9.5pt;font-family:Consolas;color:#a31515">extension</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">&gt;<u></u><u></u></span></p>

<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I thought that would accept either 10 or 11 digit numbers starting with 1 and bridge to the gateway always using 1 plus the 10 digits.<u></u><u></u></p><p class="MsoNormal">

<u></u> <u></u></p><p class="MsoNormal">In fact in my log I can see:<u></u><u></u></p><p class="MsoNormal">Dialplan: sofia/external/<a href="mailto:220@fs_bfis.bizfocused.com" target="_blank">220@fs_bfis.bizfocused.com</a> Regex <b><span style="color:red">(PASS)</span></b> [ten_or eleven_digiti_dial] destination_number<b><span style="color:red"><a href="tel:(14104207777" value="+14104207777" target="_blank">(14104207777</a></span></b>) =~ /^1?(\d{10})$/ break=on-false<u></u><u></u></p>

<p class="MsoNormal">Dialplan: sofia/external/<a href="mailto:220@fs_bfis.bizfocused.com" target="_blank">220@fs_bfis.bizfocused.com</a> Action set(ringback=${us-ring}) <u></u><u></u></p><p class="MsoNormal">Dialplan: sofia/external/<a href="mailto:220@fs_bfis.bizfocused.com" target="_blank">220@fs_bfis.bizfocused.com</a> Action set(effective_caller_id_number=${outbound_caller_id_number}) <u></u><u></u></p>

<p class="MsoNormal">Dialplan: sofia/external/<a href="mailto:220@fs_bfis.bizfocused.com" target="_blank">220@fs_bfis.bizfocused.com</a> Action set(ani=${outbound_caller_id_number}) <u></u><u></u></p><p class="MsoNormal">

Dialplan: sofia/external/<a href="mailto:220@fs_bfis.bizfocused.com" target="_blank">220@fs_bfis.bizfocused.com</a> Action set(effective_caller_id_name=${outbound_caller_id_name}) <u></u><u></u></p><p class="MsoNormal">Dialplan: sofia/external/<a href="mailto:220@fs_bfis.bizfocused.com" target="_blank">220@fs_bfis.bizfocused.com</a> Action set(hangup_after_bridge=true) <u></u><u></u></p>

<p class="MsoNormal">Dialplan: sofia/external/<a href="mailto:220@fs_bfis.bizfocused.com" target="_blank">220@fs_bfis.bizfocused.com</a> Action bridge<b><span style="color:red">(sofia/gateway/vitelity-inbound/<a href="tel:14104207777" value="+14104207777" target="_blank">14104207777</a></span></b>)<u></u><u></u></p>

<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><b><span style="color:red">BUT<u></u><u></u></span></b></p><p class="MsoNormal">It does not work for my customer :<u></u><u></u></p><p class="MsoNormal">Dialplan: sofia/external/<a href="mailto:101@fs_alst.bizfocused.com" target="_blank">101@fs_alst.bizfocused.com</a> Regex <b><span style="color:red">(PASS</span></b>) [ten_or_eleven_digiti_dial] destination_number(<b><span style="color:red">1800336940</span></b>) =~ /^1?(\d{10})$/ break=on-false<u></u><u></u></p>

<p class="MsoNormal">Dialplan: sofia/external/<a href="mailto:101@fs_alst.bizfocused.com" target="_blank">101@fs_alst.bizfocused.com</a> Action set(ringback=${us-ring}) <u></u><u></u></p><p class="MsoNormal">Dialplan: sofia/external/<a href="mailto:101@fs_alst.bizfocused.com" target="_blank">101@fs_alst.bizfocused.com</a> Action set(effective_caller_id_number=${outbound_caller_id_number}) <u></u><u></u></p>

<p class="MsoNormal">Dialplan: sofia/external/<a href="mailto:101@fs_alst.bizfocused.com" target="_blank">101@fs_alst.bizfocused.com</a> Action set(ani=${outbound_caller_id_number}) <u></u><u></u></p><p class="MsoNormal">

Dialplan: sofia/external/<a href="mailto:101@fs_alst.bizfocused.com" target="_blank">101@fs_alst.bizfocused.com</a> Action set(effective_caller_id_name=${outbound_caller_id_name}) <u></u><u></u></p><p class="MsoNormal">Dialplan: sofia/external/<a href="mailto:220@fs_bfis.bizfocused.com" target="_blank">220@fs_bfis.bizfocused.com</a> Action set(hangup_after_bridge=true) <u></u><u></u></p>

<p class="MsoNormal">Dialplan: sofia/external/<a href="mailto:101@fs_alst.bizfocused.com" target="_blank">101@fs_alst.bizfocused.com</a> Action bridge<b><span style="color:red">(sofia/gateway/vitelity-inbound/11800336940</span></b>)  <span style="background:yellow">NOTE THE EXTRA LEADING 1</span><u></u><u></u></p>

<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">So, what am I missing?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Thanks,<u></u><u></u></p><p class="MsoNormal">Sean<u></u><u></u></p>

</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><br></div></div>