FritzBox answering machine: Get the messages?

Hey there,

I am just wondering whether anybody is sending recorded voice message of the FritzBox answering machine to any client via OpenHab? I am also happy if you know any related thread.

I recognized that I can download the messages via the FB web UI but before starting to do some coding I was wondering if anybody already did this. The bindings itself do not offer such functionality or I am missing it completely.

Thanks!

I configured ny fritzbox to send them via mail once they are recorded.
Do you want to do it in a diferent way?

Yes, I saw that option. However, I wanted to retrieve the voice message directly from the FritzBox and send it via matrix protocol to my mobile.

Looks like there exists a tool that does what you are looking for: homer77/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 - Git*ismus
Assumed that works it should be possible to call executeCommandLine which runs that script.

Perfect! Did not find this repo. Thanks a lot :slight_smile: needs some tweaking but is a very good basis.

1 Like

Tweaked the repo a bit, refer to https://github.com/mm28ajos/fritzab such that it only stores the files locally. I removed the matrixcommander in the original repo, as I use matrix commander in its own container already and did not want to have an additional dependency to maintain. So my final solution is as follows, assuming you run openhab in a container and matrixcommander as well:

  1. Use the tweaked repo, see link above, to automatically download the TAM messages.
  2. Use the binding “folder watcher” to trigger an openhab rule on new TAM messages.
  3. Send the TAM messages via that rule and matrixcommander running in a separate docker container.

For an example rule of 2. refer to the following:

rule "New Local file"
when
    Channel "folderwatcher:localfolder:TAMfolder:newfile" triggered
then
    var pathToFile = receivedEvent.toString()
    if (pathToFile.contains(".ogg")) {
	MatrixMessageTAM.sendCommand(receivedEvent.toString())   
	Thread::sleep(20000)
	logInfo("logger", "Delete TAM message")
	var pathToMessage = pathToFile.replace("/path/to/TAMmessages/for/openhab","/path/to/TAMmessages/for/matrixcommander")
	executeCommandLine(Duration.ofSeconds(20), "/bin/bash", "-c", "echo \"rm "+ pathToMessage +"\" > /openhab/hostpipe" )
	executeCommandLine(Duration.ofSeconds(20), "/bin/bash", "-c", "echo \"rm "+ pathToMessage.replace("wav","ogg") +"\" > /openhab/hostpipe" )
    }
end

For how to do 3. see https://github.com/mm28ajos/OpenHABMatrixIntegration

1 Like