THE PROBLEM
Starting on the first business day of December 2013 we were deluged by "SPAM" telephone calls. They were persistently trying to find a payday loan deadbeat, trying to help us pay off a payday loan (we don't use payday loans), or sell us all kinds of stuff we didn't want. We told the bill collector we had never heard of the person they were looking for, but they kept calling until we gave them a forwarding number for the the deadbeat, which happened to the the United States Department of Justice local office, then they quit calling. Redirecting persistent bill collectors to the DOJ seems to make them pause and reflect, if you have already explained you don't know the person they're looking for. We have caller ID so when a familiar name or number popped up, after the first ring, we just took the phone off hook then replaced it. We got an average of 4 calls per hour for most days!THE SOLUTION
Now this very quickly bugged us, so I started thinking how I could stop the calls or at least automate our response. I remembered that modems could be made to go off hook, then hang up, and they squirt out caller ID strings, so I Googled Linux call blocking modem software and got a lot of hits. I settled on jcblock by Walter S. Heath, it was written in 'C', was GNU licensed, and didn't require a lot of complex libraries or gui support (this runs on a headless server). The software has a whitelist for known friends whose caller ID reads "Wireless Caller" and a blacklist for known call spammers. I had a little problem reading the code (I'm very old and have my own ideas about how code should be structured), so I reshuffled things, broke multi-page functions into single page funcs, compressed vertical space by moving comment lines to follow 'C' statements, moved the main() to the top, and added prototypes for all the funcs. I removed the tones.c module from the build, because my server doesn't have a microphone or sound system. I also added a few of the string processing routines from my libUt to facillitate parsing file lines (I inserted the code into jcblock.c) and added tracing. Added a makefile with targets for jcblock, truncate, tones, and tar. The truncate and tones are stand alone with a main() for testing. I changed the code so the files weren't kept open and allowed a CR NL at the end of the lines in all files so vi would work (I know emacs is keen, but I still like vi, like I said, I'm old). I decided to add some .php code so I could look at the log and manage the black and white lists via the web. I also set up the directory and web server so a login was required to access the Call Blocking pages (to keep the phone number harvesters away).
MODEMS (telco)
Most newer PCs don't have serial interfaces (for an external modem) on the rear panel (some have a plug on the motherboard requiring a special cable with a rear metal plate to hold the DB-9). A lot of the internal modems you find now a days are win-modems. Beware of WinModems, they depend of Windoz software to do some of the modem's work. If the vendor's specs only list versions of Windoze, look for another modem. We don't have any Windoz running in our house. Look here for more on Winmodems USB modems, however, are usually complete stand-alone modems like external modems and work well with Unix/Linux. I got a USR model 5637, USB modem, changed the /dev/xxx in the code and the CID enable string to what the USR required.
VOILLA!
Now we have a call blocker. It answers after the first ring with a short modem negotiation squall then hangs up, if the phone rings twice, we answer it. Most of the bad guy's calling programs hear the modem's negotiation squall and stop bugging us. I can put match strings in the blacklist for the name or the number of the caller, I can even put the area code and exchange without the last 4 digits so I block all calls from a section of a city (like Washington D.C. or Austin Tx.), keen! This area code and exchange idea is especially handy for political calls.
05/23/2022 14:57:34.553 clnCID: [--RING-- 01] 05/23/2022 14:57:35.429 clnCID: [--DATE=0523--TIME=1457--NMBR=12542446435--NAME=UNAVAILABLE--] 05/23/2022 14:57:35.429 chkBlkLst: blacklist match: UNAVAILABLE -- ------ Cheater 05/23/2022 14:57:40.153 initMdm: Ready For Next Call 05/23/2022 15:52:59.705 clnCID: [--RING-- 01] 05/23/2022 15:53:00.541 clnCID: [--DATE=0523--TIME=1552--NMBR=16822451083--NAME=UNAVAILABLE--] 05/23/2022 15:53:00.541 chkBlkLst: blacklist match: UNAVAILABLE -- ------ Cheater 05/23/2022 15:53:05.265 initMdm: Ready For Next Call And two test calls: 1st is on the blacklist, 2nd on the white list 05/23/2022 13:07:05.289 clnCID: [--RING-- 01] 05/23/2022 13:07:06.197 clnCID: [--DATE=0523--TIME=1307--NMBR=1xxxxxxxxxx--NAME=WIRELESS CALLER--] 05/23/2022 13:07:06.197 chkBlkLst: blacklist match: xxxxxxxxxx -- ------ FOR TESTING 05/23/2022 13:07:10.921 initMdm: Ready For Next Call 05/23/2022 12:50:25.313 clnCID: [--RING-- 01] 05/23/2022 12:50:26.181 clnCID: [--DATE=0523--TIME=1250--NMBR=1xxxxxxxxxx--NAME=WIRELESS CALLER--] 05/23/2022 12:50:31.273 clnCID: [--RING-- 02] 05/23/2022 12:50:36.225 clnCID: [--RING-- 03]
It occurred to me that if the modem does text to speech, it could make an announcment or comment to the caller! Like: "go away!" or something nicer!