Aypac / Arduino-TR-064-SOAP-Library

Arduino library for the TR-064 protocol, most commonly used by the Fritz!Box router API
Other
63 stars 21 forks source link

connection refused #43

Closed xbln closed 2 years ago

xbln commented 3 years ago

I get a 'connection refused' error on FB 7530 (7.12). When connecting the FB with a python routine and TLS port 49443 it works.

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <tr064.h>

const char WIFI_SSID[] = "funknetz1";   // <-- ändern
const char WIFI_PASSWORD[] = "ellenbogenschutz"; // <-- ändern
const char USER[] = "xyz";
const char PASSWORD[] = "Service0"; // <-- ändern
const char FRITZBOX_IP[] = "192.168.0.1";
const int FRITZBOX_PORT = 49000;
const char DEVICE_NAME[] = "ESP-Klingel";

TR064 tr064_connection(FRITZBOX_PORT, FRITZBOX_IP, USER, PASSWORD);

const IPAddress STATIC_IP(192, 168, 0, 230);
const IPAddress GATEWAY(192, 168, 0, 1);
const IPAddress SUBNET(255, 255, 255, 0);
const IPAddress DNS(GATEWAY);

String tr064_service = "urn:dslforum-org:service:X_VoIP:1";
String call_params[][2] = {{"NewX_AVM-DE_PhoneNumber", "**9"}};

void setup() {
  Serial.begin(115200); 
  WiFi.hostname(DEVICE_NAME);
  WiFi.config(STATIC_IP, SUBNET, GATEWAY, DNS);
  WiFi.begin(WIFI_SSID,WIFI_PASSWORD);
  WiFi.mode(WIFI_STA);
  while (WiFi.status() != WL_CONNECTED) { 
    delay(50);
    Serial.print(".");
  }
  Serial.printf("FritzBox client started, open %s\n", WiFi.localIP().toString().c_str()); 
  Serial.println("start TR-064 init"); 
  tr064_connection.init();
  tr064_connection.debug_level = DEBUG_VERBOSE;
  Serial.println("end TR-064 init"); 
}

void loop() {
  Serial.println("start loop"); 

  Serial.println("start ring"); 
  // Die Telefonnummer **9 ist der Fritzbox-Rundruf.
  tr064_connection.action(tr064_service, "X_AVM-DE_DialNumber", call_params, 1);
  Serial.println("end ring"); 

  // Warte vier Sekunden bis zum auflegen
  delay(4000);
  Serial.println("start hangup"); 
  tr064_connection.action(tr064_service, "X_AVM-DE_DialHangup");
  Serial.println("end hangup"); 

  delay(30000);
  Serial.println("end loop"); 

}

Output:

