phoneblock/answerbot

By phoneblock

Updated over 1 year ago

Local deploy of PhoneBlock answering machine capturing SPAM calls, see https://phoneblock.net/

Image
Networking
4

6.4K

phoneblock/answerbot repository overview

The PhoneBlock answering machine

PhoneBlock offers you an intelligent answering machine that answers the call if and only if the caller's number is listed in PhoneBlock's SPAM database. The answering machine is registered as VOIP device at your internet router. The default settings assume, you use a Fritz!Box as router.

The easy way with setup wizard and Web-UI is to create a PhoneBlock-Dongle that runs the answering machine on an ESP 32 micro controller connected through WLAN.

Please note: In both versions (dongle and docker) the call is checked by matching the calling number against the PhoneBlock database. This is why you need a PhoneBlock API key (which is free of charge) also for running the docker image.

How to use this container

The following command assumes that

  • You have created an API key from https://phoneblock.net/phoneblock/settings for accessing the PhoneBlock database.
  • You created a VOIP phone in your Fritz!Box with the user name phoneblock and the password VOIP-phone-password

Then you can start the answering machine using the following command:

docker run --network=host -d --rm --name phoneblock \
    -e "PHONEBLOCK_API_KEY=your-API-key" \
    -e "SIP_USER=phoneblock" \
    -e "SIP_PASSWD=VOIP-phone-password" \
    -e "VIA_ADDR=ip4-address-of-host-where-answerbot-is-running" \
    -e "VIA_ADDR_V6=ip6-address-of-host (optional)" \
    -e "REGISTRAR=fritz.box" \
    -e "ROUTE=fritz.box;lr" \
    phoneblock/answerbot:latest

Note: It is required to use the host network, since the VOIP and RTP protocols require your internet router to reach the host running the answering machine (otherwise, a really complicated port forwarding would be required). The VIA_ADDR and VIA_ADDR_V6 settings are only required, if the container cannot detect the host's IP address (seems to be the case in some situations).

Note: In some situations (if the host cannot resolve the name fritz.box because it uses another DNS server), it may be necessary to replace fritz.box in the above settings with the IP address of the box.

Your own audio files

The container contains default audio files for conversation with the SPAM caller. You can also provides your own personalized audio files by mounting a directory to the running container. To do so, prepare a local directory $PWD/conversation with audio files structured like the example and add the following command line option to the run command:

    -v $PWD/conversation:/opt/phoneblock/conversation

Check the logs

After starting the answerbot, you can check the logs with:

docker container logs phoneblock

This should report something like that:

[2025-01-01 13:08:32] INFO: [de.haumacher.phoneblock.answerbot.AnswerBot]: AnswerBot 1.5.0-SNAPSHOT
[2025-01-01 13:08:32] INFO: [org.mjsip.config.OptionParser]: Using '--via-addr' from environment: VIA_ADDR=...
[2025-01-01 13:08:32] INFO: [org.mjsip.config.OptionParser]: Using '--via-addr-v6' from environment: VIA_ADDR_V6=...
[2025-01-01 13:08:32] INFO: [org.mjsip.config.OptionParser]: Using '--sip-user' from environment: SIP_USER=phoneblock
[2025-01-01 13:08:32] INFO: [org.mjsip.config.OptionParser]: Using '--sip-passwd' from environment: SIP_PASSWD=your-password
[2025-01-01 13:08:32] INFO: [org.mjsip.sip.provider.SipProvider]: SipStack: mjsip 1.9.0-SNAPSHOT
[2025-01-01 13:08:32] INFO: [org.mjsip.sip.provider.SipProvider]: SipProvider: 50060
[2025-01-01 13:08:32] INFO: [org.mjsip.sip.provider.SipProvider]: udp is up at port 50060
[2025-01-01 13:08:32] INFO: [org.mjsip.sip.provider.SipProvider]: tcp is up at port 50060
[2025-01-01 13:08:32] INFO: [de.haumacher.phoneblock.answerbot.AnswerBot]: Supported media: audio 4080 RTP/AVP { 8 PCMA 8000 160 1 }
[2025-01-01 13:08:32] INFO: [org.mjsip.ua.registration.RegistrationLogger]: Registration of '<sip:phoneblock@...:50060>' 200 OK, expires in 300s, renewing in 300s.

Log in to the running container

If something does not work as expected and you would like to inspect the running container, you can log into it using the following command:

docker exec -it phoneblock /bin/bash

Starting with Compose script

If you prefer starting the bot with a docker compose script, you can find a template here: https://github.com/haumacher/phoneblock/blob/master/phoneblock-ab/compose.yaml This also provides more settings to customize your installation. All options with their documentation can be found in the settings template. You can pass all options as environment variables by converting them to all-upper-case and replacing the dashes (-) by underscores (_).

Tag summary

Content type

Image

Digest

sha256:bd45b5cdd

Size

196.3 MB

Last updated

over 1 year ago

docker pull phoneblock/answerbot:1.6.16