A
A
Alexander2015-11-16 09:46:45
Asterisk
Alexander, 2015-11-16 09:46:45

How to correctly compose a regular expression in Asterisk?

The task is to enter into the dialplan a check of the value of the variable callerid_1 (it contains a number in the format 7XXXXXXXXXX), and
if the first TWO digits of the value are NOT equal to 73 or 74 or 78 or 79 (RF), then assign the value "74950000000" to the callerid_1 variable, otherwise the value of the variable is not change.
For some reason this line doesn't work:

same=>n,ExecIf($["${REGEX("7[3489]" ${callerid_1:0:2})}"="0"]?Set(callerid_1="7495000000"))

How to write such a check?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2015-11-16
@Udarnick

same=>n,ExecIf($[${REGEX("^7[3489]" ${callerid_1})}]?NoOp(NORMA):Set(callerid_1=74950000000))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question