Validate based on contains

I have two channel variables

${DOBS}=011019990205200103092000
${CI}=02052001

If CI existed within the larger concatenated DOBS string, I want to goto A, If CI was not part of DOBS I would go to B. So in the above example I would go to A.

How can I write in the dial plan if contains, pass?

Surprisingly I can’t find a POS function, but if you know that there a no regular expression meta characters, you could use the β€œ:” operator, otherwise use STRREPLACE with an empty string, and see if the length changes.

1 Like

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_REGEX

exten => 100,1,NoOP()
same => n,Set(CI=02052001)
same => n,Set(DOBS=011019990205200103092000)
same => n,ExecIf($[${REGEX("${CI}" ${DOBS})} = 1]?Playback(tt-monkeys))
same => n,Hangup()

1 Like