-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
-
Linux operating system. The author has tested on Debian Linux (Jessie) running on AMD64 and Raspbian (Wheezy) running on Raspberry Pi model B. It might be possible to run on Windows, but I have not tried.
-
Walter S Heath's jcblock program.
-
Compatible modem (see below).
-
Land line phone system that uses USA-compatible caller ID.
-
Node.js version 4+.
-
Download the jcblock source code and follow the instructions for building and setting up jcblock on your machine. Make note of the directory where jcblock stores its files
callerID.dat
,whitelist.dat
, andblacklist.dat
. You will need this directory later because jcadmin has to know where to find these three files. On my system, this directory is/home/don/phone/jcblock
. -
Use a compatible modem as described in Walter S. Heath's instructions. I use a USB modem called a TrendNet TFM-561U. (It isn't perfect. About one time in ten it doesn't detect incoming phone calls. Other modems out there might work better.)
Jcadmin was developed using Node.js v4.4.6. Some earlier versions might work, but I strongly recommend using 4.4.6 or higher. IMPORTANT: For many Linux distributions, it turns out the official Node.js package is woefully obsolete! Jcadmin will not work with these old versions. For best results on all systems, pick the latest "LTS" (not "Current") version of Node.js for your operating system.
-
Raspberry Pi users should execute
uname -m
to see which processor your Pi uses. You will see something likearmv6l
orarmv7l
. Visit the official Node.js download page and pick the matching processor number under the ARM Binaries section. For example, ifuname -m
printedarmv6l
, you should download the ARMv6 image. The downloaded file will be named something likenode-v4.4.6-linux-armv6l.tar.xz
. Make note of the directory where you save the file, for example/home/don/Downloads
. Then open a terminal window and enter the following commands:
cd /home/don/Downloads
tar -xvf node*.tar.xz
cd node*
sudo cp -R * /usr/local/
- Other Linux users can visit the Node.js home page and it will often correctly guess which file you should download. Again, pick the LTS build (not the "Current" build). You want something well-tested and stable, not bleeding-edge!
-
Clone the jcadmin repo to a separate directory. Do not put jcadmin and jcblock in the same directory! On my system, I keep jcadmin in
/home/don/github/jcadmin
. -
Change into the jcadmin directory you just cloned and run the script
./initialize
. This will usenpm
(which comes packaged with Node.js) to download required Node.js packages for you.
- You are going to need to edit some text files to complete this installation. If you already know how to do this, great. If you are new to Linux, you should probably stick with a simple text editor like
nano
for now. That means you will enter commands that look like the following in a terminal window every time you want to edit a file:
nano filename
-
This is just an example. Replace that
filename
with the actual name of whatever file you want to edit. When you are done making changes in the file, press Ctrl+X, thennano
will ask you if you want to save your changes to the file (press Y) or not (press N). -
Use your favorite text editor to create a script to launch jcblock for you. My script for running jcblock is
/home/don/bin/jcblock.sh
. It contains the following:
#!/bin/bash
# jcblock.sh - Runs Walter S. Heath's jcblock program to block junk calls.
cd /home/don/phone/jcblock
echo `date --rfc-3339=seconds` "**** Snoozing for 30 seconds..." | tee -a jcblock.log
sleep 30
echo `date --rfc-3339=seconds` "**** Starting jcblock" | tee -a jcblock.log
./jcblock | tee -a jcblock.log
-
Pick a port number for jcadmin to host its web server on your local network. I use 9292, but you can use any value between 1024 and 65535, so long as nothing else on your system is already using it. Take a look at your
/etc/services
file and choose a number from that range that is not already in use. -
Create another script to run jcadmin. Mine is called
/home/don/bin/jcadmin.sh
. Customize the port number you just chose and the directory where jcblock hosts its data files. Here is what my jcadmin.sh script looks like:
#!/bin/bash
# jcadmin.sh - Hosts junk call blocking web interface.
cd /home/don/github/jcadmin
node jcadmin.js 9292 /home/don/phone/jcblock | tee -a jcadmin.log
- Be sure to make both scripts executable, for example:
chmod +x /home/don/bin/jcadmin.sh
chmod +x /home/don/bin/jcblock.sh
- Run the scripts to verify that they are working correctly. I recommend opening two terminal windows, one for each script. First run your jcblock script in the first terminal window, for example:
/home/don/bin/jcblock.sh
- In the second terminal window, run your jcadmin script. For example:
/home/don/bin/jcadmin.sh
- While both scripts are running, launch a web browser and visit the address
http://hostname:9292
. Substitute the host name of your computer and the port number you used in thejcadmin.sh
script. (If you don't know your computer's host name, just enter thehostname
command in a terminal window.) You should see something like this, although you might not have any calls received yet:
- Try calling yourself! Dial your land line from some other phone number, e.g. a cell phone. In the USA, caller ID is received between the first and second ring. Within 2-4 seconds of the silence after the first ring you should see your phone call show up in the browser. You do not need to refresh your browser!
- If everything is working, you will now probably want to make your system automatically start the jcadmin and jcblock scripts every time it boots up. I do this using
cron
. That means editing the text file/etc/crontab
. Here is how to back up your existing/etc/crontab
file (in case something goes wrong) and edit it to make the required changes. (You have to usesudo
here to temporarily give yourself permission to edit protected system files.)
sudo cp /etc/crontab /etc/backup.crontab
sudo nano /etc/crontab
- Here are the entries I added to the bottom of my
/etc/crontab
file. Changedon
to your own username and adjust the paths as needed for your own setup. Save the file and exit thenano
editor by pressing Ctrl+X, then Y.
@reboot don /home/don/bin/jcblock.sh
@reboot don /home/don/bin/jcadmin.sh
-
After setting up the
/etc/crontab
entries, you should probably reboot your machine to make sure they work. Repeat the test with browsinghttp://hostname:9292
to confirm this. Remember to replacehostname
with the actual host name of your machine. Enter thehostname
command in a terminal window if you don't know your computer's host name. -
Setup is now complete! Leave a browser tab always open to jcadmin and enjoy blocking all those telephone pests.