Skip to content
Spamfilter for FRITZ!Box
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

An extended call routing for AVM FRITZ!Box

The programm is trying to identify spam calls. So it is listen to the FRITZ!Box callmonitor and does several washes.

The program only works in the German telephone network!

For an incoming call a cascaded check takes place:

First, it is checked, whether the number is already known in one of your telephone books ('whitelist').

If not, than it is checked if it is a foreign number. If you set ('blockForeign') the number will be transferred to the corresponding phonebook ('blacklist') for future rejections.

Than it is checked if a domestic number has a valid area code (ONB*) or celluar code**. Quite often spammers using fake area codes. If so, the number will be transferred to the corresponding phonebook ('blacklist') for future rejections.

If all this passed, it is checked at tellows if this number has received a bad score (six to ten) and at least more than three comments. You can adapt the values in the configuration file. The second parameter is for quality purposes: not a single opinion there should block a service provider whose call you might expect. But if the score is proven bad according to your settings, the number will be transferred to the corresponding phonebook (spam) for future rejections.

If you set 'logging' and the 'loggingPath' is valid, the essential process steps for verification are written to the log file callrouter_logging.txt. If 'loggingPath' is empty the programm directory is default.

*ONB = OrtsNetzBereiche (Vorwahlbereiche/Vorwahlen). The list used is from the BNetzA and should be valid for a limited period of time. If you want to update them, then download the CSV file offered. Unpack the archive (if necessary in the archive) and save the file as ONB.csv in the ./assets directory.

**celluar codes are recently set fix as const CELLUAR in callrouter.php. The BNetzA provided no list for download.




Install requirements are:

git clone
cd fbcallrouter

Install composer (see for newer instructions):

composer install

Edit config.example.php and save as config.php or use an other name of your choice (but than keep in mind to use the -c option to define your renamed file) The least essential adaptation is setting your FRITZ!Box password:

'password'     => 'xxxxxxxxx',         // your Fritz!Box user password


If you do not have your own phonebook for spam numbers, add a new one (e.g. "Spamnummern"). Note that the first phonebook ("Telefonbuch") has the number "0" and the numbers are ascending according to the index tabs. Then you have to link this phonebook for call handling: Telefonie -> Rufbehandlung -> Neue Regel -> ankommende Rufe | Bereich: "Telefonbuch" | Telefonbuch: "Spamnummern"



php fbcallrouter run

If Cocked and unlocked... appears, the program is armed. To cancel, press CTRL+C.

Permanent background processing:

a) edit user= in fbcallrouter.service and save it

nano fbcallrouter.service

b) copy the file fbcallrouter.service into /etc/systemd/system

sudo cp fbcallrouter.service /etc/systemd/system/fbcallrouter.service

c) enable the service unit:

sudo systemctl enable fbcallrouter.service

d) check the status:

sudo systemctl status fbcallrouter.service


This script is released under MIT license.


Copyright (c) 2019 Volker Püschel

You can’t perform that action at this time.