Skip to content

Tools: fritzbox2baresip

Robert Scheck edited this page Apr 24, 2021 · 4 revisions

Tools: fritzbox2baresip

General

Small Python script to convert the XML telephone book from an AVM FRITZ!Box into the contact format of Baresip.

Get it

The latest version of fritzbox2baresip can always be downloaded directly from the default development Git branch.

Some Linux distributions even include this helper script as part of their baresip RPM packages.

Usage

Export from FRITZ!Box

Export your current telephone book as described in the knowledge base of AVM. After clicking "Save", your browser will offer the download of an XML file. See also the following screenshot (the actual look might vary depending on your FRITZ!Box model and FRITZ!OS firmware version) for a brief overview:

Screenshot of export

Conversion

Baresip stores its contacts in $HOME/.baresip/contacts. To avoid the accidental loss of possibly existing Baresip contacts while trying this tool, it might be a good idea to backup this file first, e.g. using cp -aiv $HOME/.baresip/contacts{,.backup}.

Most likely, the following command is what you need (it converts your previously exported telephone book and appends the result to the existing Baresip contacts:

fritzbox2baresip Downloads/FRITZ.Box_Phonebook.xml >> $HOME/.baresip/contacts

Alternatively, if your FRITZ!Box is not named fritz.box (factory default), you can pass the different name as third argument:

fritzbox2baresip Downloads/FRITZ.Box_Phonebook.xml - example.box >> $HOME/.baresip/contacts

If you however would like to write the result of the conversion into a separate file (or to replace an existing Baresip contacts file), change the second argument from - to the actual file name (remember, a possibly already existing target file will be overriden), for example:

fritzbox2baresip Downloads/FRITZ.Box_Phonebook.xml $HOME/.baresip/contacts

Any errors encountered during conversion will be shown on STDERR.

Please report bugs as an issue and also provide an obfuscated XML phone book as a reproducer.

Result in Baresip

In case you are using the GTK+ module of Baresip, the result after the conversion looks in Baresip like in the following screenshot (the actual look might vary depending on your Desktop Environment including the selected theme and the Baresip version):

Screenshot of result

Design

This tool has been implemented using the KISS principle and relies explicitly on the XML phone book rather on TR-064 (Technical Report 064), because safety-conscious users might have disabled TR-064 explicitly. Patches for additional TR-064 support are welcome tough.