<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'>Correct djbinter... I missed that \ before the +... If you don’t do that you’ll get a nothing to repeat compile error on the regex...<BR>
<BR>
Thanks for pointing it out!<BR>
<BR>
<BR>
On 1/9/13 4:03 PM, "DJB International" <<a href="djbinter@gmail.com">djbinter@gmail.com</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'>Ken,<BR>
<BR>
Is it correct that in the group but not capture (?: we will need an escape character \ to match the literal "+" character as well. So, I think it should be:<BR>
^(?:\+1|1)?([2-9]\d{2}[2-9]\d{6})$<BR>
<BR>
-djbinter<BR>
<BR>
<BR>
<BR>
On Wed, Jan 9, 2013 at 1:44 PM, Sergey Okhapkin <<a href="sos@sokhapkin.dyndns.org">sos@sokhapkin.dyndns.org</a>> wrote:<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'>It's better to remove trailing "$", there could be more digits on handset's<BR>
redial after entering DTMF codes on previous call.<BR>
<BR>
On Wednesday 09 January 2013 15:33:57 Ken Rice wrote:<BR>
> 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>
> On 1/9/13 2:00 PM, "DJB International" <<a href="djbinter@gmail.com">djbinter@gmail.com</a>> wrote:<BR>
> > 1800336940 is 10-digits; therefore, it will match (\d{10}), which will be<BR>
> > $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>
> > -djbinter<BR>
> ><BR>
> > On Wed, Jan 9, 2013 at 11:48 AM, Sean Devoy <<a href="sdevoy@bizfocused.com">sdevoy@bizfocused.com</a>> wrote:<BR>
> >> HI,<BR>
> >><BR>
> >> I really hope this question is not as dumb as some of my recent questions<BR>
> >> (Anybody else wiped out you O/S lately?)!<BR>
> >><BR>
> >> Anyway, I have an xml dial plan:<BR>
> >> <extension name="ten_or eleven_digiti_dial" ><BR>
> >> <condition field="destination_number" expression="^1?(\d{10})$"><BR>
> >> <action application="set" data="ringback=${us-ring}"/><BR>
> >> <action application="set"<BR>
> >> data="effective_caller_id_number=${outbound_caller_id_number}"/><BR>
> >> <action application="set" data="ani=${outbound_caller_id_number}"/><BR>
> >> <action application="set"<BR>
> >> data="effective_caller_id_name=${outbound_caller_id_name}"/><BR>
> >> <action application="set" data="hangup_after_bridge=true"/><BR>
> >> <action application="bridge"<BR>
> >> data="sofia/gateway/vitelity-inbound/1$1"/><BR>
> >> </condition><BR>
> >> </extension><BR>
> >><BR>
> >> I thought that would accept either 10 or 11 digit numbers starting with 1<BR>
> >> 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 (PASS) [ten_or<BR>
> >> eleven_digiti_dial] destination_number(14104207777 <tel:%2814104207777> <tel:%2814104207777> )<BR>
> >> =~ /^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<BR>
> >> set(ringback=${us-ring})<BR>
> >> Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action<BR>
> >> 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<BR>
> >> 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<BR>
> >> 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<BR>
> >> 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<BR>
> >> bridge(sofia/gateway/vitelity-inbound/14104207777 <tel:14104207777> <tel:14104207777 <tel:14104207777> > )<BR>
> >><BR>
> >> BUT<BR>
> >> 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 (PASS)<BR>
> >> [ten_or_eleven_digiti_dial] destination_number(1800336940) =~<BR>
> >> /^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<BR>
> >> set(ringback=${us-ring})<BR>
> >> Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Action<BR>
> >> 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<BR>
> >> 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<BR>
> >> 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<BR>
> >> 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<BR>
> >> bridge(sofia/gateway/vitelity-inbound/11800336940) NOTE THE EXTRA<BR>
> >> LEADING 1<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>
> > _________________________________________________________________________<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>
_________________________________________________________________________<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></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>