<HTML>
<HEAD>
<TITLE>Re: [Freeswitch-users] xml dialplan - regurlar expression question / Sanity Check!</TITLE>
</HEAD>
<BODY>
<FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'>If you are trying to filter NANPA numbers why not use a tighter REGEX like <BR>
^(?:+1|1)?([2-9]\d{2}[2-9]\d{6})$<BR>
<BR>
This would leave the base 10 digit number in $1<BR>
<BR>
<BR>
On 1/9/13 2:00 PM, &quot;DJB International&quot; &lt;<a href="djbinter@gmail.com">djbinter@gmail.com</a>&gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'><B>1800336940 is 10-digits; therefore, it will match (\d{10}), which will be $1.  <BR>
<BR>
$1 = 1800336940<BR>
<BR>
Then, in your bridge you add 1 in front, so it is correct. <BR>
<BR>
What behaviors are you looking for in this case?<BR>
<BR>
<FONT COLOR="#FF0000">-djbinter<BR>
</FONT></B><BR>
<BR>
On Wed, Jan 9, 2013 at 11:48 AM, Sean Devoy &lt;<a href="sdevoy@bizfocused.com">sdevoy@bizfocused.com</a>&gt; wrote:<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'>HI,<BR>
 <BR>
I really hope this question is not as dumb as some of my recent questions (Anybody else wiped out you O/S lately?)!<BR>
 <BR>
Anyway,  I have an xml dial plan:<BR>
</SPAN></FONT><FONT COLOR="#0000FF"><FONT SIZE="1"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:9pt'>  &lt;</SPAN></FONT></FONT></FONT><FONT SIZE="1"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:9pt'><FONT COLOR="#A31515">extension</FONT><FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">name</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">ten_or eleven_digiti_dial</FONT>&quot;<FONT COLOR="#0000FF"> &gt;<BR>
    &lt;</FONT><FONT COLOR="#A31515">condition</FONT><FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">field</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">destination_number</FONT>&quot;<FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">expression</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">^1?(\d{10})$</FONT>&quot;<FONT COLOR="#0000FF">&gt;<BR>
      &lt;</FONT><FONT COLOR="#A31515">action</FONT><FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">application</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">set</FONT>&quot;<FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">data</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">ringback=${us-ring}</FONT>&quot;<FONT COLOR="#0000FF">/&gt;<BR>
      &lt;</FONT><FONT COLOR="#A31515">action</FONT><FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">application</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">set</FONT>&quot;<FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">data</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">effective_caller_id_number=${outbound_caller_id_number}</FONT>&quot;<FONT COLOR="#0000FF">/&gt;<BR>
      &lt;</FONT><FONT COLOR="#A31515">action</FONT><FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">application</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">set</FONT>&quot;<FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">data</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">ani=${outbound_caller_id_number}</FONT>&quot;<FONT COLOR="#0000FF">/&gt;<BR>
      &lt;</FONT><FONT COLOR="#A31515">action</FONT><FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">application</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">set</FONT>&quot;<FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">data</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">effective_caller_id_name=${outbound_caller_id_name}</FONT>&quot;<FONT COLOR="#0000FF">/&gt;<BR>
      &lt;</FONT><FONT COLOR="#A31515">action</FONT><FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">application</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">set</FONT>&quot;<FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">data</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">hangup_after_bridge=true</FONT>&quot;<FONT COLOR="#0000FF">/&gt;<BR>
      &lt;</FONT><FONT COLOR="#A31515">action</FONT><FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">application</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">bridge</FONT>&quot;<FONT COLOR="#0000FF"> </FONT><FONT COLOR="#FF0000">data</FONT><FONT COLOR="#0000FF">=</FONT>&quot;<FONT COLOR="#0000FF">sofia/gateway/vitelity-inbound/1$1</FONT>&quot;<FONT COLOR="#0000FF">/&gt;<BR>
    &lt;/</FONT><FONT COLOR="#A31515">condition</FONT><FONT COLOR="#0000FF">&gt;<BR>
  &lt;/</FONT><FONT COLOR="#A31515">extension</FONT><FONT COLOR="#0000FF">&gt;<BR>
