[Gelöst] FB_Callmonitor stolpert über Fritzbox-TB: "this is not a FritzBox phonebook"

Begonnen von Baumi, 01 Januar 2016, 21:23:04

Vorheriges Thema - Nächstes Thema

Baumi

Hallo und frohes neues Jahr!

Ich wollte ich den FB_Callmonitor für eine FB 7430, FritzOS 6.26 auf einem raspi einrichten, aber der weigert sich beharrlich.

Kurz das Szenario:


  • Callmonitor auf der FritzBox wurde mit #96*5* eingeschaltet
  • Auf der Box sind zwei Telefonbücher: Telefonbuch (das interne FB-Telefonbuch) und GMail (externes Telefonbuch via GMail-Anbindung)
  • Geladen werden soll das zweite (GMail), das interne Telefonbuch hat nur den AVM-Standard-Eintrag

Hier ist das define von FB_Callmonitor:

define fon FB_CALLMONITOR 192.168.178.1
attr fon fritzbox-remote-phonebook 1
attr fon fritzbox-remote-phonebook-exclude Telefonbuch
attr fon fritzbox-remote-phonebook-via tr064
attr fon reverse-search phonebook,klicktel.de,dasoertliche.de
attr fon reverse-search-cache 1
attr fon reverse-search-cache-file /opt/fhem/fhem-fon-cache
attr fon room study
attr fon verbose 5


Ein "set fon password <MEINPASSWORT>" gibt in FHEMWEB Folgendes zurück:

unable to check password - could not parse remote phonebook Telefonbuch - this is not a FritzBox phonebook

Im Log steht bei verbose 5 dann das hier:
2016.01.01 21:07:04 4: FB_CALLMONITOR (fon) - identifying available phonebooks
2016.01.01 21:07:04 5: FB_CALLMONITOR (fon) - requesting TR-064 authentication challenge:
<?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:Header>
    <h:InitChallenge xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1">
      <UserID>admin</UserID>
    </h:InitChallenge >
  </s:Header>
  <s:Body>
    <u:SetEnable xmlns:u="urn:dslforum-org:service:X_AVM-DE_OnTel:1">
    </u:SetEnable>
  </s:Body>
</s:Envelope>

2016.01.01 21:07:05 5: FB_CALLMONITOR (fon) - received TR-064 challenge response:
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Header>
<h:Challenge xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1">
<Status>Unauthenticated</Status>
<Nonce>ACA26A1544BF8344</Nonce>
<Realm>F!Box SOAP-Auth</Realm>
</h:Challenge>
</s:Header>
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:dslforum-org:control-1-0">
<errorCode>503</errorCode>
<errorDescription></errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
2016.01.01 21:07:05 4: FB_CALLMONITOR (fon) - generated auth string for phonebook request: 9716a5ed2e254b9ca86374e62be5f860
2016.01.01 21:07:05 5: FB_CALLMONITOR (fon) - requesting available phonebook id's:
<?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:Header>
    <h:ClientAuth xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1">
      <Nonce>ACA26A1544BF8344</Nonce>
      <Auth>9716a5ed2e254b9ca86374e62be5f860</Auth>
      <UserID>admin</UserID>
      <Realm>F!Box SOAP-Auth</Realm>
    </h:ClientAuth>
  </s:Header>
  <s:Body>
        <u:GetPhonebookList xmlns:u="urn:dslforum-org:service:X_AVM-DE_OnTel:1">
        </u:GetPhonebookList>
  </s:Body>
</s:Envelope>

2016.01.01 21:07:05 5: FB_CALLMONITOR (fon) - received response:
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Header>
<h:NextChallenge xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1">
<Status>Authenticated</Status>
<Nonce>1D8AA3F7FDF4289A</Nonce>
<Realm>F!Box SOAP-Auth</Realm>
</h:NextChallenge>
</s:Header>
<s:Body>
<u:GetPhonebookListResponse xmlns:u="urn:dslforum-org:service:X_AVM-DE_OnTel:1">
<NewPhonebookList>0,1</NewPhonebookList>
</u:GetPhonebookListResponse>
</s:Body>
</s:Envelope>
2016.01.01 21:07:05 3: FB_CALLMONITOR (fon) - found 2 phonebooks
2016.01.01 21:07:05 5: FB_CALLMONITOR (fon) - requesting phonebook description for id 0:
<?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:Header>
    <h:ClientAuth xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1">
      <Nonce>ACA26A1544BF8344</Nonce>
      <Auth>9716a5ed2e254b9ca86374e62be5f860</Auth>
      <UserID>admin</UserID>
      <Realm>F!Box SOAP-Auth</Realm>
    </h:ClientAuth>
  </s:Header>
  <s:Body>
    <u:GetPhonebook xmlns:u="urn:dslforum-org:service:X_AVM-DE_OnTel:1">
      <NewPhonebookID>0</NewPhonebookID>
    </u:GetPhonebook>
  </s:Body>
