Outils pour utilisateurs

Outils du site


issue94:blocage_d_appels

Ceci est une ancienne révision du document !


I haven't heard from him, so I have to assume Greg is still feeling a bit under the weather this month. Feel free to email him some get well soon messages: greg.gregwa@gmail.com Solution to what, you may ask. Why, nuisance telephone calls, of course. Politicians, telemarketers, charities, and too many others have my telephone number. They're not paying my phone bill, so it costs them next to nothing for their auto-dialers to ring my phone to ask for money. For several years, I toyed with the idea of answering such calls with a modem pretending to be a fax machine. I figured that the squeals would alert their software to remove my number from their vast databases. This year (sadly after the flurry of pre-election calls), I managed to partially complete such a toy. Since current computers no longer have DB-25 serial connections, I hastily bought a USB modem on eBay. Having mistakenly believed that all modems have both a “line” and an extension RJ-11 jack, back I went to eBay for another modem. This time what the Chinese vendor called a “two-port” model cost only a bit more than the one I had. When it arrived, the experiments began. Weeks went by as I tried various Linux programs to monitor our landline, read the caller ID (CID), check it against a blacklist to blast the modem synch tones to the unwary, if hopeful, scavenger on the other end.

Je n'ai toujours pas entendu parler de lui, donc je présume que Greg se sent toujours pas dans son assiette ce mois-ci. N'hésitez pas à lui envoyer des messages de prompt rétablissement à : greg.gregwa@gmail.com

Solution à quoi, vous pouvez vous demander.——- Pourquoi, les appels téléphoniques de nuisance, bien sûr. Les politiciens, les télévendeurs, les organismes de bienfaisance, et un trop grand nombre d'autres ont mon numéro de téléphone. Ils ne sont pas payer ma facture de téléphone, de sorte qu'il leur en coûte à peu près rien pour leurs auto-dialers à sonner mon téléphone pour demander de l'argent.

Depuis plusieurs années, je ai joué avec l'idée de répondre à ces appels avec un modem semblant d'être une machine de fax. Je ai pensé que les cris seraient alerter leur logiciel pour supprimer mon numéro de leurs vastes bases de données.

Cette année (malheureusement après la vague de pré-électorale appelle), je ai réussi à partiellement complet tel un jouet. Depuis ordinateurs actuels ne ont plus DB-25 connexions série, je hâte acheté un modem USB sur eBay. I finally settled on picocom for the monitor function, minicom for setup, and modem-cmd to do the auto-answer and blast job. After many hours of writing bash scripts, testing and rewriting, I learned that: 1. Picocom does not like running in the background. 2. Picocom has no logging feature, necessary for passing events by file. 3. Modem answer and hang up commands interfere with the modem's monitoring. 4. The Expect language was mysterious for me. 5. Even bash has some squirrely comparison rules. 6. The embedded USB modem code does not fully implement the Hayes command set. (But it's adequate for my purposes.) Lesson one: Picocom wants its own tty for starting/running. Dedicate a terminal just for it. Lesson two: A patch (diff) to implement logging is available for picocom and it's easy to apply, even for a noob like me. My picocom log file is named CID.log, but it can be any file spec. Lesson three: The port-capturing nature of serial I/O forced me either to suspend monitoring or to use a second line attachment. I thought I could switch between monitoring and answering in a script, but picocom would not function for me when started by a script. So here's where the second modem comes in. (I have two now, you know.) The one-port modem connects to the extension port of the two-port modem. The two-port modem's “line” port connects to the phone line. Picocom monitors the two-port, while modem-cmd answers and hangs up the “extension” using the second modem. Of course, both modems are really on an “extension” but they neither know nor care.

These modems appear in my (Debian) /dev directory as ttyACM0 (the two-port) and ttyACM1 (the one-port). The command lines I use for the modems are: Set up minicom -s -D /dev/ttyACMx Monitor picocom -ilr –logfile /root/phone/CID.log /dev/ttyACM0 Pick up the phone modemcmd=`/usr/bin/modem-cmd /dev/ttyACM1 ~~ATA` Now hang up. modemcmd=`/usr/bin/modem-cmd /dev/ttyACM1 ~~ATH` Reset the modem modemcmd=`/usr/bin/modem-cmd /dev/ttyACM1 ~~ATZ`

These three modem commands are issued within a bash script after starting Picocom manually in a dedicated terminal window. The first, ATA, is used because the fax machine dream came to an end – it was too much trouble. Also, the modem was unwilling to dial without a dial tone. (Remember, it's answering a ringing phone.) Here's a sample of Picocom's output, including the CID block (four values) which arrive just before the second ring. That first call is a candidate for blacklisting. RING DATE = 1117 TIME = 1848 NMBR = 8009421970 NAME = TOLL FREE (The CID says that it's not blacklisted; let it ring.) RING RING DATE = 1118 TIME = 0931 NMBR = 8009421970 NAME = TOLL FREE RING

Ringmon, the program which issues the one-port modem commands (see above) is kicked off by incron. Incron is watching the CID.log file for the updates picocom makes. Ringmon starts Caller with a parameter “1” (Caller 1). Caller checks blacklist.srt to see whether it needs to intercept the call or just let the humans answer it. If the CALLERID is found in blacklist.srt, it calls Blackball. Blackball uses modem-cmd to function the modem to dial out. This stops the ring by answering the phone, producing a modem error because there's no ring tone. But that doesn't cause a problem. The modem is told to hang up after a few seconds, then it's reset. The remaining tasks (blacklist maintenance, call logging, etc.) are divided among several bash scripts and files. These programs make liberal use of cat, grep and tr, which simplify the code. To avoid permission problems, the whole system resides in /root/phone and /var/log. You may want to do something similar. The code is available here: https://www.dropbox.com/sh/yvbilaxpqoho57g/AACYRMwYhy9SM8NXpKVAQGHPa?dl=0.

issue94/blocage_d_appels.1427722008.txt.gz · Dernière modification : 2015/03/30 15:26 de frangi