<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&#8217;t do that you&#8217;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, &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'>Ken,<BR>
<BR>
Is it correct that in the group but not capture (?: we will need an escape character \ to match the literal &quot;+&quot; 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 &lt;<a href="sos@sokhapkin.dyndns.org">sos@sokhapkin.dyndns.org</a>&gt; wrote:<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:11pt'>It's better to remove trailing &quot;$&quot;, 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>
&gt; If you are trying to filter NANPA numbers why not use a tighter REGEX like<BR>
&gt; ^(?:+1|1)?([2-9]\d{2}[2-9]\d{6})$<BR>
&gt;<BR>
&gt; This would leave the base 10 digit number in $1<BR>
&gt;<BR>
&gt; On 1/9/13 2:00 PM, &quot;DJB International&quot; &lt;<a href="djbinter@gmail.com">djbinter@gmail.com</a>&gt; wrote:<BR>
&gt; &gt; 1800336940 is 10-digits; therefore, it will match (\d{10}), which will be<BR>
&gt; &gt; $1.<BR>
&gt; &gt;<BR>
&gt; &gt; $1 = 1800336940<BR>
&gt; &gt;<BR>
&gt; &gt; Then, in your bridge you add 1 in front, so it is correct.<BR>
&gt; &gt;<BR>
&gt; &gt; What behaviors are you looking for in this case?<BR>
&gt; &gt;<BR>
&gt; &gt; -djbinter<BR>
&gt; &gt;<BR>
&gt; &gt; On Wed, Jan 9, 2013 at 11:48 AM, Sean Devoy &lt;<a href="sdevoy@bizfocused.com">sdevoy@bizfocused.com</a>&gt; wrote:<BR>
&gt; &gt;&gt; HI,<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; I really hope this question is not as dumb as some of my recent questions<BR>
&gt; &gt;&gt; (Anybody else wiped out you O/S lately?)!<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; Anyway,  I have an xml dial plan:<BR>
&gt; &gt;&gt;   &lt;extension name=&quot;ten_or eleven_digiti_dial&quot; &gt;<BR>
&gt; &gt;&gt;     &lt;condition field=&quot;destination_number&quot; expression=&quot;^1?(\d{10})$&quot;&gt;<BR>
&gt; &gt;&gt;       &lt;action application=&quot;set&quot; data=&quot;ringback=${us-ring}&quot;/&gt;<BR>
&gt; &gt;&gt;       &lt;action application=&quot;set&quot;<BR>
&gt; &gt;&gt; data=&quot;effective_caller_id_number=${outbound_caller_id_number}&quot;/&gt;<BR>
&gt; &gt;&gt;       &lt;action application=&quot;set&quot; data=&quot;ani=${outbound_caller_id_number}&quot;/&gt;<BR>
&gt; &gt;&gt;       &lt;action application=&quot;set&quot;<BR>
&gt; &gt;&gt; data=&quot;effective_caller_id_name=${outbound_caller_id_name}&quot;/&gt;<BR>
&gt; &gt;&gt;       &lt;action application=&quot;set&quot; data=&quot;hangup_after_bridge=true&quot;/&gt;<BR>
&gt; &gt;&gt;       &lt;action application=&quot;bridge&quot;<BR>
&gt; &gt;&gt; data=&quot;sofia/gateway/vitelity-inbound/1$1&quot;/&gt;<BR>
&gt; &gt;&gt;     &lt;/condition&gt;<BR>
&gt; &gt;&gt;   &lt;/extension&gt;<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; I thought that would accept either 10 or 11 digit numbers starting with 1<BR>
&gt; &gt;&gt; and bridge to the gateway always using 1 plus the 10 digits.<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; In fact in my log I can see:<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Regex (PASS) [ten_or<BR>
&gt; &gt;&gt; eleven_digiti_dial] destination_number(14104207777 &lt;tel:%2814104207777&gt; &nbsp;&lt;tel:%2814104207777&gt; )<BR>
&gt; &gt;&gt; =~ /^1?(\d{10})$/ break=on-false<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action<BR>
&gt; &gt;&gt; set(ringback=${us-ring})<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action<BR>
&gt; &gt;&gt; set(effective_caller_id_number=${outbound_caller_id_number})<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action<BR>
&gt; &gt;&gt; set(ani=${outbound_caller_id_number})<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action<BR>
&gt; &gt;&gt; set(effective_caller_id_name=${outbound_caller_id_name})<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action<BR>
&gt; &gt;&gt; set(hangup_after_bridge=true)<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action<BR>
&gt; &gt;&gt; bridge(sofia/gateway/vitelity-inbound/14104207777 &lt;tel:14104207777&gt; &nbsp;&lt;tel:14104207777 &lt;tel:14104207777&gt; &gt; )<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; BUT<BR>
&gt; &gt;&gt; It does not work for my customer :<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Regex (PASS)<BR>
&gt; &gt;&gt; [ten_or_eleven_digiti_dial] destination_number(1800336940) =~<BR>
&gt; &gt;&gt; /^1?(\d{10})$/ break=on-false<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Action<BR>
&gt; &gt;&gt; set(ringback=${us-ring})<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Action<BR>
&gt; &gt;&gt; set(effective_caller_id_number=${outbound_caller_id_number})<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Action<BR>
&gt; &gt;&gt; set(ani=${outbound_caller_id_number})<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Action<BR>
&gt; &gt;&gt; set(effective_caller_id_name=${outbound_caller_id_name})<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/220@fs_bfis.bizfocused.com">sofia/external/220@fs_bfis.bizfocused.com</a> Action<BR>
&gt; &gt;&gt; set(hangup_after_bridge=true)<BR>
&gt; &gt;&gt; Dialplan: <a href="sofia/external/101@fs_alst.bizfocused.com">sofia/external/101@fs_alst.bizfocused.com</a> Action<BR>
&gt; &gt;&gt; bridge(sofia/gateway/vitelity-inbound/11800336940)  NOTE THE EXTRA<BR>
&gt; &gt;&gt; LEADING 1<BR>
&gt; &gt;&gt; So, what am I missing?<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; Thanks,<BR>
&gt; &gt;&gt; Sean<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; _________________________________________________________________________<BR>
&gt; &gt;&gt; Professional FreeSWITCH Consulting Services:<BR>
&gt; &gt;&gt; <a href="consulting@freeswitch.org">consulting@freeswitch.org</a><BR>
&gt; &gt;&gt; <a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a><BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR>
&gt; &gt;&gt; <a href="http://www.cudatel.com">http://www.cudatel.com</a><BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; Official FreeSWITCH Sites<BR>
&gt; &gt;&gt; <a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
&gt; &gt;&gt; <a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a><BR>
&gt; &gt;&gt; <a href="http://www.cluecon.com">http://www.cluecon.com</a><BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; FreeSWITCH-users mailing list<BR>
&gt; &gt;&gt; <a href="FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><BR>
&gt; &gt;&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><BR>
&gt; &gt;&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><BR>
&gt; &gt;&gt; <a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
&gt; &gt;<BR>
&gt; &gt; _________________________________________________________________________<BR>
&gt; &gt; Professional FreeSWITCH Consulting Services:<BR>
&gt; &gt; <a href="consulting@freeswitch.org">consulting@freeswitch.org</a><BR>
&gt; &gt; <a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a><BR>
&gt; &gt;<BR>
&gt; &gt; FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR>
&gt; &gt; <a href="http://www.cudatel.com">http://www.cudatel.com</a><BR>
&gt; &gt;<BR>
&gt; &gt; Official FreeSWITCH Sites<BR>
&gt; &gt; <a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
&gt; &gt; <a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a><BR>
&gt; &gt; <a href="http://www.cluecon.com">http://www.cluecon.com</a><BR>
&gt; &gt;<BR>
&gt; &gt; FreeSWITCH-users mailing list<BR>
&gt; &gt; <a href="FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><BR>
&gt; &gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><BR>
&gt; &gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><BR>
&gt; &gt; <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>