Skip to main content

I really hate anonymous calls 🙉

Here’s what I did about it.

Working at a VoIP provider comes with some great advantages. One of these is Mobile on PBX. This basically means I can route the calls from and to my mobile phone through my own PBX of choice. This works with a host at the provider we call a ‘mobreg’. This is the host that pretends to be a phone, and registers on my PBX.

Lately, I’ve been receiving some anonymous calls on my phone. At least one every day, and sometimes more. I never pick up. If it’s important, I want to at least know who you are. But it wouldn’t be the first time I missed an important call due to my hate of anonymous calls, so what do I do about it? Pick up everytime, only to find out it’s a telemarketer with a ‘fantastic offer’? No, there has to be a better way.

So on this beatiful lazy sunday, instead of doing something important. I edited my Asterisk dialplan for inbound calls. Here’s what I did:

[mobile-in]
exten = $my-mobile-number,1,GotoIf($["${CALLERID(num)}" = "anonymous"]?anonymous:notanonymous)

 same = n(notanonymous),Dial(SIP/mobile-handset,20)
 same = n,Progress()
 same = n,Wait(1)
 same = n,Playback(cant-pick-up,noanswer)
 same = n,Hangup

 same = n(anonymous),Answer
 same = n,Playback(callscreen-announce-demands)
 same = n,Record(callscreen-recording.wav,10,60)

 same = n,Dial(SIP/mobile-handset,20,M(callscreen))

 same = n,Playback(cant-pick-up-anon)
 same = n,Busy(5)

If you don’t read asterisk dialplans everyday. Here’s a bit of explaination:

The very fist thing that happens when a call comes in, is that my PBX checks the Caller ID that is supplied. If it’s “anonymous”, we go to part where it says (anoniem). Else, it calls my mobile phone.

Let’s zoom in on the part for anonymous callers. The first thing that happens is the plackback of the file ‘callscreen-announce-demands’. The anonymous caller now hears me, telling them to leave their name and reason for their call after the tone, and to press # when they’re done. It then plays a beep and starts recording. As soon as the caller presses #, they will hear a ’normal’ ringing tone, indicating my cell phone is ringing. Now, the part with M(callscreen) comes into play. The option ‘M" indicates a macro, the code for that is the following:

[macro-callscreen]
exten = s,1,Wait(1)
 same = n,Playback(callscreen-intro)
 same = n,Background(callscreen-recording)
 same = n,Playback(beep)
 same = n,Read(OPTION,,1))

 same = n,GotoIf($["${OPTION}" = "1"]?pickup)
 same = n,GotoIf($["${OPTION}" = "2"]?go-away)
 same = n,GotoIf($["${OPTION}" = "3"]?aaas)

 same = n(pickup),NoOp()
 same = n,MacroExit()

 same = n(go-away),Set(MACRO_RESULT=BUSY)
 same = n,MacroExit()

 same = n(aaas),Set(MACRO_RESULT=GOTO:mobile-out^31853033033^1)
 same = n,MacroExit()

This is the part that I get dropped into when I pick up. It first plays the recording the caller left. After that, it plays a beep, indicating I can pick between these options.

  • 1: I ‘pick up’ the call, and will be able to talk to the one who’s calling.
  • 2 (or just hang up): The caller will hear a recording that says I can’t pick up at the moment. Advising him to contact me by some other means, or to call back later.
  • 3: Connect them to AaaS. This is an option for telemarketers. They will get connected to a series of hilarious menu’s, and I get to listen to their reaction through a recording later.

One way I might want to improve this, is being able to listen to the call when I route them throug AaaS. At the moment, it just hangs up on my cell phone, and I have to dig up the recording later.

You might ask yourself why I used the Read application. Well, that’s very simple. Asterisk Macro’s don’t support ’normal’ IVR menu’s. And the Read application still allows me to have some sort of a menu.

So, that’s it. That’s how I deal with anonymous calls. If you know of any ways to improve it further, please let me know.