Incoming route based on callerid name

Custom context means you write it yourself; you have a lot of options!

Make a new context in the /etc/asterisk/extensions_custom.conf file (for example, call it [from-pstn-filterspam]) and add some dialplan like this (NOT tested)

[from-pstn-filterspam]
exten => _X.,1,NoOp(Entered pstn custom context)
same => n,ExecIf($[${REGEX("^V[0-9]+" CALLERID(name))} = 1]?Goto(app-blackhole,congestion,1))
same => n,Goto(from-pstn,${EXTEN},1)

(it can be on a single line but I spread it out to make it more readable)

Then for the trunk where you are receiving calls, set the context to from-pstn-filterspam.

You can add more lines if you get additional obvious spam patterns.

2 Likes