Fritz!Box Voicemail files

An item that has been on my todo list for a very long time, is finding a better way to handle voicemail.

Our Fritz!Box FON 7170 has a built-in Answering machine and a USB stick inserted into the back side. The files related to the answering machine are all stored on the USB stick and those files are all accessible by ftp and/or SMB. So everything is accessible, but finding out what to do with those files just never happened – until recently.

OK, where to start… The voiceboxrec directory contains a lot of small files, called rec.0.000, rec.0.001, and so on. I know these so-called rec files contain the encoded audio of the voice mail, but there’s no information about the phone number of the caller, time & date, the called number etc. I also knew that these ‘rec’ files could be converted to WAV format by a speexdec tool that can be found on the net. Half way there.

The missing information I mentioned above had to be found somewhere else, so I examined the rest of the files in the voicebox directory.  I noticed that a file called meta0 had a time-stamp that was equal to the date & time of the last voice-mail we received, so let’s have a look inside meta0:

00000000h: 5C 01 00 00 00 00 00 00 03 00 00 00 00 53 07 00 ; ............S..
00000010h: 16 1D 00 00 07 00 00 00 01 00 00 00 01 00 00 00 ; ................
00000020h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
00000030h: 00 00 00 00 30 31 32 33 34 35 36 37 38 39 00 00 ; ....0123456789..
00000040h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
00000050h: 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ...............
00000060h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
00000070h: 00 00 00 00 00 00 00 00 00 00 00 00 72 65 63 2E ; ............rec.
00000080h: 30 2E 30 30 30 00 00 00 00 00 00 00 00 00 00 00 ; 0.000...........
00000090h: 00 00 00 00 00 00 00 00 00 00 00 00 2F 76 61 72 ; ............/var
000000a0h: 2F 6D 65 64 69 61 2F 66 74 70 2F 55 53 42 46 6C ; /media/ftp/USBFl
000000b0h: 61 73 68 4D 65 6D 6F 72 79 2D 30 31 2F 46 52 49 ; ashMemory-01/FRI
000000c0h: 54 5A 2F 76 6F 69 63 65 62 6F 78 2F 72 65 63 2F ; TZ/voicebox/rec/
000000d0h: 72 65 63 2E 30 2E 30 30 30 00 00 00 00 00 00 00 ; rec.0.000.......
000000e0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
000000f0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
00000100h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
00000110h: 00 00 00 00 00 00 00 00 00 00 00 00 13 0B 09 0B ; ................
00000120h: 12 00 00 00 E8 8B 66 25 00 0C AB 2A 50 00 01 00 ; ....è‹f%..«*P...
00000130h: 00 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 ; ........ .......
00000140h: 30 31 32 33 34 35 36 37 38 39 00 00 00 00 00 00 ; 0123456789......
00000150h: 00 00 00 00 00 00 00 00 00 00 00 00 5C 01 00 00 ; ...............
00000160h: 01 00 00 00 03 00 00 00 00 53 07 00 2D 10 00 00 ; .........S..-...
00000170h: 06 00 00 00 01 00 00 00 01 00 00 00 00 00 00 00 ; ................
00000180h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
00000190h: 39 38 37 36 35 34 33 32 31 30 00 00 00 00 00 00 ; 9876543210......
000001a0h: 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 ; ............ ...
000001b0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
000001c0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; ................
000001d0h: 00 00 00 00 00 00 00 00 72 65 63 2E 30 2E 30 30 ; ........rec.0.00
000001e0h: 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; 1...............
000001f0h: 00 00 00 00 00 00 00 00 2F 76 61 72 2F 6D 65 64 ; ......../var/med
00000200h: 69 61 2F 66 74 70 2F 55 53 42 46 6C 61 73 68 4D ; ia/ftp/USBFlashM

Hmm, this is interesting. I see phonenumbers, file names, even including path, so I’m looking in the right file.

Let’s see if I can find a record size or something else with which I can determine the bytes that belong to a single voice mail. The first filename I found starts at position $007C and the second one starts at position $01D8. $01D8-$007C = 472-124=348 ($015C). Hey, that’s the first 2 bytes in the file! And at position $015C those 2 bytes are found again.. and again.. all the way to the end of the file.

So I think this is some sort of data file with variable length records, where the first (2?) bytes contain the length of the record that is following those 2 bytes (in this case, all the records have a length of $015C). If I’m right, the rest of the information I’m looking for per voice-mail, has to be somewhere inside those 348 bytes. Besides 2 phonenumbers and a filename, it would also be nice to have a date & time.

So I asked everybody to not pick up the phone so that I could leave a new message on the Fritz answering machine and examined the meta0 file to see if I could find the known date & time somewhere. Ha! 5 bytes, containing year-2000, month, day, hour and minute, starting at offset $011C. And I also managed to find the voice mail duration in seconds (offset $0014)  and the file size. There are still some bytes of which I don’t know the meaning, but this is enough to start with I guess!

With this information from the meta file and some code I can easily present a grid with voice mail information on the Touchscreen. I can even add a ‘play’ button to listen to those voice mail(s)! Adding a ‘new’ indicator to those voice mails which will be reset once the wav file has been played.

Touchscreen

Wait, I can even play this wav file from my cell phone – a notification with a url in the message body and I’m done – lots of new opportunities!

