<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Sorry, disregard my question about $1 vs $2 &#8211; I re-read the wiki.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] <b>On Behalf Of </b>Avi Marcus<br><b>Sent:</b> Wednesday, January 09, 2013 3:02 PM<br><b>To:</b> FreeSWITCH Users Help<br><b>Subject:</b> Re: [Freeswitch-users] xml dialplan - regurlar expression question / Sanity Check!<o:p></o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>Ha, that was a tricky one!<o:p></o:p></p><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>Here's the issue - he dialed:&nbsp;<span style='font-family:"Arial","sans-serif";background:white'>1-800-336-940 -- that's too few digits!</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";background:white'>So your optional one made it match anyway.</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";background:white'>Your matching is too allowing - here's the regex I use:</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>^(?:1|\+1|001)?([2-9]\d\d[2-9]\d{6})$</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>That matches [nothing, 1, +1 or 001] prefix for USA. Then, bridge like now to &quot;1$1&quot;.</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif"'>btw, if you want a separate match for USA toll-free it's:&nbsp;^(?:1|\+1|001)?(8(00|55|66|77|88)[2-9]\d{6})$</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>There's also some good example on this page, the link goes directly to USA:&nbsp;<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><o:p></o:p></p></div><div><p class=MsoNormal><br clear=all><o:p></o:p></p><div><div><p class=MsoNormal><span style='font-family:"Verdana","sans-serif"'>-Avi Marcus</span><br>BestFone<o:p></o:p></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>On Wed, Jan 9, 2013 at 9:48 PM, Sean Devoy &lt;<a href="mailto:sdevoy@bizfocused.com" target="_blank">sdevoy@bizfocused.com</a>&gt; wrote:<o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>HI,<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I really hope this question is not as dumb as some of my recent questions (Anybody else wiped out you O/S lately?)!<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Anyway,&nbsp; I have an xml dial plan:<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>&nbsp; &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></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>&nbsp;&nbsp;&nbsp; &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></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &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></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &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></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &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></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &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></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &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></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &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></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>&nbsp;&nbsp;&nbsp; &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><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>&nbsp; &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;</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>In fact in my log I can see:<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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" target="_blank">(14104207777</a></span></b>) =~ /^1?(\d{10})$/ break=on-false<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Dialplan: sofia/external/<a href="mailto:220@fs_bfis.bizfocused.com" target="_blank">220@fs_bfis.bizfocused.com</a> Action set(ringback=${us-ring}) <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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}) <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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}) <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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}) <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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) <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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" target="_blank">14104207777</a></span></b>)<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='color:red'>BUT</span></b><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>It does not work for my customer :<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Dialplan: sofia/external/<a href="mailto:101@fs_alst.bizfocused.com" target="_blank">101@fs_alst.bizfocused.com</a> Action set(ringback=${us-ring}) <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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}) <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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}) <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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}) <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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) <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>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>)&nbsp; <span style='background:yellow'>NOTE THE EXTRA LEADING 1</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>So, what am I missing?<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thanks,<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Sean<o:p></o:p></p></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><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><o:p></o:p></p></div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div></div></body></html>