</FONT></SPAN></FONT></FONT><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'> <BR>
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.<BR>
 <BR>
In fact in my log I can see:<BR>
Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Regex <FONT COLOR="#FF0000"><B>(PASS)</B></FONT> [ten_or eleven_digiti_dial] destination_number<FONT COLOR="#FF0000"><B>(14104207777 &lt;tel:%2814104207777&gt; </B></FONT>) =~ /^1?(\d{10})$/ break=on-false<BR>
Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action set(ringback=${us-ring}) <BR>
Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action set(effective_caller_id_number=${outbound_caller_id_number}) <BR>
Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action set(ani=${outbound_caller_id_number}) <BR>
Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action set(effective_caller_id_name=${outbound_caller_id_name}) <BR>
Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action set(hangup_after_bridge=true) <BR>
Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action bridge<FONT COLOR="#FF0000"><B>(sofia/gateway/vitelity-inbound/14104207777 &lt;tel:14104207777&gt; </B></FONT>)<BR>
 <BR>
<FONT COLOR="#FF0000"><B>BUT<BR>
</B></FONT>It does not work for my customer :<BR>
Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Regex <FONT COLOR="#FF0000"><B>(PASS</B></FONT>) [ten_or_eleven_digiti_dial] destination_number(<FONT COLOR="#FF0000"><B>1800336940</B></FONT>) =~ /^1?(\d{10})$/ break=on-false<BR>
Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Action set(ringback=${us-ring}) <BR>
Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Action set(effective_caller_id_number=${outbound_caller_id_number}) <BR>
Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Action set(ani=${outbound_caller_id_number}) <BR>
Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Action set(effective_caller_id_name=${outbound_caller_id_name}) <BR>
Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action set(hangup_after_bridge=true) <BR>
Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Action bridge<FONT COLOR="#FF0000"><B>(sofia/gateway/vitelity-inbound/11800336940</B></FONT>)  NOTE THE EXTRA LEADING 1<BR>
 <BR>
So, what am I missing?<BR>
 <BR>
Thanks,<BR>
Sean<BR>
<BR>
_________________________________________________________________________<BR>
Professional FreeSWITCH Consulting Services:<BR>
<a href="consulting@freeswitch.org">consulting@freeswitch.org</a><BR>
<a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a><BR>
<BR>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR>
<a href="http://www.cudatel.com">http://www.cudatel.com</a><BR>
<BR>
Official FreeSWITCH Sites<BR>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
<a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a><BR>
<a href="http://www.cluecon.com">http://www.cluecon.com</a><BR>
<BR>
FreeSWITCH-users mailing list<BR>
<a href="FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><BR>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><BR>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><BR>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'><BR>
<BR>
<HR ALIGN=CENTER SIZE="3" WIDTH="95%"></SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'>_________________________________________________________________________<BR>
Professional FreeSWITCH Consulting Services:<BR>
<a href="consulting@freeswitch.org">consulting@freeswitch.org</a><BR>
<a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a><BR>
<BR>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR>
<a href="http://www.cudatel.com">http://www.cudatel.com</a><BR>
<BR>
Official FreeSWITCH Sites<BR>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
<a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a><BR>
<a href="http://www.cluecon.com">http://www.cluecon.com</a><BR>
<BR>
FreeSWITCH-users mailing list<BR>
<a href="FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><BR>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><BR>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><BR>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'><BR>
</SPAN></FONT></FONT><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'>-- <BR>
Ken<BR>
<FONT COLOR="#0000FF"><U><a href="http://www.FreeSWITCH.org">http://www.FreeSWITCH.org</a><BR>
<a href="http://www.ClueCon.com">http://www.ClueCon.com</a><BR>
<a href="http://www.OSTAG.org">http://www.OSTAG.org</a><BR>
</U></FONT>irc.freenode.net #freeswitch<BR>
</SPAN></FONT>
</BODY>
</HTML>