</s:Envelope>

2016.01.01 21:07:05 5: FB_CALLMONITOR (fon) - received response with phonebook description for id 0:
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Header>
<h:NextChallenge xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1">
<Status>Authenticated</Status>
<Nonce>304AC4D2BD174C5C</Nonce>
<Realm>F!Box SOAP-Auth</Realm>
</h:NextChallenge>
</s:Header>
<s:Body>
<u:GetPhonebookResponse xmlns:u="urn:dslforum-org:service:X_AVM-DE_OnTel:1">
<NewPhonebookName>Telefonbuch</NewPhonebookName>
<NewPhonebookExtraID></NewPhonebookExtraID>
<NewPhonebookURL>http://192.168.178.1:49000/phonebook.lua?sid=7240c9bf256ebb48&amp;pbid=0</NewPhonebookURL>
</u:GetPhonebookResponse>
</s:Body>
</s:Envelope>
2016.01.01 21:07:05 4: FB_CALLMONITOR (fon) - found phonebook: Telefonbuch - 0
2016.01.01 21:07:05 4: FB_CALLMONITOR (fon) - found phonebook url for id 0: http://192.168.178.1:49000/phonebook.lua?sid=7240c9bf256ebb48&pbid=0
2016.01.01 21:07:05 5: FB_CALLMONITOR (fon) - requesting phonebook description for id 1:
<?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:Header>
    <h:ClientAuth xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1">
      <Nonce>ACA26A1544BF8344</Nonce>
      <Auth>9716a5ed2e254b9ca86374e62be5f860</Auth>
      <UserID>admin</UserID>
      <Realm>F!Box SOAP-Auth</Realm>
    </h:ClientAuth>
  </s:Header>
  <s:Body>
    <u:GetPhonebook xmlns:u="urn:dslforum-org:service:X_AVM-DE_OnTel:1">
      <NewPhonebookID>1</NewPhonebookID>
    </u:GetPhonebook>
  </s:Body>
</s:Envelope>

2016.01.01 21:07:05 5: FB_CALLMONITOR (fon) - received response with phonebook description for id 1:
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Header>
<h:NextChallenge xmlns:h="http://soap-authentication.org/digest/2001/10/" s:mustUnderstand="1">
<Status>Authenticated</Status>
<Nonce>128DBB0364FA22A8</Nonce>
<Realm>F!Box SOAP-Auth</Realm>
</h:NextChallenge>
</s:Header>
<s:Body>
<u:GetPhonebookResponse xmlns:u="urn:dslforum-org:service:X_AVM-DE_OnTel:1">
<NewPhonebookName>GMail</NewPhonebookName>
<NewPhonebookExtraID></NewPhonebookExtraID>
<NewPhonebookURL>http://192.168.178.1:49000/phonebook.lua?sid=7240c9bf256ebb48&amp;pbid=240</NewPhonebookURL>
</u:GetPhonebookResponse>
</s:Body>
</s:Envelope>
2016.01.01 21:07:05 4: FB_CALLMONITOR (fon) - found phonebook: GMail - 240
2016.01.01 21:07:05 4: FB_CALLMONITOR (fon) - found phonebook url for id 240: http://192.168.178.1:49000/phonebook.lua?sid=7240c9bf256ebb48&pbid=240
2016.01.01 21:07:05 4: FB_CALLMONITOR (fon) - phonebooks found: Telefonbuch (id: 0), GMail (id: 240)
2016.01.01 21:07:05 4: FB_CALLMONITOR (fon) - requesting phonebook id 0 (Telefonbuch)
2016.01.01 21:07:05 4: FB_CALLMONITOR (fon) - get export for phonebook: 0
2016.01.01 21:07:05 5: FB_CALLMONITOR (fon) - received http response code 200
2016.01.01 21:07:05 2: FB_CALLMONITOR (fon) - could not parse remote phonebook Telefonbuch - this is not a FritzBox phonebook


