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...

Thanks for pointing it out!


On 1/9/13 4:03 PM, "DJB International" <djbinter@gmail.com> wrote:

Ken,

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:
^(?:\+1|1)?([2-9]\d{2}[2-9]\d{6})$

-djbinter



On Wed, Jan 9, 2013 at 1:44 PM, Sergey Okhapkin <sos@sokhapkin.dyndns.org> wrote:
It's better to remove trailing "$", there could be more digits on handset's
redial after entering DTMF codes on previous call.

On Wednesday 09 January 2013 15:33:57 Ken Rice wrote:
> If you are trying to filter NANPA numbers why not use a tighter REGEX like
> ^(?:+1|1)?([2-9]\d{2}[2-9]\d{6})$
>
> This would leave the base 10 digit number in $1
>
> On 1/9/13 2:00 PM, "DJB International" <djbinter@gmail.com> wrote:
> > 1800336940 is 10-digits; therefore, it will match (\d{10}), which will be
> > $1.
> >
> > $1 = 1800336940
> >
> > Then, in your bridge you add 1 in front, so it is correct.
> >
> > What behaviors are you looking for in this case?
> >
> > -djbinter
> >
> > On Wed, Jan 9, 2013 at 11:48 AM, Sean Devoy <sdevoy@bizfocused.com> wrote:
> >> HI,
> >>
> >> I really hope this question is not as dumb as some of my recent questions
> >> (Anybody else wiped out you O/S lately?)!
> >>
> >> Anyway,  I have an xml dial plan:
> >>   <extension name="ten_or eleven_digiti_dial" >
> >>     <condition field="destination_number" expression="^1?(\d{10})$">
> >>       <action application="set" data="ringback=${us-ring}"/>
> >>       <action application="set"
> >> data="effective_caller_id_number=${outbound_caller_id_number}"/>
> >>       <action application="set" data="ani=${outbound_caller_id_number}"/>
> >>       <action application="set"
> >> data="effective_caller_id_name=${outbound_caller_id_name}"/>
> >>       <action application="set" data="hangup_after_bridge=true"/>
> >>       <action application="bridge"
> >> data="sofia/gateway/vitelity-inbound/1$1"/>
> >>     </condition>
> >>   </extension>
> >>
> >> 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.
> >>
> >> In fact in my log I can see:
> >> Dialplan: sofia/external/220@fs_bfis.bizfocused.com Regex (PASS) [ten_or
> >> eleven_digiti_dial] destination_number(14104207777 <tel:%2814104207777>  <tel:%2814104207777> )
> >> =~ /^1?(\d{10})$/ break=on-false
> >> Dialplan: sofia/external/220@fs_bfis.bizfocused.com Action
> >> set(ringback=${us-ring})
> >> Dialplan: sofia/external/220@fs_bfis.bizfocused.com Action
> >> set(effective_caller_id_number=${outbound_caller_id_number})
> >> Dialplan: sofia/external/220@fs_bfis.bizfocused.com Action
> >> set(ani=${outbound_caller_id_number})
> >> Dialplan: sofia/external/220@fs_bfis.bizfocused.com Action
> >> set(effective_caller_id_name=${outbound_caller_id_name})
> >> Dialplan: sofia/external/220@fs_bfis.bizfocused.com Action
> >> set(hangup_after_bridge=true)
> >> Dialplan: sofia/external/220@fs_bfis.bizfocused.com Action
> >> bridge(sofia/gateway/vitelity-inbound/14104207777 <tel:14104207777>  <tel:14104207777 <tel:14104207777> > )
> >>
> >> BUT
> >> It does not work for my customer :
> >> Dialplan: sofia/external/101@fs_alst.bizfocused.com Regex (PASS)
> >> [ten_or_eleven_digiti_dial] destination_number(1800336940) =~
> >> /^1?(\d{10})$/ break=on-false
> >> Dialplan: sofia/external/101@fs_alst.bizfocused.com Action
> >> set(ringback=${us-ring})
> >> Dialplan: sofia/external/101@fs_alst.bizfocused.com Action
> >> set(effective_caller_id_number=${outbound_caller_id_number})
> >> Dialplan: sofia/external/101@fs_alst.bizfocused.com Action
> >> set(ani=${outbound_caller_id_number})
> >> Dialplan: sofia/external/101@fs_alst.bizfocused.com Action
> >> set(effective_caller_id_name=${outbound_caller_id_name})
> >> Dialplan: sofia/external/220@fs_bfis.bizfocused.com Action
> >> set(hangup_after_bridge=true)
> >> Dialplan: sofia/external/101@fs_alst.bizfocused.com Action
> >> bridge(sofia/gateway/vitelity-inbound/11800336940)  NOTE THE EXTRA
> >> LEADING 1
> >> So, what am I missing?
> >>
> >> Thanks,
> >> Sean
> >>
> >> _________________________________________________________________________
> >> Professional FreeSWITCH Consulting Services:
> >> consulting@freeswitch.org
> >> http://www.freeswitchsolutions.com
> >>
> >> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
> >> http://www.cudatel.com
> >>
> >> Official FreeSWITCH Sites
> >> http://www.freeswitch.org
> >> http://wiki.freeswitch.org
> >> http://www.cluecon.com
> >>
> >> FreeSWITCH-users mailing list
> >> FreeSWITCH-users@lists.freeswitch.org
> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> >> http://www.freeswitch.org
> >
> > _________________________________________________________________________
> > Professional FreeSWITCH Consulting Services:
> > consulting@freeswitch.org
> > http://www.freeswitchsolutions.com
> >
> > FreeSWITCH-powered IP PBX: The CudaTel Communication Server
> > http://www.cudatel.com
> >
> > Official FreeSWITCH Sites
> > http://www.freeswitch.org
> > http://wiki.freeswitch.org
> > http://www.cluecon.com
> >
> > FreeSWITCH-users mailing list
> > FreeSWITCH-users@lists.freeswitch.org
> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> > http://www.freeswitch.org

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

--
Ken
http://www.FreeSWITCH.org
http://www.ClueCon.com
http://www.OSTAG.org
irc.freenode.net #freeswitch