Code Monkey home page Code Monkey logo

fritz's Introduction

Net::Fritz - perl module for AVM Fritz!Box interaction via TR-064

Build Status Coverage Status GPL 2+

what

Net::Fritz is a set of Perl modules to communicate with an AVM Fritz!Box (and possibly other routers as well) via the TR-064 protocol. The AVM Fritz!Box is a popular home router family in Germany (and beyond).

why

I wanted to use an old analog field telephone with my FritzBox and VoIP. While this works quite out-of-the box (it’s just an ordinary analog phone) for receiving calls, I have no way to dial a number for outgoing calls.

Luckily the Fritz!Box has a call helper mode where you can tell it to dial a number and patch it through to any local phone, but I found no Perl library to use this feature. So I wrote my own library - the one you’re looking at right now.

installation

The latest release of Net::Fritz can be installed directly from CPAN, eg. via

$ cpan -i Net::Fritz

or

$ cpanm Net::Fritz

building

To build and install the current development version of Net::Fritz module, you need to have Dist::Zilla installed. Run the dzil command - if it is available, Dist::Zilla should be installed.

To install or upgrade Dist::Zilla use

$ cpan -i Dist::Zilla

or

$ cpanm Dist::Zilla

Then clone this repository, enter it and start the install process:

$ git clone https://github.com/mmitch/fritz.git
$ cd fritz
$ dzil install

Any missing dependencies should be reported automatically and can be installed by

$ dzil authordeps --missing | cpanm
$ dzil listdeps --missing | cpanm

Afterwards, try the installation again with

$ dzil install

where to get it

Net::Fritz source is hosted at https://github.com/mmitch/fritz
The latest released version is available on CPAN at https://metacpan.org/release/Net-Fritz

more information

An example of how to use this library as a dial helper and call log tool can be seen at https://github.com/mmitch/fritzdial

A blog article covering my setup is here: https://www.cgarbs.de/blog/archives/1113-Feldtelefon-an-Fritzbox.html (German only)

copyright

Copyright (C) 2015 Christian Garbs [email protected]
Licensed under GNU GPL v2 or later.

fritz's People

Contributors

mmitch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fritz's Issues

Error on installing on Raspberry Pi

Hi,

I want to reinstall my Raspberry Pi. By installing the cpan module i get this error:
`t/00.load.t ............... 1/1 # Testing Net::Fritz v0.0.9
t/00.load.t ............... ok
t/01.fritz-isnoerror.t .... ok
t/02.fritz-error.t ........ ok
t/03.fritz-box.t .......... ok
t/04.fritz-data.t ......... ok
t/05.fritz-action.t ....... ok
t/06.fritz-service.t ...... ok
t/07.fritz-device.t ....... ok
t/08.fritz-device-call.t .. ok
t/09.fritz-box-call.t ..... ok
t/10.fritz-configfile.t ... Can't locate Test/TempDir/Tiny.pm in @inc (you may need to install the Test::TempDir::Tiny module) (@inc contains: /root/.cpan/build/Net-Fritz-v0.0.9-1/blib/lib /root/.cpan/build/Net-Fritz-v0.0.9-1/blib/arch /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/arm-linux-gnueabihf/perl5/5.24 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/arm-linux-gnueabihf/perl-base .) at t/10.fritz-configfile.t line 6.
BEGIN failed--compilation aborted at t/10.fritz-configfile.t line 6.

Looks like your test exited with 2 before it could output anything.

t/10.fritz-configfile.t ... Dubious, test returned 2 (wstat 512, 0x200)
Failed 18/18 subtests
t/60.connect-http.t ....... skipped: Not running author tests
t/61.connect-https.t ...... skipped: Not running author tests
t/80.pod-link-check.t ..... skipped: Not running author tests
t/author-critic.t ......... skipped: these tests are for testing by the author
t/author-pod-coverage.t ... skipped: these tests are for testing by the author
t/author-pod-linkcheck.t .. skipped: these tests are for testing by the author
t/author-pod-syntax.t ..... skipped: these tests are for testing by the author

Test Summary Report

t/10.fritz-configfile.t (Wstat: 512 Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: Bad plan. You planned 18 tests but ran 0.
Files=18, Tests=97, 10 wallclock secs ( 0.41 usr 0.11 sys + 8.69 cusr 0.58 csys = 9.79 CPU)
Result: FAIL
Failed 1/18 test programs. 0/97 subtests failed.
Makefile:913: die Regel für Ziel „test_dynamic“ scheiterte
make: *** [test_dynamic] Fehler 255
CGARBS/Net-Fritz-v0.0.9.tar.gz
one dependency not OK (Test::TempDir::Tiny); additionally test harness failed
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports CGARBS/Net-Fritz-v0.0.9.tar.gz`

Any idea, what i can try to install the module?

Solved your SSL Bug

Hi

found out whats the problem of you unreliable SSL problems is:
ua->ssl_opts only returns the keys of defined options, not the complete option hash. For this reason the transfers of options from ua to soap fails.

For this reason you should copy the ssl_opts like this:

[ map { $_ => $self->fritz->_ua->ssl_opts($_) } $self->fritz->_ua->ssl_opts ]

fritz-Service.patch.txt

Error while installing on Raspberry Pi

