Create a "Press one to be connected to a human" dialplan to reduce robocalls

Hi - Total asterisk beginner here. I am having trouble with robocalls and I need a good strategy to reduce errant phone rings. I tried nomorobo but there are still too many calls going through. I was thinking of creating a dialplan for DID lines where the caller is asked to press #1 to be connected. What’s a good way to do this - any examples? Should I record an audio file on my local computer, and transfer to asterisk (and if so, in what format?) Lastly, for anyone who has done this before, any tried and tested phrases to say so as not to confuse the caller? Thank you!

This is not restricted to direct in dialling lines. The same solutions will work for analogue or ISDN lines with no ability to forward extra digits, and with single number VoIP accounts (even though the SIP marketplace misuses “DID” for these).

You can do the check using Playback, Read and GotoIf.

If you can’t find a suitable recording, the easiest way of creating one with telephone quality is to use Asterisk’s Record application. Ideally recordings should be in the format best corresponding to the codec in use on the leg from the caller, although .wav (lower case) containing 16 bit signed, linear, mono, little endian, 8kHz sampling, audio is generally a good starting point for all codecs. This is what you will get if you specify .wav to Record.

Thanks - Would you have a working example of what you mean by, “Playback, Read and GotoIf?” And, are there any “exceptions” that I should be handling for good practice? Thank you

A simple IVR:


This is my preferred method of dealing with unsolicited calls, just challenge inbound caller to press a single DTMF tone to proceed. Once they successfully pass, I store the CID so subsequent calls from that same CID number don’t get challenged again. I’ve written dialplan and AGIs to do this, but they are for FreePBX and wouldn’t work on a plain Asterisk system.

As a total beginner, I would really love to see a working example of this for Asterisk. That is exactly what I am looking to do.

Question: what does your voice prompt say so as to least confuse callers? And how do you handle whitelisted robocallers (for example, 2-factor authentication that calls the DID)

My prompt says “You’ve called X, press any touch tone key to proceed”. I make no effort to confuse anyone, and it works in 99% of cases, about 1 or 2 undesirable calls a year get thru.

This is the major shortcoming of my deny-by-default approach to incoming calls, there is no way for the tiny number of legit robocalls to get thru without whitelisting the CID in advance. I’ve accepted this as an unavoidable side effect. I’ve setup Slack notifications for all inbound calls, so I occasionally review them to make sure I’m not blocking notifications from the power utility, bank, etc.

My approach to reducing robocalls is to use Nomorobo and have the caller press 1 to get voicemail. Nomorobo stops many telemarketers on the first ring. Calls that do make past Nomorobo, I screen on caller ID display and answer or let the dial plan do its thing.

The dial plan looks like this:

exten => 7141231234,1,Dial(SIP/210&SIP/213&SIP/myprovider-outbound/nomorobo,25)
exten => 7141231234,n,Background(silence/1&press-1&for&voice-mail-system)
exten => 7141231234,n,WaitExten(10)
exten => 7141231234,n,Playback(goodbye)
exten => 7141231234,n,Hangup
exten => 1,1,Voicemail(210|u)
exten => 1,n,Hangup

This rings my extensions and Nomorobo. Nomorobo will answer on the first ring if it’s a telemarketer to capture the call. Otherwise, after 4 or so rings, the caller hears a “press one for voice mail system” message. If the caller presses 1 during the message or within 10 seconds after the message they get voicemail. If not it says goodbye and hangs up.

What you’re basically doing is creating an IVR (interactive voice response) system…even if it is literally just basic. So, for example…here’s the rules for one of my DIDs

exten = 5555551212,1,Set(iext=6420)
same = n,Goto(inbound-ivr,s,1)

The iext line is so if someone does happen to ring my phone; it dials whatever extension is associated with that phone number. Of course this just jumps to the inbound-ivr context.

exten  = s,1,Answer()
same = n(normal),Background(if-u-know-ext-dial)
same = n,Set(VOLUME(TX)=-3)
same = n,Background(thomastheme)
same = n,WaitExten(3600,m(carlin))
same = n,MusicOnHold(carlin)
same = n,Hangup()

Now let me start off by saying my phone system is not my primary number. I give it out to people/places; and assume most will sell that number for spam purposes. My whitelist is physically giving someone the extension to ring my phone. Since I currently know the only time that phone will ring is by someone I want to talk to…it’s an automatic answer. Buddy gets in car accident at 2am and his phone is destroyed? He calls my voip number and I just answer. Otherwise…my system just tells you to dial the extension if you know it; then jumps in to whatever stupidity I throw on there.

In the same context is the extension that rings my phone:

exten = ????,1,Playback(pls-hold-while-try)
same = n,Dial(PJSIP/${iext},20)
same = n,VoiceMail(${iext}@default,u)
same = n,Hangup()

If you wanted to record your own file, you’d put it on the server in 8khz ulaw mono somewhere in the default sound directory.

Hopefully despite my funky IVR you get the idea. You want to send your inbound call to a context where your menu will live. Playback an announcement file (using background so people can enter while it’s playing), tell it how long to wait, what to do after the time out, and make sure you have a dialplan rule for whatever extension you use.

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