Call phone with Fritzbox binding and fritzconnection

Hi, in the latest c’t (17/2020, page 128) is an article about the python library fritzconnection which is used to make a call to the internal phones. Does anyone know how to make an addin for openhab out of this?

This one ?

Use it like this in Openhab

rule "VoIP Call"
when
 Item XYZ changed from OFF to ON
then
 executeCommandLine("/opt/sipcmd/sipcmd -P sip -u voip_user -c voip_password -a Doorbell -w fritz.box -x **611;h")
end

no, this one: https://pypi.org/project/fritzconnection/
I found several posts stating that sipcmd doesn’t work well.

Are you sure that this Libary can make phone calls? I don’t think that’s possible. Because the library is not a SIP client. The Libary only make API calls via TR064.

As far as I understand the online article ( do not have access to the complete article; just the first lines as I do not have a paid account ) it’s just about making all phones ringing not a voip call.
Nevertheless you already gave an answer to create a rule using executeCommandLine which also should work to run the python script.

Note: The dial-help of the Fritz!Box must be activated to make this work.

Exactly, it is only the Fritzbox dialing aid and not an independent SIP client.

https://fritzconnection.readthedocs.io/en/1.3.4/sources/library.html#module-fritzconnection.lib.fritzcall

Yes, it is just a tool to make all internal phones ringing for some seconds (external should be possible also). So if someone rings your door bell you can see it also on the phone.

The usage within an addin could be better than a command line. Could this be inserted into a fritz-tr064-binding?

Yes, certainly possible, but very unlikely that someone will do that. The binding is version 1 and version 1 is no longer supported from Openhab 3.

There is a new binding for TR064 communication in the pipeline (see here). IIRC it should cover all available features based on the protocol standards. To be honest I do not know if the method used in the Python library bus TR064 or AVM specific but you can give it a try.

3 Likes

did some first steps with fritzconnection, share some learnings about:

  • requires python 3.6 or higher. had troubles with raspian because different python versions, was not able to install fritzconnection
  • changed my system to ubuntu 20, which does not include python as native, was able to install a “fresh” python 3.7 without any conflicts. fritzconnection install was easy and fast
  • made a script (included call_actions from fritzconnection modules), was easy too. stored in “scripts” folder in the openhab directories (i think this is not a mandatory)
  • installed exec binding to execute commands from openhab
  • run the script related to a switch item - phones rings!
    tr064 need to be enabled in your fritzbox. what i’ve seen so far: i have access to many (if not all) informations/commands/settings of the fritzbox.
1 Like