hendrikw01 / tr-064

TR-064 - UPnP/IGD for node.js
Apache License 2.0
35 stars 24 forks source link

Do the given examples work for you? #9

Open derandiunddasbo opened 8 years ago

derandiunddasbo commented 8 years ago

I wonder if the examples provided in the readme for the library are (still) working for everybody else except me...

According to the dump of services and actions from my FritzBox device (FB 7490 / FRITZ!OS 06.30), there is no 'WANIPConnection' service over TR064 protocol and thus no 'GetInfo' Action for this service.

Actually there is a 'WANIPConnection' service, but it's only provided via IGD, and it offers no 'GetInfo' action. Only 'GetStatusinfo' and some more actions related to establishing WAN connections and managing upnp port forwardings.

I'm a little puzzled over this problem, as this particular example ("urn:schemas-upnp-org:service:WANIPConnection:1#GetInfo") can be found on several other sites dealing with TR-064 on FritzBox devices.

This example seems to work for everyone else except me.I begin to suspect, that AVM somehow changed the TR-064 implementation in one of the latest FritzOS versions. But I'd be surprised if me of all people noticed this first. :)

So here is my question: Do these examples work for you? And if yes: which FritzBox Device with what FritzOS Version are you querying?

bufemc commented 7 years ago

You are correct, that's strange. If you run the showDevice(device); from the README.md you also get this in the list:

---> urn:dslforum-org:service:WANIPConnection:1 <---
# GetInfo()

[I found also the other: urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" on the www] However, if I run the urn:dsl-forum choice I get this:

..
<UPnPError xmlns="urn:dslforum-org:control-1-0">
<errorCode>401</errorCode>
<errorDescription>Invalid Action</errorDescription>
..

I have a newer Fritz!Box, too. And, the other examples work as expected.

bufemc commented 7 years ago

It's getting even better: in https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/wanipconnSCPD.pdf

you find this: urn:WANIPConnection-com:serviceId:WANIPConnection1

But does not work (here), too. The only way which seem to work therefore, but did not try yet:

http://www.gtkdb.de/index_7_2570.html https://wiki.ubuntuusers.de/FritzBox/Skripte/

hendrikw01 commented 7 years ago

With my 7490 on version 06.83 the urn:dslforum-org:service:WANIPConnection:1 service does work over TR064 but no useful information:

{ NewEnable: '1',
  NewConnectionStatus: 'Connecting',
  NewPossibleConnectionTypes: 'IP_Routed, IP_Bridged',
  NewConnectionType: 'IP_Routed',
  NewName: 'mstv',
  NewUptime: '0',
  NewLastConnectionError: 'ERROR_NONE',
  NewRSIPAvailable: '0',
  NewNATEnabled: '1',
  NewExternalIPAddress: '0.0.0.0',
  NewDNSServers: '0.0.0.0, 0.0.0.0',
  NewMACAddress: 'XX:XX:XX:XX:XX:XX',
  NewConnectionTrigger: 'AlwaysOn',
  NewRouteProtocolRx: 'Off',
  NewDNSEnabled: '1',
  NewDNSOverrideAllowed: '0' }
bufemc commented 7 years ago

First I played with a browsify-ed version of your TR064 node module, as I wanted to use it without node.js. However the single bundle.js file then grows over 2 MB, because it contains all stuff from all dependencies, like Huffmann etc. I like your module, but would need only a small part of it, however it fetches all xml config files from the Fritz!Box, which causes too much network traffic in the beginning IMHO.

So I played a little bit with plain JS. I started with just the IP config. These are the results:

  1. I request http://fritz.box:49000/igddesc.xml Then I traverse through all services and search for "WANIPConnection:1". If found, I save the serviceType and the controlUrl. This I had to do, because some older Fritz!Boxes seem to use "upnp", but newer ones use "igdupnp". Could even happen the control urls are different, but never have seen that, I just wanted to be sure that it works for every Fritz!Box.

  2. By POST method I send either a SOAP envelope for GetExternalIPAddress to the former detected controlUrl etc. Then I get in return a SOAP envelope containing the IP. Or I send a request to ForceTermination (response seems just to be empty?) and a little bit delayed I trigger a request to get the (new) GetExternalIPAddress.

However, as you see I just used UPNP for that. Sorry, source code is on another computer ATM. If interested, I can deliver it later.