Part 1: Laying groundwork


This guide will start out with the following assumptions:

As we are running the Raspberry Pi (RPi) as a server, assigning it a static IP is a good idea. And running the latest software updates is always smart.

Required parts

This project requires the following parts:

  1. A Raspberry Pi 2/3
  2. 4 GB micro sd card
  3. An Obi110 Analog Telephone Adapter (ATA)

Banana Phone uses a collection of small Python scripts in conjunction with Asterisk to block robocalls. We will create a user on the RPi that is only for Banana Phone usage to keep all files and scripts in a single place.

sudo useradd banana

After that, create a password for your 'banana' user.

sudo passwd banana

The 'banana' user will need to install other packages, so to make things easier we'll add it to sudoers.

sudo visudo

We will be adding our 'banana' user to this file so it can install packages like the root user. Add the following line to this file:

banana ALL=(ALL:ALL) ALL

Your sudoers file should now look like this:

At this point, log out of the RPi and log back in as the 'banana' user.  We'll be creating a home directory for our user and changing permissions on it.

cd /home
sudo mkdir banana
sudo chown banana:banana banana/

The 'banana' user's home directory is now made and has appropriate permissions. Now we'll install the main work horse of Banana Phone: Asterisk.

Asterisk is the premier VoIP server package in the Linux world. It's flexible, open source and can do damn near anything with phone calls. In fact, I can guarantee most, if not all, robocall servers are running some version of Asterisk. So it's only fitting that we use it to block them.

In the past, I've done installing from source, but that's a huge pain and there are perfectly good repos that we can just install from and they work fine. Install Asterisk and wait for it to finish.

sudo apt-get install asterisk

Once finished, try logging into the Asterisk debug console to make sure it is running. This console will be helpful to us later when we're testing out how Banana Phone handles calls.

sudo asterisk -rvvvvv

If everything went okay, you should now be at the Asterisk console. Check Asterisk's settings by running:

core show settings

You should see something similar to this if the install went okay.

As of now, Asterisk is running but can't do anything. In the next section, we'll cover the main configuration files needed to get Asterisk to a working call server.

-> Next section: Initial Asterisk configuration