<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)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><title>Re: [Freeswitch-users] xml dialplan - regurlar expression question / Sanity Check!</title><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;}
/* 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-size:10.0pt;}
@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'>THANK YOU TO ALL who pointed out the primary problem – the user dialed too few actual digits, Oh to be young and be able to see well again.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks to Avi and Ken for the improved US N.A. regex.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>CRAP - I went to add it to the WIKI and it’s in there on the Regular Expression Page.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks everyone.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><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>Ken Rice<br><b>Sent:</b> Wednesday, January 09, 2013 4:34 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></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:11.0pt;font-family:"Courier New"'>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, "DJB International" <<a href="djbinter@gmail.com">djbinter@gmail.com</a>> wrote:</span><o:p></o:p></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Courier New"'>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><span style='color:red'>-djbinter<br></span></span></b><span style='font-size:11.0pt;font-family:"Courier New"'><br><br>On Wed, Jan 9, 2013 at 11:48 AM, Sean Devoy <<a href="sdevoy@bizfocused.com">sdevoy@bizfocused.com</a>> wrote:</span><o:p></o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:11.0pt;font-family:"Courier New"'>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><span style='font-size:9.0pt;font-family:Consolas;color:blue'> <</span><span style='font-size:9.0pt;font-family:Consolas;color:#A31515'>extension</span><span style='font-size:9.0pt;font-family:Consolas;color:blue'> </span><span style='font-size:9.0pt;font-family:Consolas;color:red'>name</span><span style='font-size:9.0pt;font-family:Consolas;color:blue'>=</span><span style='font-size:9.0pt;font-family:Consolas'>"<span style='color:blue'>ten_or eleven_digiti_dial</span>"<span style='color:blue'> ><br> <</span><span style='color:#A31515'>condition</span><span style='color:blue'> </span><span style='color:red'>field</span><span style='color:blue'>=</span>"<span style='color:blue'>destination_number</span>"<span style='color:blue'> </span><span style='color:red'>expression</span><span style='color:blue'>=</span>"<span style='color:blue'>^1?(\d{10})$</span>"<span style='color:blue'>><br> <</span><span style='color:#A31515'>action</span><span style='color:blue'> </span><span style='color:red'>application</span><span style='color:blue'>=</span>"<span style='color:blue'>set</span>"<span style='color:blue'> </span><span style='color:red'>data</span><span style='color:blue'>=</span>"<span style='color:blue'>ringback=${us-ring}</span>"<span style='color:blue'>/><br> <</span><span style='color:#A31515'>action</span><span style='color:blue'> </span><span style='color:red'>application</span><span style='color:blue'>=</span>"<span style='color:blue'>set</span>"<span style='color:blue'> </span><span style='color:red'>data</span><span style='color:blue'>=</span>"<span style='color:blue'>effective_caller_id_number=${outbound_caller_id_number}</span>"<span style='color:blue'>/><br> <</span><span style='color:#A31515'>action</span><span style='color:blue'> </span><span style='color:red'>application</span><span style='color:blue'>=</span>"<span style='color:blue'>set</span>"<span style='color:blue'> </span><span style='color:red'>data</span><span style='color:blue'>=</span>"<span style='color:blue'>ani=${outbound_caller_id_number}</span>"<span style='color:blue'>/><br> <</span><span style='color:#A31515'>action</span><span style='color:blue'> </span><span style='color:red'>application</span><span style='color:blue'>=</span>"<span style='color:blue'>set</span>"<span style='color:blue'> </span><span style='color:red'>data</span><span style='color:blue'>=</span>"<span style='color:blue'>effective_caller_id_name=${outbound_caller_id_name}</span>"<span style='color:blue'>/><br> <</span><span style='color:#A31515'>action</span><span style='color:blue'> </span><span style='color:red'>application</span><span style='color:blue'>=</span>"<span style='color:blue'>set</span>"<span style='color:blue'> </span><span style='color:red'>data</span><span style='color:blue'>=</span>"<span style='color:blue'>hangup_after_bridge=true</span>"<span style='color:blue'>/><br> <</span><span style='color:#A31515'>action</span><span style='color:blue'> </span><span style='color:red'>application</span><span style='color:blue'>=</span>"<span style='color:blue'>bridge</span>"<span style='color:blue'> </span><span style='color:red'>data</span><span style='color:blue'>=</span>"<span style='color:blue'>sofia/gateway/vitelity-inbound/1$1</span>"<span style='color:blue'>/><br> </</span><span style='color:#A31515'>condition</span><span style='color:blue'>><br> </</span><span style='color:#A31515'>extension</span><span style='color:blue'>><br></span></span><span style='font-size:11.0pt;font-family:"Courier New"'> <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 <b><span style='color:red'>(PASS)</span></b> [ten_or eleven_digiti_dial] destination_number<b><span style='color:red'>(14104207777 <tel:%2814104207777> </span></b>) =~ /^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<b><span style='color:red'>(sofia/gateway/vitelity-inbound/14104207777 <tel:14104207777> </span></b>)<br> <br><b><span style='color:red'>BUT<br></span></b>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 <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<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<b><span style='color:red'>(sofia/gateway/vitelity-inbound/11800336940</span></b>) 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></span><o:p></o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:11.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><div class=MsoNormal align=center style='text-align:center'><span style='font-size:11.0pt;font-family:"Courier New"'><hr size=3 width="95%" align=center></span></div><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>_________________________________________________________________________<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></span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'><br></span><span style='font-size:11.0pt;font-family:"Courier New"'>-- <br>Ken<br><u><span style='color:blue'><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></span></u>irc.freenode.net #freeswitch</span><o:p></o:p></p></div></body></html>