Ich kann das bei mir nicht testen, aber vielleicht gibt die Response einen Hinweis:
JavaScript
function sendReconnect(host, port) {
Shelly.call(
"HTTP.Request",
{
method: "POST",
url: "http://" + host + ":" + port.toString() + "/igdupnp/control/WANIPConn1",
headers: {
"Content-Type": 'text/xml; charset="utf-8"',
SoapAction: "urn:schemas-upnp-org:service:WANIPConnection:1#ForceTermination",
},
body: [
'<?xml version="1.0" encoding="utf-8"?>',
'<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">',
" <s:Body>",
' <u:ForceTermination xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1"/>',
" </s:Body>",
"</s:Envelope>",
].join(""),
},
function (response, error_code, error_message) {
if (error_code !== 0) {
print("Call failed with error " + error_code + " (" + error_message + "). ");
} else if (response.code !== 200) {
print("Fritzbox responded with HTTP code " + response.code + " (" + response.message + "). ");
} else {
print("Fritzbox response: " + response.body);
}
},
);
}
sendReconnect("fritz.box", 49000);
Alles anzeigen