Once I’ve got it all working here at home, I’ll upgrade my Homeseer Fritz!Box Plugin and make a nice web interface for listening to the voicemail.

Major upgrade of Fritz!Box Plugin for Homeseer

This week i published a major Upgrade for the Fritz!Box Plugin for Homeseer.

As i mentioned before, there were still some interesting things that could be added to the Plug-in and i thought it was time to revive the Plugin by adding some functionality that was asked for, make it future proof by supporting the newer firmware versions. Some of the things that have been added in the last 2 weeks are:

– Retrieving the Phone Book from the Fritz!Box and using it for Caller ID(entification);

– Searching websites on the Internet for Caller ID;

– Supporting the challenge/response security mechanism built into new firmware;

– Switching the WLAN from Homeseer;

– some useful stuff for use in scripts;

– upgrade of configuration pages to ASP.NET.

You can read all about it in more detail on domoticaforum.eu

This should do for some time; maybe some small additions or fixes, but that’s it for now; time to move on to development of another brand new and exciting Plugin! 🙂

Extensions for the Fritz!Box Plugin for Homeseer

It has been quiet regarding the Fritz!Box Plugin for Homeseer for a while, but that’s going to change; when others start creating scripts around my Plugin then you know there’s something missing and it’s time to have a look at it…

The last couple of days i was looking at how i could spend the huge amounts of free time i have lately and decided to spend it on extending the Plugin with some extra features; the Fritz!Box has a lot to offer, so there are still a lot of things to explore.

But first i had to tackle the new way of logging in to the Web-interface that has changed in the recent firmware versions (xx.04.74 and higher). This new method of logging in involves calculating MD5 value based on a challenge provided by the Fritz!Box, and having read once that a lot of faulty MD5 routines exist, i decided to look into that issue first. I mean, creating additional functionality without supporting the latest firmware sounds rather stupid to me.
OK, the sequence of actions to do a successful login were clear to me, that wouldn’t be the problem; only thing i hoped for was that the calculation of the MD5 hash would succeed with the .NET provided classes/routines. So i created a simple function that could return the MD5 of a given string:

MD5-Hash

The resulting md5bytes should contain the correct hash value when each byte was written as hex string value and all 16 of them were concatenated. But something strange was going on…

The AVM documentation stated the resulting MD5 should be: 9e224a41eeefa284df7bb0f26c2913e2 And what did i get? 58224a41eeefa284df7bb0f26c2913e2.

What’s this… well OK, it’s almost the same, maybe it will work, lol.
On the contrary, this ain’t funny at all of course… what’s going on here ??? I just didn’t know what was wrong; was it the encoding? The AVM guideline speaks of UTF-16LE (LE = Little Endian), BOM, trailing 0-bytes, Codepoints; not really the stuff i deal with on a daily basis, so …??

Searching MSDN i found this:

Not mine

With just a tiny adjustment (there where the cursor is) and it worked…

I still don’t understand why; these things can really bug me and now i’m struggling to either just go on and let it be, or go to the bottom of this?

Let’s hope i don’t encounter to much of these mysteries..  🙁

Fritz!Box Plugin for Homeseer released and working ok

After being released on March 25, 2009 it seems the Fritz!Box Plugin for Homeseer is doing fine. Pieter Knuvers, webmaster of Domoticaforum.eu dedicated a forum to my plugin. New requests keep coming in for additions to the plugin and few bugs have been reported since the first release. So you could say that the first Homeseer Plugin i ever made is a success. And there are more Plugins to come, 4 new Plugins are planned already 🙂 That’s all i can say for now… More information about the Plugin can be found here. (Dutch)

Fritz!Box Plugin for Homeseer progressing

capture_10-3-2009-1952301

Fritz!Box Plugin Devices in Homeseer

Work on the Fritz!Box Plugin for Homeseer is progressing. Currently it’s being tested while i’m working on the code to log all phone calls to an Access database.

The Plugin has been tested with the Fritz!Box FON WLAN 7170 and the 7270. Other models will be added to this list as more users will start using the Plugin.

This is what the Plugin Config page looks like:

capture_10-3-2009-1958081

Fritz!Box Plugin Configuration Page

The nicest feature (IMO) is that the information displayed in the Devicestring is user configurable.

That means that the user has control of what pieces of information (incoming or outgoing, phone numbers, call duration) are shown and their sequence.

I must say, after getting a bit familiar with Homeseer (i’ve never used it before, but had to install it to test my own plugin), i’m beginning to like writing Plugins for it 🙂 But using Homeseer as a regular user? No, not my cup of tea…

Homeseer Plugin for my Fritz!Box FON 7170

Since a few days i’m developing a Homeseer plugin for my Fritz!Box FON 7170.

Fritz!Box FON 7170

Fritz!Box FON 7170

Not for myself ofcourse (i’m not using Homeseer), but just to see if i could do a thing like that. And to help a Domotica buddy ofcourse 🙂

Not knowing anything about Homeseer, i managed to create a plugin that could serve as a trigger for Homeseer events. The plugin is going to be tested in the next couple of days. I hope everything will work out as expected and the plugin is stable enough to continue building on  a Homeseer plugin that could be usefull to all those who own both Homeseer and this Fritz.