Danach sieht es in FHEMWEB zunächst so aus, als sei ich in die FritzBox eingeloggt (set password ist nicht verfügbar, dafür aber andere Kommandos), wenn ich aber versuche, einen Befehl abzusetzen, bekomme ich im Log nur:

2016.01.01 21:12:25 2: FB_CALLMONITOR (fon) - could not identify remote phonebooks - no password available to access FritzBox

Danach bietet mir FHEMWEB  dann wieder an, das FritzBox-Passwort einzugeben, etc.

Ich hab' keine Ahnung, ob das ein Konfigurationsfehler von mir ist oder was sonst dahinter steckt, und leider konnte ich auch via Google und Forumssuche nichts über die Fehlermeldungen in Erfahrung bringen. Kann mir da vielleicht jemand von euch weiterhelfen?

Ich hoffe, ich hab' alle nötigen Infos in den Post gepackt, sonst bitte meckern, damit ich nachbessern kann. Danke!

Markus Bloch

Hallo Baumi,

nein ein Konfigurationsfehler liegt hier nicht vor. Mach bitte das gleiche nochmal, setz das Passwort und dann beobachte bitte die Logs.

Sobald folgende Zeile kommt:

Zitat
2016.01.01 21:07:05 4: FB_CALLMONITOR (fon) - found phonebook: GMail - 240
2016.01.01 21:07:05 4: FB_CALLMONITOR (fon) - found phonebook url for id 240: http://192.168.178.1:49000/phonebook.lua?sid=7240c9bf256ebb48&pbid=240

Diese URL bitte einmal im Browser eingeben. Bitte davon mal so die ersten 20-30 Zeilen nehmen, alle Nummern/Namen unkenntlich machen und posten. Ich nehme an, dass hier Änderungen an der XML-Struktur enthalten sind, sodass das Telefonbuch von FB_CALLMONITOR nicht mehr als gültig erachtet wird.

Vielen Dank

Gruß
Markus
Developer für Module: YAMAHA_AVR, YAMAHA_BD, FB_CALLMONITOR, FB_CALLLIST, PRESENCE, Pushsafer, LGTV_IP12, version

aktives Mitglied des FHEM e.V. (Technik)

Baumi

Hallo!

Danke für die Antwort.

Hier ist der anonymisierte Anfang der Datei:

<?xml version="1.0" encoding="UTF-8"?>
<phonebooks>
<!-- 1, id:0 , name:Telefonbuch -->
<!-- 2, id:240 , name:GMail -->
<phonebook owner="240" name="GMail">
<timestamp>1451704800</timestamp>
<!-- number of contacts 323 -->
<contact>
<category>0</category>
<person>
<realName>AAAAAAAAAAAAA</realName>
</person>
<uniqueid>759</uniqueid>
<telephony>
<services>
</services>
<!-- numbers:1-->
<number type="home" quickdial="" vanity="" prio="1" >000000</number>
<!-- idx:0 -->
<!-- ringtoneidx:nil -->
</telephony>
</contact>
<contact>
<category>0</category>
<person>
<realName>BBBBBBBBBB</realName>
</person>
<uniqueid>899</uniqueid>
<telephony>
<services>
</services>
<!-- numbers:1-->
<number type="home" quickdial="" vanity="" prio="1" >000000</number>
<!-- idx:1 -->
<!-- ringtoneidx:nil -->
</telephony>
</contact>
<contact>
<category>0</category>
<person>
<realName>CCCCCCCCCCCCCCC</realName>
</person>
<uniqueid>725</uniqueid>
<telephony>
<services>
<!-- emails:2-->
<email classifier="business">example@example.com</email>
<email classifier="private">example@example.com</email>
</services>
<!-- numbers:6-->
<number type="work" quickdial="" vanity="" prio="1" >000000</number>
<number type="work" quickdial="" vanity="" prio="" >000000</number>
<number type="mobile" quickdial="" vanity="" prio="" >000000</number>
<number type="home" quickdial="" vanity="" prio="" >000000</number>
<number type="mobile" quickdial="" vanity="" prio="" >00000000</number>
<number type="home" quickdial="" vanity="" prio="" >000000</number>
<!-- idx:2 -->
<!-- ringtoneidx:nil -->
</telephony>
</contact>
<contact>
<category>0</category>
<person>
<realName>CCCCCCCCCCCC</realName>
<imageURL>/download.lua?path=https://www.google.com/...</imageURL>
</person>
<uniqueid>836</uniqueid>
<telephony>
<services>
<!-- emails:1-->
<email classifier="business">example@example.com</email>
</services>
<!-- numbers:1-->
<number type="work" quickdial="" vanity="" prio="1" >000000</number>
<!-- idx:3 -->
<!-- ringtoneidx:nil -->
</telephony>
</contact>


