In extensions, I have this.

The variable "oex" contains the original extension called, and is used to
route outgoing calls internal or external depending on several factors.

 

But now, im implementing a system that should require a passcode upon
calling a "sensitive number".

 

Here is the relevant part in extensions.conf:

exten =>
s,12,Set(barrfile=${FILE(/var/secure_files/callbarring.txt,0,1,l,u)})

exten => s,13,Set(passcode=${SHIFT(barrfile)})

exten => s,14,Set(barrnumbers=${SHIFT(barrfile)})

exten => s,15,GotoIf($[${REGEX("${barrnumbers}",${oex})} = 0]?outgoing,s,17)

exten => s,16,Authenticate(${passcode})

; Testing purposes, to not route test calls out on the PSTN.

exten => s,17,Playback(you-have-reached-a-test-number)

exten => s,18,Hangup()

; Comment the above 2 lines and uncomment the next, to enable live PSTN
operation.

;exten => s,17,Dial(SIP/${oex}@cellip)

 

callbarring.txt contains (passcode is changed in this example, I just used
1111 as example):

1111,^11|020|90000|09|00,

 

The thing is, that if I call a number that CONTAINS for example 09, it will
ask for passcode, but it should only ask for passcode if it BEGINS (note the
^) on that number.

So I have tested with:

1111,^(11|020|90000|09|00),

And

1111,^11|^020|^90000|^09|^00,

 

But with the result that the REGEX does never match and I get to the "You
have reached a test number" without authenticating, even if the number
begins on 020.

 

 

How I do to anchor to the beginning of the string in REGEX?

 

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Join the Asterisk Community at the 13th AstriCon, September 27-29, 2016
      http://www.asterisk.org/community/astricon-user-conference

New to Asterisk? Start here:
      https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to