Incoming route based on callerid name

We are getting a lot of telemarketing calls. A lot of the caller names start with a v followed by a bunch of numbers. Is there a way to route incoming calls based on this, similar to routing calls based on the incoming caller telephone number?

You could put every combination in a BL module:
https://wiki.freepbx.org/display/FPG/Blacklist+Module+User+Guide

Or make a custom context, and point the inbound route at the custom context. The custom context could read the first character of the CIDNAME and if its v do something, otherwise do something else.

You could also explore @lgaetz 's famous Whitelisting Thread. Of Robocalls and Whitelists

1 Like

Looking at custom contexts. Dont see a way to have it read CIDNAME.

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

Hi Bill

For incoming contexts, I prefer to use an exten of _. instead of _X.
If an INVITE arrives without a DID or with non-numeric DID it can be a problem.

I don’t want those INVITEs :slight_smile: (at least on this context)

I understand your point though.

But those log warnings…!

1 Like

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