Hilft das weiter oder brauchst Du noch mehr?

Markus Bloch

Passt. Das File sieht genau so aus, wie es sein soll. Ich vermute, dass hier dein Perl mit einer Änderung die ich gemacht habe nicht klar kommt.

Ändere mal bitte Zeile 925 in 72_FB_CALLMONITOR.pm bei dir wie folgt ab und probier nochmal das Telefonbuch einzulesen:

    if($phonebook =~ /<contact/ and $phonebook =~ /<realName>/ and $phonebook =~ /<number/ and $phonebook =~ /<phonebook/ and $phonebook =~ /<\/phonebook>/)

Vielen Dank

Gruß
Markus
Developer für Module: YAMAHA_AVR, YAMAHA_BD, FB_CALLMONITOR, FB_CALLLIST, PRESENCE, Pushsafer, LGTV_IP12, version

aktives Mitglied des FHEM e.V. (Technik)

Baumi

Hallo!

Danke für die Antwort – die genau hat's nicht gelöst, aber sie hat mich auf die richtige Fährte gebracht, um den Fehler in meiner Installation zu finden. Es funktioniert jetzt.

Der Fehler im Detail:

Die neue Regex brachte dieselbe Fehlermeldung wie die alte. Kein Wunder, denn $password an der Stelle war:

<?xml version="1.0" encoding="UTF-8"?>
<phonebooks>
<!-- 1, id:0 , name:Telefonbuch -->
<phonebook owner="0" name="Telefonbuch">
<timestamp>0</timestamp>
<!-- not modified -->
</phonebook></phonebooks>


Da fehlten also jede Menge Einträge, die das Modul in einem FB-Telefonbuch erwartet

Wieso das interne Telefonbuch als komplett leer angezeigt wurde, weiß ich nicht – eigentlich ist der AVM-Standard-Eintrag drin. Liegt es vielleicht daran, dass das externe TB als Standard aktiviert ist?

Das brachte mich darauf, dass ich ja eigentlich ausdrücklich fritzbox-remote-phonebook-exclude benutzt hatte, um das interne TB auszuschließen. Nur hatte ich da leider den Namen (also "Telefonbuch") benutzt. Als ich stattdessen die id (also "0") eintrug, klappte alles problemlos.

Letztendlich war es also ein Config-Fehler von mir. Allerdings weiß ich nicht, ob es beabsichtigt ist, dass ein leeres internes Telefonbuch es unmöglich macht, die folgenden TBs auszulesen, wenn es nicht explizit ausgeschlossen wird. Falls ja, war es zu 100% mein Fehler. Falls das Modul hingegen normalerweise mit so einer Konstellation klar kommen sollte, kann ich ggf. gerne beim Testen und Debuggen helfen.

Markus Bloch

Das ist durchaus eher ein Modulfehler als Fehlkonfiguration.

Ich habe daher folgende Änderungen durchgeführt und getestet:

- Bei einem leeren Telefonbuch (wie in deinem Falle) wird keine Fehlermeldung "this is not a FritzBox phonebook" mehr generiert, sondern es kommt lediglich: "read 0 contacts from remote phonebook ..."
- Sollte bei einem Telefonbuch der Fehler "this is not a FritzBox phonebook" kommen, werden alle weiteren Telefonbücher trotzdem weiter eingelesen.
- fritzbox-remote-phonebook-exclude kann nun auch mit Telefonbuchnamen gefüttert werden. D.h. man kann ID's und Namen zugleichermaßen verwenden. Ich würde Namen nur verwenden, wenn kein Komma darin enthalten ist.

Das ganze habe ich bei mir mit einem neuen leeren Telefonbuch erfolgreich getestet.

Gibts ab morgen via update.

Viele Grüße

Markus
Developer für Module: YAMAHA_AVR, YAMAHA_BD, FB_CALLMONITOR, FB_CALLLIST, PRESENCE, Pushsafer, LGTV_IP12, version

aktives Mitglied des FHEM e.V. (Technik)