Execif callerid(num) and pattern maching

I would like to execute a command when the callerid number matches a pattern for example beginning 07 or 447

This is what I have put together but it doesn’t match and thus execute the command

same => n,ExecIf($["${CALLERID(num)}"="_07."]?System(/bin/bash /var/lib/asterisk/script/sms.sh “${CALLERID(num)}”))


before the priority that execute the ExecIF, add same=>n,NoOp( Callerid num is ${CALLERID(NUM)} ) and post the CLI output

If you want to use wildcards in expressions, you must use an explicit regular expression operator.

However you should also consider “ex-girlfriend” logic: voip-info.org/wiki/view/Aste … sions.conf

Yes I already checked to see what the cli is of the incoming call so I can see what I need to match to, this is a good tool to have.

If I match the exact number this works however I want to execute on a pattern match like “_07.” I assume I have the syntax wrong and asterisk is looking to see if the text matches and not the pattern.

How can I match on pattern with the execif command?


If I can’t use pattern matching of which I have not seen any example of I may need to do some form of digit manipulation to take the callerid(num) variable output and extract the first two digits into a new variable to match in my execif command.

Perhaps this is the right answer but it would be cleaner to use pattern matching

something like this ${CALLERID(num):0:2} It works but it would be nice to use number matching