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

Read Timeout and nonce/realm request not successful #34

Closed ursius2020 closed 3 years ago

ursius2020 commented 4 years ago

Hi,

I'm still relatively new to NodeMCU / ESP8266 and TR-064 and unfortunately have a massive problem with timeouts and nonce / realm request not successful. I have modified a code from the Internet a little, the connection to the WLAN also works, only connecting via TR-064 or making a call does not work exactly as it should ... Router: Fritz!Box 7490 I keep getting the following errors, mostly in exactly this order:

HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Trying again in 1s.
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Giving up.
[action]<error> nonce/realm request not successful!
[action]<error> Retrying in 5s
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Trying again in 1s.
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Giving up.
[action]<error> Giving up the request

Here is my code:

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

const char* ssid     = "SSID";
const char* password = "password";

/* Put IP Address details */
const IPAddress local_ip(192, 168, 178, 12);
const IPAddress gateway(192, 168, 178, 1);
const IPAddress subnet(255, 255, 255, 0);
const IPAddress DNS(gateway);

const char DEVICE_NAME[] = "Door bell";

//fritzbox
const char USER[] = "esp8266klingel";
const char PASSWORD[] = "password"; 
const char FRITZBOX_IP[] = "192.168.178.1";
const int FRITZBOX_PORT = 49000;

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

void setup() {
  Serial.begin(115200);
  //connect to your local wi-fi network
  WiFi.hostname(DEVICE_NAME);
  WiFi.begin(ssid, password);
  WiFi.config(local_ip, gateway, subnet, DNS);

  //check wi-fi is connected to wi-fi network
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected..!");
  Serial.print("Got IP: ");  Serial.println(WiFi.localIP());
  Serial.println("Connecting to ");
  Serial.println(ssid);

  Serial.println("Initialize TR-064 connection");
  tr064_connection.init();
}

//*************************************************************************************
void loop() {
  Serial.println("Fritzbox call");
  String tr064_service = "urn:dslforum-org:service:X_VoIP:1";
  Serial.println("Call **610");

  String call_params[][2] = {{"NewX_AVM-DE_PhoneNumber", "**610"}};
  tr064_connection.action(tr064_service, "X_AVM-DE_DialNumber", call_params, 1);

  // Wait 4 seconds until hang up
  // 16000 ~ 4x ring bell
  delay(16000);

  tr064_connection.action(tr064_service, "X_AVM-DE_DialHangup"); //hier: [action]<error> nonce/realm request not successful!
  Serial.println("Dial Hangup");
  ESP.deepSleep(0);
}

Here is the complete output from the serial monitor:

.......
WiFi connected..!
Got IP: 192.168.178.12
Connecting to 
Buro
Initialize TR-064 connection
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Trying again in 1s.
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Giving up.
Fritzbox call
Call **610
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Trying again in 1s.
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Giving up.
[action]<error> nonce/realm request not successful!
[action]<error> Retrying in 5s
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Trying again in 1s.
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Giving up.
[action]<error> nonce/realm request not successful!
[action]<error> Retrying in 5s
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Trying again in 1s.
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Giving up.
[action]<error> nonce/realm request not successful!
[action]<error> Retrying in 5s
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Trying again in 1s.
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Giving up.
[action]<error> Giving up the request 
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Trying again in 1s.
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Giving up.
[action]<error> nonce/realm request not successful!
[action]<error> Retrying in 5s
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Trying again in 1s.
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Giving up.
[action]<error> nonce/realm request not successful!
[action]<error> Retrying in 5s
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Trying again in 1s.
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Giving up.
[action]<error> nonce/realm request not successful!
[action]<error> Retrying in 5s
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Trying again in 1s.
[HTTP]<Error> Failed, message: 'read Timeout'
[HTTP]<Error> Giving up.
[action]<error> Giving up the request 
Dial Hangup

Board-Settings in IDE: 2020-07-25

Several search queries on Google have also brought me no success

Aypac commented 4 years ago

Hi ursius2020, welcome to the ESP world :) It looks like the router cannot be reached at all. Can you just try and call https://192.168.179.1:49443/tr64desc.xml in any web browser? Do you get some XML -looking stuff? What kind of router do you have? If you have a FB, can you check this pleaser?

ursius2020 commented 4 years ago

I am using the FB 7490 Calling https://192.168.178.1:49443/tr64desc.xml gives me on PC something XML-looking, on iPad a little bit buggy gut doesn't matter. The user was not created under System> User, but via Telephony> Telephony Devices> New Telephone> WLAN / LAN. Some instructions for this specific project said so, the other so ...

Aypac commented 4 years ago

Hi,

sorry for the late response, got a bit busy. That is very weird, because it appears to me, that the ESP is not able to access that XML file. Can you do the following:

  1. Make sure that your ESP is directly connected¹ to the WIFI of the device hosting the TR-064 server (typically the router). You can do that by checking if the ESP shows up in the list of devices.
  2. Make sure that your ESP is NOT using the guest WIFI.
  3. Check if the the user rights for the account you created are sufficient.
  4. Try to use the default HTTP-Get example for the ESP to retrieve and print the XML.

¹ in theory, it should not be a problem to be connected via a repeater, but better be safe and exclude this.

Did any of that help? Did you get an output from 4.?

You can also try to use the branch 'debug_issue_30' and see if that works, but I would not really expect that to fix anything for you.

ursius2020 commented 4 years ago

Hi,

Sorry for my late reply after a restart of my FB everything works just fine. Final Question, how can i set a cutom name for caller? The displayed caller "ISDN-Rundruf" is not very meaningful or there is a risk of confusion ... When I configure the user that I created in the Telephony tab, the ESP always crashes. If I use the system user everything works just fine

Aypac commented 4 years ago

Good to hear. I have not used that feature myself, nor do I have a DECT phone to test, so I cannot really help you with this. Please let me know if you figure out how :)

Aypac commented 3 years ago

Main issue is solved. If you find out how to set the caller ID, please let us/me know :)