Telemarketing (Junk) Call Blocker

Console Tones Screenshot

@Knoppix:/mnt/jc# ./jcblock

jcblock Copyright (C) 2008 Walter S. Heath
This program comes with absolutely no warranty.
This is free software, distributed under terms
of the GNU Public License described at:
http://www.gnu.org/licenses/.

sending ATZ command...
got command OK
sending AT+VCID=1 command...
got command OK
Waiting for a call...
nbytes: 8, str: --RING--
nbytes: 71, str: --DATE = 062210--TIME = 1452--NMBR = 6035551212--NAME = Cell Phone   NM--
got command OK
got command OK
got command OK

N_LO: rel mag=     0.00087  detection=FALSE
N_HI: rel mag=     0.00073  detection=FALSE

N_LO: rel mag=     0.00087  detection=FALSE
N_HI: rel mag=     0.00073  detection=FALSE

N_LO: rel mag=     1.00048  detection=TRUE
N_HI: rel mag=     0.00073  detection=FALSE

N_LO: rel mag=     1.86636  detection=TRUE
N_HI: rel mag=     1.77842  detection=TRUE

N_LO: rel mag=     3.15519  detection=TRUE
N_HI: rel mag=     1.51351  detection=TRUE

 ... ten consecutive detection pairs required...

N_LO: rel mag=     3.97468  detection=TRUE
N_HI: rel mag=     1.13660  detection=TRUE

N_LO: rel mag=     1.40211  detection=TRUE
N_HI: rel mag=     0.99997  detection=TRUE

N_LO: rel mag=     4.86712  detection=TRUE
N_HI: rel mag=     2.93078  detection=TRUE
*-KEY press detected
got command OK
got command OK

The above text shows the terminal output from the jcblock program when a call that is not on the blacklist or whitelist is received and the tone detection window opens. Call rings are spaced six seconds apart. The program waits for seven seconds to determine that the call has been answered. At that point three clicks are heard and the tone detection window stays open for ten seconds. If the star (*) key on the handset is pressed in that interval the two tones generated are detected and the program proceeds to construct and write an entry to the blacklist file for the call. At the end of the ten second interval two clicks are heard and the detection window is closed.

Tones are detected using the Goretzel digital filter algorithm. It is essentially a very narrow bandpass filter. Two are used; one for each tone generated by the star (*) key press. The N_LO and N_HI outputs of these filters are averaged and tested against a threshold. When both exceed the threshold, a detection is declared.