kbr / fritzconnection

Python-Tool to communicate with the AVM Fritz!Box by the TR-064 protocol and the AHA-HTTP-Interface
MIT License
303 stars 59 forks source link

How to get VoIP data from FritzBox 7490? #186

Closed mattbue closed 7 months ago

mattbue commented 1 year ago

Hi, I would like to read out the VoIP data from my FritzBox 7490 (SW Version 7.29). The software is running on a Debian 11 based LXC-Container on Proxmox.

I started trying to read out the VoIP accounts using the following code:

from fritzconnection import FritzConnection

fc = FritzConnection(address="192.168.178.1", user="my_username", password="my_password")
print(fc)  # print router model information

voip_info = fc.call_action('X_VoIP', 'X_AVM-DE_GetVoIPAccounts')
print(voip_info)

The action name comes from https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/x_voip-avm.pdf page 13.

The user I'm using has full administration rights.

But this throws the following error:

root@fritzbox-readout-test:~# python3 fritzbox.py
FRITZ!Box 7490 at http://192.168.178.1
FRITZ!OS: 7.29
Traceback (most recent call last):
  File "/root/fritzbox.py", line 6, in <module>
    voip_info = fc.call_action('X_VoIP', 'GetVoIPAccounts')
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/core/fritzconnection.py", line 441, in call_action
    return self.soaper.execute(service, action_name, arguments)
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/core/soaper.py", line 286, in execute
    return handle_response(response)
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/core/soaper.py", line 268, in handle_response
    raise_fritzconnection_error(response)
  File "/usr/local/lib/python3.9/dist-packages/fritzconnection/core/soaper.py", line 191, in raise_fritzconnection_error
    raise exception(message)
fritzconnection.core.exceptions.FritzActionError: UPnPError:
errorCode: 401
errorDescription: Invalid Action

Any idea what I'm doing wrong to that this error occurs?

Thank you Best regards mattbue

kbr commented 1 year ago

This error is forwarded from the router. See also issue #185. Seems to be that an admin user created by the router web-interface does not have all necessary rights for some actions. May be that AVM knows more about this.