From 2b96862b1fcb0e9b90a41478fbd0d16ca01098a5 Mon Sep 17 00:00:00 2001 From: Homer S Date: Tue, 29 Jun 2021 23:03:32 +0200 Subject: [PATCH 1/7] * Added installation instructions to Readme * Added the volume directive to docker-compose.yml so that it points to the repository. --- README.md | 58 +++++++++++++++++++++++++++++++++++++-- docker/docker-compose.yml | 4 +-- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 819f188..64f22db 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,60 @@ # FritzAB2Matrix -A script that reads out the answering machine of a FritzBox in the LAN and posts the messages into an encrypted private chat of the matrix network. - +__FritzAB2Matrix__ reads out the answering machine (_TAM_) of a _Fritz!Box_ in your LAN and posts the messages into a private chat in the __matrix__ network. While you could let your _Fritz!Box_ send the messages by mail - unencrypted of course - the matrix chat is __e2e encrypted__. Which kindly acknowledges the privacy of any caller that leaves a message for you. Uses the python based cmd-line-tool [matrix-commander](https://github.com/8go/matrix-commander) so the matrix-commander.py in this repo is just a copy of that file to ease testing. + +## Installation +If you like to test this repository you are recommended to use one of the following two options. +### Necessary preparations for both cases + * Create a new user (e.g. "fritzab") in your _Fritz!Box_. **Don't use your default admin account!** + * This user needs only the privileges regarding voice messages and to read from box's storage. + * As you only need to access the _FRITZ/voicebox/rec/_ path you should remove the right to read and write everything and add only this path and only with reading privilege. + * You have to activate __Call Monitoring__ on your _Fritz!Box_ by using one of the connected phones and call `#96*5*`. + * Call monitoring watches the box and the __FritzAB2Matrix__ is triggered every time a call disconnects. + * If you cannot activate Call Monitoring the only way to use __FritzAB2MAtrix__ will be to have a cron job call it regularly. + +### virtualenv + * Create a new folder wherever you like in your home directory. + * Make it a virtual environment by `python3 -m venv ` and `source /bin/activate`. + * `cd ` + * Clone the repo. + * Inside the repo run `pip install --update pip && pip install -r requirements.txt` + + Create an `.env` file with your favourite editor: + ``` +FRITZ_USERNAME="fritzab" +FRITZ_PASSWORD="SomeRand0mPa55word" +FRITZ_IP="192.168.178.1" +FRITZ_TMP="/tmp" + + ``` + * Adjust it according to your data. + * For matrix-commander.py to work you need to run it manually the first time by `python3 matrix-commander` and follow the emerging dialog by putting in your matrix account data. + * After all that you can finally run `./fritzab2matrix.py` and your TAM messages should be posted in the chosen matrix chat. +### Docker +Provided you have docker and docker-compose installed on your system: + * Clone the repo and cd into it. + * Create the above mentioned `.env` file. + * Run `docker-compose -f docker/docker-compose.yml build` and watch docker work some minutes. + * After that slightly edit the `docker-compose.yml` + * and add + ``` + volumes: + - ../.:/app + ``` + * so that your repo is used as volume for the `/app` folder. So everything you change in the repo's folder will affect the docker container. + * For __matrix-commander.py__ to work you need to run it manually the first time by `python3 matrix-commander` and follow the emerging dialog by putting in your matrix account data. + * With docker that means that you need to open an _interactive shell_ in the running container (`docker-compose -f docker/docker-compose.yml exec app /bin/bash` and run this command there. + * Follow the appearing dialog and input your matrix account data. + * After all that the running docker container should watch your box and your TAM messages should be posted in the chosen matrix chat. + +### Special Thx +Gratitude to all people that enabled that project by their passionate work and will to share it! +Especially to + * https://github.com/kbr/fritzconnection + * https://github.com/8go/matrix-commander + * https://github.com/poljar/matrix-nio/ + * https://github.com/jiaaro/pydub/ + * https://git.savannah.nongnu.org/cgit/fbvbconv-py.git/ + + diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 820721d..7c963f5 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -8,8 +8,8 @@ services: dockerfile: ./docker/Dockerfile working_dir: /app entrypoint: ./fritzab2matrix.py -# volumes: -# - ./:/app + volumes: + - ../.:/app From bcd26f95f28213573e882d5612a86e490a295e0e Mon Sep 17 00:00:00 2001 From: Homer S Date: Tue, 29 Jun 2021 23:10:07 +0200 Subject: [PATCH 2/7] Corrected markdown. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 64f22db..aef0e60 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ FRITZ_IP="192.168.178.1" FRITZ_TMP="/tmp" ``` + * Adjust it according to your data. * For matrix-commander.py to work you need to run it manually the first time by `python3 matrix-commander` and follow the emerging dialog by putting in your matrix account data. * After all that you can finally run `./fritzab2matrix.py` and your TAM messages should be posted in the chosen matrix chat. @@ -42,6 +43,7 @@ Provided you have docker and docker-compose installed on your system: volumes: - ../.:/app ``` + * so that your repo is used as volume for the `/app` folder. So everything you change in the repo's folder will affect the docker container. * For __matrix-commander.py__ to work you need to run it manually the first time by `python3 matrix-commander` and follow the emerging dialog by putting in your matrix account data. * With docker that means that you need to open an _interactive shell_ in the running container (`docker-compose -f docker/docker-compose.yml exec app /bin/bash` and run this command there. From 77d5c633b2a4bea6ccbf7311b96b310747b64df2 Mon Sep 17 00:00:00 2001 From: Homer S Date: Tue, 29 Jun 2021 23:11:29 +0200 Subject: [PATCH 3/7] Corrected markdown. --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aef0e60..75cbb15 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,8 @@ FRITZ_IP="192.168.178.1" FRITZ_TMP="/tmp" ``` - + + * Adjust it according to your data. * For matrix-commander.py to work you need to run it manually the first time by `python3 matrix-commander` and follow the emerging dialog by putting in your matrix account data. * After all that you can finally run `./fritzab2matrix.py` and your TAM messages should be posted in the chosen matrix chat. @@ -42,8 +43,9 @@ Provided you have docker and docker-compose installed on your system: ``` volumes: - ../.:/app - ``` - + ``` + + * so that your repo is used as volume for the `/app` folder. So everything you change in the repo's folder will affect the docker container. * For __matrix-commander.py__ to work you need to run it manually the first time by `python3 matrix-commander` and follow the emerging dialog by putting in your matrix account data. * With docker that means that you need to open an _interactive shell_ in the running container (`docker-compose -f docker/docker-compose.yml exec app /bin/bash` and run this command there. From cae5a40d52e232d046770cd5ee6342e0dbe0ddcd Mon Sep 17 00:00:00 2001 From: Homer S Date: Tue, 29 Jun 2021 23:17:27 +0200 Subject: [PATCH 4/7] Corrected markdown. --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 75cbb15..642583d 100644 --- a/README.md +++ b/README.md @@ -20,16 +20,14 @@ If you like to test this repository you are recommended to use one of the follow * `cd ` * Clone the repo. * Inside the repo run `pip install --update pip && pip install -r requirements.txt` - + Create an `.env` file with your favourite editor: + * Create an `.env` file with your favourite editor: ``` FRITZ_USERNAME="fritzab" FRITZ_PASSWORD="SomeRand0mPa55word" FRITZ_IP="192.168.178.1" FRITZ_TMP="/tmp" - ``` - * Adjust it according to your data. * For matrix-commander.py to work you need to run it manually the first time by `python3 matrix-commander` and follow the emerging dialog by putting in your matrix account data. * After all that you can finally run `./fritzab2matrix.py` and your TAM messages should be posted in the chosen matrix chat. @@ -40,11 +38,11 @@ Provided you have docker and docker-compose installed on your system: * Run `docker-compose -f docker/docker-compose.yml build` and watch docker work some minutes. * After that slightly edit the `docker-compose.yml` * and add - ``` +``` volumes: - ../.:/app - ``` - +``` + * * so that your repo is used as volume for the `/app` folder. So everything you change in the repo's folder will affect the docker container. * For __matrix-commander.py__ to work you need to run it manually the first time by `python3 matrix-commander` and follow the emerging dialog by putting in your matrix account data. From 39c2fd6b4ac3b18d0c864e0de927fc7b77060a3c Mon Sep 17 00:00:00 2001 From: Homer S Date: Tue, 29 Jun 2021 23:19:51 +0200 Subject: [PATCH 5/7] Corrected markdown. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 642583d..ff152c8 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ FRITZ_PASSWORD="SomeRand0mPa55word" FRITZ_IP="192.168.178.1" FRITZ_TMP="/tmp" ``` +__.env__ * Adjust it according to your data. * For matrix-commander.py to work you need to run it manually the first time by `python3 matrix-commander` and follow the emerging dialog by putting in your matrix account data. @@ -39,11 +40,11 @@ Provided you have docker and docker-compose installed on your system: * After that slightly edit the `docker-compose.yml` * and add ``` + [...] volumes: - ../.:/app ``` - * - + [...] * so that your repo is used as volume for the `/app` folder. So everything you change in the repo's folder will affect the docker container. * For __matrix-commander.py__ to work you need to run it manually the first time by `python3 matrix-commander` and follow the emerging dialog by putting in your matrix account data. * With docker that means that you need to open an _interactive shell_ in the running container (`docker-compose -f docker/docker-compose.yml exec app /bin/bash` and run this command there. From 74976133fdc6484202f17985bcb48b9692d7e770 Mon Sep 17 00:00:00 2001 From: Homer S Date: Tue, 29 Jun 2021 23:21:17 +0200 Subject: [PATCH 6/7] Corrected markdown. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ff152c8..1a0c5d2 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ FRITZ_TMP="/tmp" ``` __.env__ + * * Adjust it according to your data. * For matrix-commander.py to work you need to run it manually the first time by `python3 matrix-commander` and follow the emerging dialog by putting in your matrix account data. * After all that you can finally run `./fritzab2matrix.py` and your TAM messages should be posted in the chosen matrix chat. @@ -40,11 +41,11 @@ Provided you have docker and docker-compose installed on your system: * After that slightly edit the `docker-compose.yml` * and add ``` - [...] + volumes: - ../.:/app ``` - [...] + * * so that your repo is used as volume for the `/app` folder. So everything you change in the repo's folder will affect the docker container. * For __matrix-commander.py__ to work you need to run it manually the first time by `python3 matrix-commander` and follow the emerging dialog by putting in your matrix account data. * With docker that means that you need to open an _interactive shell_ in the running container (`docker-compose -f docker/docker-compose.yml exec app /bin/bash` and run this command there. From f5ca7307344bab5b7af428ef10c72940fdbd05e8 Mon Sep 17 00:00:00 2001 From: Homer S Date: Wed, 30 Jun 2021 00:39:52 +0200 Subject: [PATCH 7/7] Changed to a less environment specific Hashbang. --- fritzab2matrix.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fritzab2matrix.py b/fritzab2matrix.py index d133d1f..53154fc 100755 --- a/fritzab2matrix.py +++ b/fritzab2matrix.py @@ -1,4 +1,4 @@ -#! /usr/bin/python3 +#!/usr/bin/env python from fritzconnection import FritzConnection from dotenv import load_dotenv @@ -135,4 +135,3 @@ if __name__ == "__main__": -