04:01:25.209 -> ⸮........FritzBox client started, open 192.168.0.230 04:01:25.594 -> start TR-064 init 04:01:31.897 -> [HTTP] Failed, message: 'connection refused' 04:01:31.897 -> [HTTP] Trying again in 1s. 04:01:39.085 -> [HTTP] Failed, message: 'connection refused' 04:01:39.132 -> [HTTP] Giving up. 04:01:39.132 -> end TR-064 init 04:01:39.132 -> start loop 04:01:39.132 -> start ring 04:01:45.527 -> [HTTP] Failed, message: 'connection refused' 04:01:45.527 -> [HTTP] Trying again in 1s. 04:01:52.893 -> [HTTP] Failed, message: 'connection refused' 04:01:52.893 -> [HTTP] Giving up. 04:01:52.893 -> [action] nonce/realm request not successful! 04:01:52.893 -> [action] Retrying in 5s 04:02:04.256 -> [HTTP] Failed, message: 'connection refused' 04:02:04.256 -> [HTTP] Trying again in 1s. 04:02:11.627 -> [HTTP] Failed, message: 'connection refused' 04:02:11.627 -> [HTTP] Giving up. 04:02:11.627 -> [action] nonce/realm request not successful! 04:02:11.627 -> [action] Retrying in 5s 04:02:22.884 -> [HTTP] Failed, message: 'connection refused' 04:02:22.884 -> [HTTP] Trying again in 1s. 04:02:30.196 -> [HTTP] Failed, message: 'connection refused' 04:02:30.196 -> [HTTP] Giving up. 04:02:30.196 -> [action] nonce/realm request not successful! 04:02:30.196 -> [action] Retrying in 5s 04:02:41.443 -> [HTTP] Failed, message: 'connection refused' 04:02:41.443 -> [HTTP] Trying again in 1s. 04:02:48.786 -> [HTTP] Failed, message: 'connection refused' 04:02:48.786 -> [HTTP] Giving up. 04:02:48.833 -> [action] Giving up the request 04:02:48.833 -> end ring 04:02:52.826 -> start hangup 04:02:59.137 -> [HTTP] Failed, message: 'connection refused' 04:02:59.137 -> [HTTP] Trying again in 1s. 04:03:06.480 -> [HTTP] Failed, message: 'connection refused' 04:03:06.480 -> [HTTP] Giving up. 04:03:06.480 -> [action] nonce/realm request not successful! 04:03:06.480 -> [action] Retrying in 5s 04:03:17.795 -> [HTTP] Failed, message: 'connection refused' 04:03:17.795 -> [HTTP] Trying again in 1s. 04:03:25.198 -> [HTTP] Failed, message: 'connection refused' 04:03:25.198 -> [HTTP] Giving up. 04:03:25.198 -> [action] nonce/realm request not successful! 04:03:25.198 -> [action] Retrying in 5s 04:03:36.587 -> [HTTP] Failed, message: 'connection refused' 04:03:36.587 -> [HTTP] Trying again in 1s. 04:03:44.008 -> [HTTP] Failed, message: 'connection refused' 04:03:44.008 -> [HTTP] Giving up. 04:03:44.008 -> [action] nonce/realm request not successful! 04:03:44.008 -> [action] Retrying in 5s 04:03:55.341 -> [HTTP] Failed, message: 'connection refused' 04:03:55.341 -> [HTTP] Trying again in 1s. 04:04:02.731 -> [HTTP] Failed, message: 'connection refused' 04:04:02.731 -> [HTTP] Giving up. 04:04:02.731 -> [action] Giving up the request 04:04:02.731 -> end hangup 04:04:32.708 -> end loop

Aypac commented 3 years ago

Hi xbln, that is strange :/ Did you use an account other than "admin"? Did you try running it with const int FRITZBOX_PORT = 49443;? What python script did you use?

xbln commented 3 years ago

Hi Aypac,

yes, I tried with 49443. I also tried with an existing FritzBox user, but in vain.

The python code is:

from fritzconnection.lib.fritzcall import FritzCall

FRITZ_IP_ADDRESS = '192.168.0.1' FRITZ_TCP_PORT = 49000 FRITZ_TLS_PORT = 49443 FRITZ_USERNAME = 'admin' FRITZ_PASSWORD = 'Service0'

fc = FritzCall(address='192.168.0.1',password = 'Service0') print(fc.dial('**9'))

This code works fine.

Viele Grüße

Martin Esche martin.esche@gmx.de Mobil 0171 4103644

Am So., 17. Jan. 2021 um 12:53 Uhr schrieb René Vollmer < notifications@github.com>:

Hi xbln, that is strange :/ Did you use an account other than "admin"? Did you try running it with const int FRITZBOX_PORT = 49443;? What python script did you use?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Aypac/Arduino-TR-064-SOAP-Library/issues/43#issuecomment-761799402, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGSHI6LJKIU4XRAX2HRQ5SDS2LFSHANCNFSM4WFYNMKA .

Aypac commented 2 years ago

Dear Martin, please try the latest release of the library. Does the problem remain?

Aypac commented 2 years ago

Hi Martin/ @xbln , Please try the new release 1.2.1. If this does not solve your issue, please reopen this issue.