Random IVR code

Okay, so just like anyone, I hate telemarketers, so with deference to NoMoRobo, I set up an IVR on my machine that asks you to hit 77 to let your call through, else you get voicemail. I think NoMoRobo has a way of randomizing the code and telling the caller the new random digits. Can we do this?

Yes, but not with the current IVR app.

Okay, so the next question would be what app is there?

As far as I know, and right now, there’s only the current IVR app. So, if you wanted to extend the IVR you would need to write a new IVR app or build a new set of custom contexts that implement the scheme you are trying to implement.

The current IVR app should be open source, so creating a new one that extends the old one to add this functionality would be an option.

If you are willing to change your requirements a little bit, you could use the existing IVR app and accept several different combinations, each guided by a random/time-based audio clip.

The tricky part is that the audio would have to change for a random selection to work - the IVR behind the announcement reacts to the key presses. It really has no relationship to the announcement at all.

One final note - the fact that you are dropping your callers into an IVR is usually enough to stop a robodialer. As long as your “0” entry doesn’t connect you to something useful, your IVR isn’t actually talking to a real human most of the time anyway. When I answer my cell phone to an unknown number, I just greet them with “Thank you for calling my cell phone. If you want to speak to a human being, please stay on the line and I will be glad to talk to you if you are a real person.”

This hits the Answering Machine Detection and almost all of the callers quit before I get the words out.

1 Like

I see what you’re saying here. Ill play with that and see what I can do, Thank you.

you can do this with a little custom dialplan if needed.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_RAND

1 Like

Lazy Saturday and it’s too wet to rake leaves.

  • create a Custom Destination with a goto string of bender-blocker,s,1
  • choose the Return option and set the destination to where ever you want legit calls to go
  • route calls through an Announcement saying something like “please enter the following digits”
  • then route to the Custom Destination.
  • add the following lines to the file /etc/asterisk/extensions_custom.conf
[bender-blocker]
exten => s,1,Noop(Entering context bender-blocker in extensions_custom.conf)
exten => s,n,Answer
exten => s,n,Set(Count=0)
exten => s,n(restart),set(goal=${RAND(0,9)}${RAND(0,9)}${RAND(0,9)}${RAND(0,9)}) ; generates a 4 digit number, modify as req'd
exten => s,n,SayDigits(${goal})
exten => s,n,Read(dtmf-in,,${LEN(${goal})},,,10)   ; 10 second timeout, modify as req'd
exten => s,n,execif($["${dtmf-in}"="${goal}"]?Return)      ;  if input matches, send back to FreePBX 

; give caller multiple chances
exten => s,n,Set(Count=$[${Count}+1])
exten => s,n,gotoif($["${Count}"="3"]?finish)   ; bail after 3rd attempt
exten => s,n,Playback(challenge_try_again)      ; sub your own recording
exten => s,n,goto(restart)

; what do you want to do with calls that fail?
exten => s,n(finish),hangup

3 Likes

This is cool! I would actually give a 2nd chance to re-enter the random number and then send it to Blacklist.

Dialplan modified to give caller multiple chances. To blacklist the caller, you would change the finish to:

exten => s,n(finish),Set(DB(blacklist/${CALLERID(number)})=1)
exten => s,n,hangup

Alternatively you might want to send to VM in case you catch a legit call:

exten => s,n(finish),Goto(*5005,from-internal,1)
exten => s,n,hangup
1 Like

This bit works fine, but I was wondering, can the blacklist description be added with a database insert? using the CID name or something?

The mere presense of the key /blacklist/123456789 passes the test that 123456789 is blacklisted. You can add any mnemonic you want for the value

exten => s,n(finish),Set(DB(blacklist/${CALLERID(number)})=${CALLERID(name)})

1 Like

Thanks, that worked fine, but it was not obvious.

The 636 number below was the first test. The description shows blank.
image

But now that I look, if I edit it, I see the 1. Had the 1 showed, likely, I would have tried changing that line myself.
image

IMO auto-blacklisting is not a good idea. For example, the caller is driving and doesn’t want to take his eyes off the road to bring up the keypad and press the required keys. Or, there is a technical problem, e.g. weak mobile uplink and his presses are not properly received. Or, English is not his native language and he didn’t understand the request. He retries later but is now blacklisted. If he’s astute, he’ll try from another number or contact you by SMS, email or your website. Most likely, he’ll retry half a dozen times, get really annoyed and go to a competitor and/or fire off a negative review.

I’m not a fan of manual blacklisting, either. If the same spammer/scammer calls again, it will most likely be from a different spoofed caller ID.

In my experience, a good spam filter that combines an automatically maintained whitelist, an IVR challenge and a caller reputation service does a fine job with no administrative load.

That is by design, in Blacklist.clsss.php is

   if ($data[0] == 'number' &&

$data[1] == ‘description’) {

                            continue;          
                                               
                    }

Presumably because 1 is the default added by using the feature code , and a big old list of 1’s also confusing

Obviously, from the result. Digging into the module code is not the point. The point was to get an answer.

I thought I answered your post of one day ago, I didn’t see a question in your post today, so I thought to post an interpretation of the why’s.

Hello,

I am very new at this but I sure could use some help … I’m dealing with a Tdos attack every time I do a google campaign to promote my small business. I tried adding an IVR to my SIP provider but the attacker get over the meniu and my phone is ringing off the hook. so my plan now is to build PBX myself and have the caller enter a random number combination in order to filter out thees SPAMMERS . Could you please be a little more specific how to implement this code.
Thank you very much.

The steps in this post above are pretty clear. What step is giving you issues?

1 Like

Than you again for your time . I have managed to make it work but the problem is the dam robots are still getting through … :(( I think the might be using some kind of voice recognition script anyway no I am trying to impliment a simple math question to see if that stops the robots …
this is what Y was thinking …

[bender-blocker]
exten => s,1,Noop(Entering context bender-blocker in extensions_custom.conf)
exten => s,n,Answer
exten => s,n,Set(Count=0)
exten => s,n,Set(i=${RAND(0,7))
“Audio recording that says +”
exten => s,n,Set(j=${RAND(0,7))
exten => s,n,set(goal=${MATH(i+j)})
exten => s,n,Read(dtmf-in,${LEN(${goal})},10)

exten => s,n,execif($["${dtmf-in}"="${goal}"]?Return)
exten => s,n,Set(Count=$[${Count}+1])
exten => s,n,gotoif($["${Count}"=“3”]?finish)
exten => s,n,Playback(no_worries_try_again)
exten => s,n,goto(restart)
exten => s,n(finish),hangup

I can’t seem to make the Math func work … any help would be much appreciated !!

Seems like the calls do not necessarily come from your SIP Provider. Do you have 5060 open to the public?

Also you did not copy the full dialplan from above.