I wanted to install Fritz::Net on a Raspberry Pi. It always quits with an error, that dependencies are missing. Is there a manual for installing Fritz:Net::Box on a Raspberry Pi?

Error Message:
Failed during this command:
TODDR/XML-Parser-2.44.tar.gz : writemakefile NO '/usr/bin/perl Makefile.PL INSTALLDIRS=site' returned status 512
PHRED/SOAP-Lite-1.20.tar.gz : make_test NO one dependency not OK (XML::Parser); additionally test harness failed
(optional) SHLOMIF/XML-SemanticDiff-1.0005.tar.gz: make_test NO one dependency not OK (XML::Parser); additionally test harness failed
(optional) SEMANTICO/Test-XML-0.08.tar.gz : make_test NO one dependency not OK (XML::Parser); additionally test harness failed
(optional) PEVANS/Scalar-List-Utils-1.47.tar.gz: make NO
(optional) MANWAR/XML-XPath-1.40.tar.gz : make_test NO one dependency not OK (XML::Parser); additionally test harness failed
(optional) MIROD/XML-Twig-3.52.tar.gz : make_test NO one dependency not OK (XML::Parser); additionally test harness failed
(optional) GOZER/mod_perl-1.31.tar.gz : make NO
CGARBS/Net-Fritz-v0.0.4.tar.gz : make_test NO one dependency not OK (SOAP::Lite); additionally test harness failed

fix test errors with XML::Simple

For some time there have been some errors during the unit tests related to XML::Simple, for example for version 0.0.5 we currently have 797 build logged with passed and 4 logged with errors (see http://matrix.cpantesters.org/?dist=Net-Fritz%20v0.0.5).
The errors looked like this:

t/02.fritz-error.t ....... ok
Not a CODE reference at /home/sand/src/perl/repoperls/installed-perls/host/k93msid/v5.22.1/5ea4/lib/site_perl/5.22.1/x86_64-linux-thread-multi-ld/XML/SAX/Expat.pm line 70.
XML::Simple called at /tmp/loop_over_bdir-1582-EHochc/Net-Fritz-v0.0.4-0/blib/lib/Net/Fritz/Box.pm line 82.
# Looks like your test exited with 255 just after 5.
t/03.fritz-box.t ......... 
Dubious, test returned 255 (wstat 65280, 0xff00)

I did not understand the error and could not reproduce it.

Just now there are some fresh new errors in that actually contain a helpful error message:

t/02.fritz-error.t ....... ok
Nonblocking reads only make sense if you're giving me file handles, y'know (well, actually sockets). Use parse_file at /home/sand/src/perl/repoperls/installed-perls/host/k93msid/perl-5.8.5/89ad/lib/site_perl/5.8.5/XML/Simple.pm line 396.
XML::Simple called at /tmp/loop_over_bdir-24803-J2UscX/Net-Fritz-v0.0.5-0/blib/lib/Net/Fritz/Box.pm line 80.
# Looks like your test exited with 255 just after 5.
t/03.fritz-box.t ......... 
Dubious, test returned 255 (wstat 65280, 0xff00)

source: http://www.cpantesters.org/cpan/report/940f1ada-4d22-11e7-8e8a-3af4b41257c2

The new message seems to come from an update of XML::Simple from 2.22 to 2.24

That is something we can act upon!

switch from XML::Simple to another XML library

As one posting on Stackoverflow points out, XML::Simple produces the most complicated output of all XML processors. I can relate to that. The "simple" in XML::Simple seems to more refer to "designed to be used with simple XML".
This is no bashing, the XML::Simple documentation explicitely contains a note saying "don't use this in new projects".

Net::Fritz is quite new, I have encountered the problems associated with XML::Simple and so a switch is in order. The way to go seems to be either XML::LibXML or XML::Twig.

Get all WLAN devices (provided sample code)

I try to identify devices connected to WLAN using the sample code provided by distribution:

my $services = $d->find_service_names('Configuration:');
$services->errorcheck;
for my $serviceType (@{$services->data}) {
my $service = $d->get_service($serviceType);
$services->errorcheck;
my $response = $services->call('GetTotalAssociations');
$response->errorcheck;
# ...
}

Unfortunately script fails at cmd $services->call('GetTotalAssociations'); with error msg Can't locate object method "call" via package "Net::Fritz::Data"

Can't get WANIPConnection:1 to work (7490)

Here is my code:

use Net::Fritz::Box;

my $fritz    = Net::Fritz::Box->new(username=>'none', password=>'SECRET');
if ($fritz->error) {
    die $fritz->error;
}
# '/upnp/control/wanipconnection1';
my $device = $fritz->discover();
$device->errorcheck;

my $service = $device->find_service('DeviceInfo:1');
$service->errorcheck;

my $response = $service->call('GetSecurityPort');
$response->errorcheck;

printf "SSL communication port is %d\n",
$response->data->{NewSecurityPort};

$service = $device->find_service('WANIPConnection:1');
$service->errorcheck;

$response = $service->call('GetInfo');
$response->errorcheck;

use Data::Dumper;
$Data::Dumper::Indent=1;
print Dumper $response

The output is:

SSL communication port is 49443
Net::Fritz::Error: s:Client UPnPError 401 Invalid Action

So the first part works, the second failed.

Trying to attach a dump of $device, but github won't let me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.