Answer the question
In order to leave comments, you need to log in
How to write a GotoIf() transition condition in Asterisk using regular expressions?
Good afternoon!
In the asterisk dial plan, you need to write a condition that redirects to one label if all conditions are met, or to another if at least one is false.
same => n,GotoIf($[$["${DSTREC}" = "0"] & $["${SRCREC}" = "0"] & $["${CIDLENGTH}" = "4"] & $[$REGEX("^SIP\/[1-9][0-9][0-9][0-9]" ${CHANNEL:0:8}) = "1"]]?recordingdisabled: recordingenabled)
There are no issues with DSTREC, SRCREC and CIDLENGTH, these values are either taken from the database or formed during processing and are static, so to speak. But in that part of the channel value ($ {CHANNEL: 0: 8}), limited by me to 8 characters, the last 4 characters can change.
The first 4 characters should be equal to " SIP /", and the last 4 are only numbers, with the first of which does not go out of the range 0 - 9, and the 3 subsequent ones - from 0 to 9.
I tried to write it myself, but I feel that I got some kind of game.
Help.
Answer the question
In order to leave comments, you need to log in
moreover, the first of which does not go out of the range 0 - 9 , and the next 3 - from 0 to 9 .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question