Filtering spam calls with Caller ID Name starting with V

I am getting calls daily now from numbers like
V6091532190048928145, 5034416295
(CallerIDName, CallerIDNumber)

These always start with V and have a bunch of numeric digits after the V

I read elsewhere to try a regex on the caller ID name so I did this according to the example given but it does not work

exten => 2345678900,1,ExecIf($[${REGEX("^V[0-9]+" CALLERID(name))} = 1]?Goto(app-blackhole,congestion,1))

When executed by way of an incoming call with a name configured this way, I see this in the terminal and the call never goes to the app-blackhole context:

Executing [2345678900@from-GV:1] ExecIf("SIP/2345678900-0000007a", "0?Goto(app-blackhole,congestion,1)") in new stack

As I am bad with these regex expressions I think the answer is there in the expression. Can someone help make it work?


C is not V and it is constant, so you will always get 0 from REGEX.

(You are missing ${...}.)

(Please use pre-formatted text tags on snippets so the forum does not eat important characters.)

If your execif() invokes goto, how about gotoif()?

How about something like:

gotoif($["${CALLERID(name):0:1}" = "V"]?app-blackhole,congestion,1)

The OP did. There would not have been syntax colouring if they hadn’t.

What? Not understanding this reply


I think this would work is the caller ID were only “V” but will it work if caller ID is V123456789101112 then later V987654321000

If I knew how to format this I would not be asking here for help.

You have a pattern which looks for a string beginning with V, but the string you are giving it is, literally, CALLERID(name), which starts with the C from CALLERID. You need to use the function/variable value operator ${...} on it.

The start offset and substring length modifiers were used on the ${…} operator, resulting it returning only one character from the start of the result of the function call; it would work for any length of caller ID name, with the quotation marks ensuring that it would still parse correctly with a zero length name.

Yep. BTW, if you have any friends named ‘Vinnie’ it may be an issue :slight_smile:

See Selecting Characters from Variables

My bad. I interpreted your comment regarding ${...} rashly.

Ok I updated this line as such

exten => 2345678900,1,ExecIf($[${REGEX("^V[0-9]+" ${CALLERID(name)})} = 1]?Goto(app-blackhole,congestion,1))

I can only now wait and see if it works

I found this regex elsewhere


this would seem to work for anything starting with V followed by 14 numeric digits if it is correct.

Surprising that I am dealing with this now that as I understand it shaken/stir is being implemented. I never had this problem before.

I still like:

        same = n,           gotoif($[${REGEX("^V[0-9]+" ${CALLERID(name)})}]?app-blackhole,congestion,1)

I don’t see how your problem relates to STIR/SHAKEN. Asterisk doesn’t do it and to my knowledge this is primarily something for service providers.

1 Like

I’ve been getting these calls for years, it’s not new. Here’s a selection of my spam notifications from 2018

Asterisk has STIR/SHAKEN support.

STIR/SHAKEN has nothing to do with CNAM. It cares about the number.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.