why unix | RBL service | netrs | please | ripcalc | linescroll
hosted services

hosted services

setting up asterisk on debian to act as a tarpit

Aim: To dissuade scammers from attempting to collect money by farce from unsuspecting people by consuming their time, energy, materials and resources through the implementation of obscenely annoying hold music and/or PBX menus.

apt-get install asterisk

That'll get asterisk onto your Debian system.

If you're not running debian, just download the source and configure/install:

$ ./configure --{exec-,}prefix=/usr/local/asterisk-10.12.2 -C
$ make && sudo make install
$ cd /usr/local && sudo ln -s asterisk-10.12.2 asterisk

Below we're assuming you installed using the former (package manager) method.

Now we need to modify just two files: /etc/asterisk/sip.conf and /etc/asterisk/extensions.conf.

You don't need anything in /etc/asterisk/sip.conf, so:

# mv /etc/asterisk/sip.conf{,.old}
# touch /etc/asterisk/sip.conf
# chmod 640 /etc/asterisk/sip.conf
# chown asterisk:asterisk /etc/asterisk/sip.conf

In short terms, the call comes from your SIP provider, in my case that's flextel, who provide free numbers which are diverted to a user@host, over port 5060/tcp.

Within /etc/asterisk/extensions.conf I've simply got the following:

[default]
exten => fouronenine,1,Monitor(wav,${STRFTIME(${EPOCH},,%C%y%m%d%H%M)},m)
exten => fouronenine,n,Set(i=1)
exten => fouronenine,n,While($[${i} > 0])
exten => fouronenine,n,Playback(custom/10_sanctuary)
exten => fouronenine,n,EndWhile

This is a little loop that just repeats the same hold music.

Later (1.2+) versions of Asterisk allow for a short hand version of the above:

[default]
exten => fouronenine,1,Monitor(wav,${STRFTIME(${EPOCH},,%C%y%m%d%H%M)},m)
 same => n,Set(i=1)
 same => n,While($[${i} > 0])
 same => n,Playback(custom/10_sanctuary)
 same => n,EndWhile

Note that user is the user part of user@host.

The hold music needs to be stored in /usr/share/asterisk/sounds.

Another important thing you'll need to do is store that hold music in wav format, mono, and at 8000Hz. To do this with sox:

$ sox file.wav -c 1 -r 8000 newfile.wav

Now go sign up for a free number at flextel and tarpit thy spammers :).

testing

Don't do what I did in haste, I called the number a series of times to test. One day later it occurred to me that I should instead use a SIP client on my laptop to dial the phone. Easy. I used linphone for this. The client is very simple to use, just enter user@host for the connection. If you're behind NAT make sure to configure the NAT public IP in the network area.

If you don't like linphone there is ekiga too, both available from the package repositories.

Ekiga has the advantage that you can create a SIP account, which would allow you to make bi-directional calls.

obscene menu system

One interest of mine is creating the most diabolically insane menu that draws the caller into a deceptive maze of menus before being able to reach the infinite hold music.

Whilst recording calls, its both amusing and interesting to note when the callers grunt or huff at never ending options. So, here's the low-down on how the extensions.conf file works.

Each menu requires a context. In the above example, we're working within the default context. The way I see it, if you want to give the caller some details/queue options for barnyard products, you may wish to create a barnyard context for someone dialing businessline@host.

[default]
...
exten => businessline,1,Goto(barnyard,s,1)

[barnyard]
exten => s,1,Set(TIMEOUT(digit)=5)
exten => s,n,Monitor(wav,barnyard-${STRFTIME(${EPOCH},,%C%y%m%d%H%M)},m)
exten => s,n,Set(TIMEOUT(response)=10)
exten => s,n,Playback(custom/barnyard_products)
exten => s,n,WaitExten(5)

exten => 1,1,Playback(en_US_f_Allison/queue-youarenext)
exten => 1,n,WaitExten(5)
exten => 1,n,Goto(mainmenu,s,1)

So, from top to bottom, we set the timeout for button pressing to five seconds, we create a unique wav file monitoring this call with a prefix of barnyard, we set the response time to 10 and play the message about barn products. Finally we wait for five seconds before looping.

If the user presses 1, they go to the "you're next" set of messages, not doing anything for give seconds puts them back in the main menu. Annoying, don't you agree?

Perhaps not enough. I think it would be down to the individual how complex this gets, I don't want to create a huge page here displaying menu options that are mostly the same.

Obviously sending someone to a queue, that is quite short sending them back in a loop isn't going to hold their attention for very long. The trick, is laboriously long menus. (I might argue a little that we've already won, they called, we didn't answer, a computer did).

<!-- [silence] exten => s,1,Playback(custom/Front_Left) same => n,WaitForSilence(5000) same => n,Gosub(randmessage,msg${RAND(1,5)},1) same => n,Goto(silence,s,1)

[randmessage] exten => msg1,1,Playback(custom/agent-loginok) same => n,Return

exten => msg2,1,Playback(custom/Noise) same => n,Return

exten => msg3,1,Playback(custom/agent-alreadyon) same => n,Return

exten => msg4,1,Playback(custom/agent-incorrect) same => n,Return

exten => msg5,1,Playback(custom/agent-newlocation) same => n,Return --!>

If you're looking for more information on Asterisk and want to read a dead tree book, why not consider purchasing Asterisk: The Future of Telephony by Jim Van Meggelen, Jared Smith and Leif Madsen.