ioBroker / AdapterRequests

This Place is used to track the status of new Adapter-Requests.
248 stars 36 forks source link

ioBroker-Adapter für 3cx-Telefonanlage #711

Open baerenwaldfreund opened 2 years ago

baerenwaldfreund commented 2 years ago

Ich wünsche mit einen ioBroker-Adapter für meine 3cx-Telefonanlage.

Es gibt auch eine API: https://3cx-controls.com/3cx-api-documentation/

Mit einem http-Request z.B. https://IP-der-Anlage:5001/api/SystemStatus bekommt man den Status der Anlage in JSON-Format zurück. Das würde doch bestimmt toll in einem Adapter umzusetzen sein. Es muss aber vorher eine Authenfizierung mit https://IP-der-Anlage:5001/api/login durchgeführt werden.

Noch jemand Interesse an so einem Adapter? Gibt es Entwickler, die das können?

bambi-arch commented 1 year ago

Das war super wenn es einen Adapter geben würde!

Apollon77 commented 1 year ago

@bambi-arch thumbs up is totally enough ... me too posts are not helpful

baerenwaldfreund commented 1 year ago

Der o.g. Link ist tot. Deshalb hier noch ein paar Infos.

Für das Login muss zuerst ein Cookie angelegt werden. Danach kann die Abfrage nach den Datenpunkten beginnen.

`curl 'https://myhost.my3cx.de:5001/api/login' \ -H 'authority: myhost.my3cx.de:5001' \ -H 'accept: application/json, text/plain, /' \ -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 Edg/88.0.705.63' \ -H 'content-type: application/json;charset=UTF-8' \ -H 'origin: https://myhost.my3cx.de:5001' \ -H 'sec-fetch-site: same-origin' \ -H 'sec-fetch-mode: cors' \ -H 'sec-fetch-dest: empty' \ -H 'referer: https://myhost.my3cx.de:5001/' \ -H 'accept-language: de' \ -b /tmp/curl-cookies.txt \ -c /tmp/curl-cookies.txt \ --data-raw '{"Username":"admin","Password":"xxx"}' \ --compressed

curl 'https://myhost.my3cx.de:5001/api/SystemStatus' \ -H 'authority: myhost.my3cx.de:5001' \ -H 'accept: application/json, text/plain, /' \ -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 Edg/88.0.705.63' \ -H 'content-type: application/json;charset=UTF-8' \ -H 'origin: https://myhost.my3cx.de:5001' \ -H 'sec-fetch-site: same-origin' \ -H 'sec-fetch-mode: cors' \ -H 'sec-fetch-dest: empty' \ -H 'referer: https://myhost.my3cx.de:5001/' \ -H 'accept-language: de' \ -b /tmp/curl-cookies.txt \ -c /tmp/curl-cookies.txt \ --compressed`

Mir bekannt sind bis jetzt folgende API-URLs:

https://myhost.my3cx.de:5001/api/SystemStatus https://myhost.my3cx.de:5001/api/ActiveCalls https://myhost.my3cx.de:5001/api/ServiceList https://myhost.my3cx.de:5001/api/ExtensionList https://myhost.my3cx.de:5001/api/TrunkList https://myhost.my3cx.de:5001/api/InboundRulesList https://myhost.my3cx.de:5001/api/OutboundRuleList https://myhost.my3cx.de:5001/api/IVRList https://myhost.my3cx.de:5001/api/RingGroupList https://myhost.my3cx.de:5001/api/CallLog?callState=All&dateRangeType=Yesterday https://myhost.my3cx.de:5001/api/PhoneBookEntryList?count=50&filter=&from=0

Wenn jmd noch mehr Infos hat, gerne hier rein schreiben. Vielleicht fühlt sich dann ein Entwickler motiviert einen Adapter zu schreiben. Bei mir reicht's leider nicht.

Schnup89 commented 1 year ago

I'm working on it, got the 3cx pbx running on a virtual machine. ########## Habe mir die 3CX Anlage virtuell installiert und schaue dass ich diese in den nächsten Tage eingebunden bekomme: https://github.com/Schnup89/ioBroker.pbx-3cx

mcm1957 commented 1 year ago

Danke für deinen Einsatz und die INfo

baerenwaldfreund commented 1 year ago

Das hört sich gut an. Wenn Du noch weitere Infos brauchst, kannst Du hier vielleicht noch was raus ziehen:

https://forum.iobroker.net/topic/62281/anbindung-3cx-tk-anlage?_=1675790395357

Schnup89 commented 1 year ago

Moin in die Runde, danke für die Infos.

Ich bin erst wieder in ein paar Tagen am Rechner, aber so lange können die Experimentierfreudigeden unter euch den Adapter vorab testen.

Installation Geht dazu in eurem ioBroker und Adapter, aktiviert den Expertenmodus -> Github Symbol -> Benutzerdefiniert Dort als "URL" https://github.com/Schnup89/ioBroker.pbx-3cx eingeben.

Konfiguration Im Adapter-Admin-Panel gebt ihr eure Daten von der Anlage ein und wählt unten eure API Endpunkte aus. Enabled = Abfrage aktiviert/deaktiviert (alle Sekunden nach dem eingestellt Intervall) Live = Abfrage alle 1Sec

Aktuell werden die JSON Rückgabewerte direkt in Objekte im Stammordner des Adapter geschrieben.

baerenwaldfreund commented 1 year ago

Der Adapter bleibt bei mir gelb. Mache mal ein Beispiel für die Anmeldedaten!

3CX IP/DNS: nur IP-Adresse/DNS-Name? Oder mit Port und Protokoll? Username: default root -> hat aber i.d.R. keinen Webzugriff (nur ssh) Alternativ gibt es den 'admin" oder halt die Nebenstellen-Nr. In meinen Tests lief der User 'admin'

`2023-02-10 17:29:07.669 - info: pbx-3cx.0 (2305) starting. Version 0.0.1 (non-npm: Schnup89/ioBroker.pbx-3cx#d8767d4d14559ab7a257ff23c66ad4d6d5936599) in /opt/iobroker/node_modules/iobroker.pbx-3cx, node: v16.19.0, js-controller: 4.0.24

2023-02-10 17:29:07.686 - debug: pbx-3cx.0 (2305) Axios-Client created! 2023-02-10 17:29:07.718 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.720 - debug: pbx-3cx.0 (2305) Got Cookie: bad 2023-02-10 17:29:07.726 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.726 - error: pbx-3cx.0 (2305) Error fetching PBX-Informations from API! 2023-02-10 17:29:07.727 - debug: pbx-3cx.0 (2305) Update json of SystemStatus 2023-02-10 17:29:07.728 - debug: pbx-3cx.0 (2305) Update json of ActiveCalls 2023-02-10 17:29:07.729 - debug: pbx-3cx.0 (2305) Update json of ServiceList 2023-02-10 17:29:07.729 - debug: pbx-3cx.0 (2305) Update json of ExtensionList 2023-02-10 17:29:07.730 - debug: pbx-3cx.0 (2305) Update json of TrunkList 2023-02-10 17:29:07.731 - debug: pbx-3cx.0 (2305) Update json of InboundRuleList 2023-02-10 17:29:07.732 - debug: pbx-3cx.0 (2305) Update json of OutboundRuleList 2023-02-10 17:29:07.733 - debug: pbx-3cx.0 (2305) Update json of IVRList 2023-02-10 17:29:07.733 - debug: pbx-3cx.0 (2305) Update json of RingGroupList 2023-02-10 17:29:07.734 - debug: pbx-3cx.0 (2305) Update json of CallLog 2023-02-10 17:29:07.735 - debug: pbx-3cx.0 (2305) Update json of PhoneBookEntry 2023-02-10 17:29:07.746 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.747 - error: pbx-3cx.0 (2305) Error getting Endpoint "SystemStatus 2023-02-10 17:29:07.750 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.751 - error: pbx-3cx.0 (2305) Error getting Endpoint "ServiceList 2023-02-10 17:29:07.752 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.752 - error: pbx-3cx.0 (2305) Error getting Endpoint "ActiveCalls 2023-02-10 17:29:07.753 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.753 - error: pbx-3cx.0 (2305) Error getting Endpoint "ExtensionList 2023-02-10 17:29:07.753 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.753 - error: pbx-3cx.0 (2305) Error getting Endpoint "TrunkList 2023-02-10 17:29:07.754 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.754 - error: pbx-3cx.0 (2305) Error getting Endpoint "InboundRuleList 2023-02-10 17:29:07.755 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.755 - error: pbx-3cx.0 (2305) Error getting Endpoint "OutboundRuleList 2023-02-10 17:29:07.756 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.756 - error: pbx-3cx.0 (2305) Error getting Endpoint "IVRList 2023-02-10 17:29:07.756 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.757 - error: pbx-3cx.0 (2305) Error getting Endpoint "RingGroupList 2023-02-10 17:29:07.757 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.757 - error: pbx-3cx.0 (2305) Error getting Endpoint "CallLog 2023-02-10 17:29:07.758 - error: pbx-3cx.0 (2305) Error get PBX info: Error: Request failed with status code 404 2023-02-10 17:29:07.758 - error: pbx-3cx.0 (2305) Error getting Endpoint "PhoneBookEntry`

baerenwaldfreund commented 1 year ago

Habe mir Deinen Code mal grob angesehen. Man muss kein https und keinen Port angeben. Trotzdem bleibt der Adapter gelb, bringt aber zumindest keinen 404 mehr:

` 2023-02-10 18:59:05.653 - info: pbx-3cx.0 (5235) starting. Version 0.0.1 (non-npm: Schnup89/ioBroker.pbx-3cx#d8767d4d14559ab7a257ff23c66ad4d6d5936599) in /opt/iobroker/node_modules/iobroker.pbx-3cx, node: v16.19.0, js-controller: 4.0.24

2023-02-10 18:59:05.673 - debug: pbx-3cx.0 (5235) Axios-Client created! 2023-02-10 18:59:05.704 - silly: pbx-3cx.0 (5235) States system redis pmessage io.system.adapter.pbx-3cx.0.logLevel/io.system.adapter.pbx-3cx.0.logLevel:{"val":"silly","ack":true,"ts":1676051945689,"q":0,"from":"system.adapter.pbx-3cx.0","lc":1676051470557} 2023-02-10 18:59:05.733 - debug: pbx-3cx.0 (5235) Got Cookie: .AspNetCore.CookiesA=CfDJ8M-b4HWPSZBCuB80Xqz4gUxSFy68iKe3B2_S7BeK4z1uk8ikEG-SS4QLBjDoPOwg0y24oWxIMjhJZxOL4y9y31xTjQCd4Ogyn65dhyxMUDsriVBWt_hvLM92VPBIZvEgBjtGCTaE5nPc8Y5Mkegd8cubcw1EzMuc_URoOEITGPtRdspAnvZv1UDYEmInfGMOSsVS1f6diYKyBQn8LMJg03Vaeb7sZ3mupyadZDMoNbkV9KBp_g27ZZg9JM6bQyNzNbVEorYUEWu0TDvAxBcZRAxWYXdQUMnU1TR23fJcmHDL4I824MCFTPzsMO11dJs2OxS7RVhr0d75M5aOabvCLRM_q9zAPzoD3mXoSE3PyHV5KAKMbIWU5LsZaL4KRp3JL9hfKzJ5TIPE4dEI8mxmVRdCppKnHwmcHJ6OwdoGbF373NR8Pz8oAAbGJp9GVtH9Rg 2023-02-10 18:59:05.746 - debug: pbx-3cx.0 (5235) Update json of SystemStatus 2023-02-10 18:59:05.747 - debug: pbx-3cx.0 (5235) Update json of ActiveCalls 2023-02-10 19:00:31.144 - silly: pbx-3cx.0 (5235) redis message expired/evicted 2023-02-10 19:01:05.747 - debug: pbx-3cx.0 (5235) Update json of SystemStatus 2023-02-10 19:01:05.749 - debug: pbx-3cx.0 (5235) Update json of ActiveCalls `

Schnup89 commented 1 year ago

Danke für deine Rückmeldungen! 3CX IP/DNS: nur IP-Adresse/DNS-Name? Oder mit Port und Protokoll? -> Angepasst auf URL, damit ist man im Notfall variabler, Feld beschreibung ergänzt Username: default root -> hat aber i.d.R. keinen Webzugriff (nur ssh) -> Danke für die wichtige Info, bei mir ging's nur mit root auf dem halbherzig eingerichteten 3CX System, hab den Vordefinierten User rausgenommen

Die Version hatte noch einige Probleme welche ich heute ausgemerzt habe:

Ich schaue mir die Tage nochmal den Code an und ergänze Kommentare, danach noch eine README erstellen ,dann kann die erste Version online gehen.

baerenwaldfreund commented 1 year ago

Das sieht jetzt schon besser aus. Der Adapter wird grün und die meisten JSON-Payloads werden in die Objekte geschrieben. Lediglich 'PhoneBookEntry' und 'InboundRuleList' funktionieren noch nicht. Hier der Log:

`2023-02-12 12:46:41.742 - debug: pbx-3cx.0 (87280) Update json of SystemStatus

2023-02-12 12:46:41.743 - debug: pbx-3cx.0 (87280) Update json of ActiveCalls 2023-02-12 12:46:41.743 - debug: pbx-3cx.0 (87280) Update json of ServiceList 2023-02-12 12:46:41.744 - debug: pbx-3cx.0 (87280) Update json of ExtensionList 2023-02-12 12:46:41.744 - debug: pbx-3cx.0 (87280) Update json of TrunkList 2023-02-12 12:46:41.745 - debug: pbx-3cx.0 (87280) Update json of InboundRuleList 2023-02-12 12:46:41.745 - debug: pbx-3cx.0 (87280) Update json of OutboundRuleList 2023-02-12 12:46:41.746 - debug: pbx-3cx.0 (87280) Update json of IVRList 2023-02-12 12:46:41.746 - debug: pbx-3cx.0 (87280) Update json of RingGroupList 2023-02-12 12:46:41.747 - debug: pbx-3cx.0 (87280) Update json of CallLog 2023-02-12 12:46:41.748 - debug: pbx-3cx.0 (87280) Update json of PhoneBookEntry 2023-02-12 12:46:41.765 - error: pbx-3cx.0 (87280) Error getting Endpoint: InboundRuleList 2023-02-12 12:46:41.819 - debug: pbx-3cx.0 (87280) PBX-Connection Changed isConnected: true 2023-02-12 12:46:41.823 - error: pbx-3cx.0 (87280) Error getting Endpoint: PhoneBookEntry 2023-02-12 12:46:41.842 - debug: pbx-3cx.0 (87280) Got Cookie: .AspNetCore.CookiesA=[...] 2023-02-12 12:46:41.848 - debug: pbx-3cx.0 (87280) Got Cookie: .AspNetCore.CookiesA=[...]`

Zu erwähnen ist, dass "PhoneBookEntry" nur das globale Adressbuch ausgibt und nicht die individuellen der einzelnen Nebenstellen.

Gut auch, dass man jetzt die komplette URL eingeben kann. Der Port 5001 ist nämlich ein individueller Port. Standard ist 5001. Es ist aber auch der Standard-https-Port 443 üblich. Kann man bei der Installation frei wählen.

Hier noch ein Link ins 3cx-Forum, wo auch schon über die API diskutiert wurde: https://www.3cx.de/forum/threads/suche-nach-der-api-dokumentation.98311/

Bin aktuell ein wenig kränklich, deshalb teste ich in den nächsten Tagen intensiver.

Danke für den Adapter! Tolle Arbeit.

EDIT: Habe den Fehler bei der InboundRulesList gefunden. Da fehlt ein 's' im Namen. Bei der PhoneBookEntryList fehlt bei Dir im Namen das "List".

baerenwaldfreund commented 1 year ago

Bei zwei URLs müssen noch Parameter mitgegeben werden. Die möglichen Parameter müssten noch bestimmt werden. Hier das, was ich schon zusammengetragen habe:

1) https://myhost.my3cx.de:5001/api/CallLog?TimeZoneName=Europe%2FBerlin&callState=All&dateRangeType=Today&fromFilter=&fromFilterType=Any&numberOfRows=50&searchFilter=&startRow=0&toFilter=&toFilterType=Any

TimeZoneName=Europe/Berlin bzw. Europe%2FBerlin callState=All dateRangeType=Today / Yesterday / LastWeek / LastSevenDays / LastMonth / LastThirtyDays / LastNinetyDays fromFilter= fromFilterType=Any numberOfRows=50 -> Anzahl der anzuzeigenden Einträge searchFilter= startRow=0 -> beginnend mit Index: 0 toFilter= toFilterType=Any

2) https://myhost.my3cx.de:5001/api/PhoneBookEntryList?count=50&filter=&from=0

count=50 -> Anzahl der anzuzeigenden Einträge from=0 -> beginnend mit Index: 0

Schnup89 commented 1 year ago

Alles klar, ich nehme die Infos mit in die Readme.

Die Parameter für einen api Endpunkt können in dem Adapter config Panel einfach angefügt werden. So kann das jeder nach seinem Bedürfnissen anpassen.

Wenn es Sinn macht kann ich diese dann auch mit vordefinierten Parameter erstellrn lassen.

Habe noch ein paar Api-Endpunkte im Netz gefunden und ergänzt.

Danke für das Testen und deine Infos!

baerenwaldfreund commented 1 year ago

Die Parameter für einen api Endpunkt können in dem Adapter config Panel einfach angefügt werden. So kann das jeder nach seinem Bedürfnissen anpassen.

Habe ich versucht. Das bringt den Adapter zum Absturz. Er wird rot. Hier die Logs:

`2023-02-12 20:48:54.878 - error: pbx-3cx.0 (104212) Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().

2023-02-12 20:48:54.879 - error: pbx-3cx.0 (104212) unhandled promise rejection: Invalid ID: pbx-3cx.0.PhoneBookEntryList?count=50&filter=&from=0 2023-02-12 20:48:54.880 - error: pbx-3cx.0 (104212) Error: Invalid ID: pbx-3cx.0.PhoneBookEntryList?count=50&filter=&from=0 at Object.maybeCallbackWithError (/opt/iobroker/node_modules/@iobroker/js-controller-common/lib/common/tools.js:2983:17) at ObjectsInRedisClient._setObject (/opt/iobroker/node_modules/@iobroker/db-objects-redis/lib/objects/objectsInRedisClient.js:2980:26) at Immediate. (/opt/iobroker/node_modules/@iobroker/db-objects-redis/lib/objects/objectsInRedisClient.js:3211:29) at processImmediate (node:internal/timers:468:21) 2023-02-12 20:48:54.880 - error: pbx-3cx.0 (104212) Invalid ID: pbx-3cx.0.PhoneBookEntryList?count=50&filter=&from=0 2023-02-12 20:48:54.882 - info: pbx-3cx.0 (104212) terminating 2023-02-12 20:48:54.883 - warn: pbx-3cx.0 (104212) Terminated (UNCAUGHT_EXCEPTION): Without reason 2023-02-12 20:48:55.451 - error: host.ioBroker-Master-Debian-priv instance system.adapter.pbx-3cx.0 terminated with code 6 (UNCAUGHT_EXCEPTION) 2023-02-12 20:49:26.183 - info: pbx-3cx.0 (104228) starting. Version 0.0.1 (non-npm: Schnup89/ioBroker.pbx-3cx#aeca25be6409ae3cd47bbb7d03db106bcb6af65b) in /opt/iobroker/node_modules/iobroker.pbx-3cx, node: v16.19.0, js-controller: 4.0.24 2023-02-12 20:49:26.260 - info: pbx-3cx.0 (104228) Verbindung zu 3CX myhost.my3cx.de (18.0.6.908) erfolgreich. 2023-02-12 20:49:26.280 - error: pbx-3cx.0 (104228) Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). 2023-02-12 20:49:26.281 - error: pbx-3cx.0 (104228) unhandled promise rejection: Invalid ID: pbx-3cx.0.PhoneBookEntryList?count=50&filter=&from=0 2023-02-12 20:49:26.282 - error: pbx-3cx.0 (104228) Error: Invalid ID: pbx-3cx.0.PhoneBookEntryList?count=50&filter=&from=0 at Object.maybeCallbackWithError (/opt/iobroker/node_modules/@iobroker/js-controller-common/lib/common/tools.js:2983:17) at ObjectsInRedisClient._setObject (/opt/iobroker/node_modules/@iobroker/db-objects-redis/lib/objects/objectsInRedisClient.js:2980:26) at Immediate. (/opt/iobroker/node_modules/@iobroker/db-objects-redis/lib/objects/objectsInRedisClient.js:3211:29) at processImmediate (node:internal/timers:468:21)`

Das hier war mein Eintrag:

PhoneBookEntryList?count=50&filter=&from=0

Wenn es Sinn macht kann ich diese dann auch mit vordefinierten Parameter erstellrn lassen.

Das wäre natürlich das Bequemste.

Schnup89 commented 1 year ago

Fehler behoben, der Name des API Endpunkt wurde komplett als Pfad für das iobroker Objekt verwendet, das geht mit den Sonderzeichen natürlich nicht. Habe es mit ein bisschen regex so angepasst dass die Parameter beim schreiben des States ignoriert werden.

Schnup89 commented 1 year ago

So, nachdem für den publish des Adapter doch noch einiges zu tun war sollte der Adapter fertig sein für die Aufnahme in das iobroker Repo.

Sollte bis morgen/übermorgen kein "show stopper" auftreten stelle ich den Request zur Aufnahme. Getestet wurden meinerseits alle möglichen Verbindungsfehler (PBX nicht erreichbar, PBX nicht erreichbar bei Start des Adapters, Cookie ungültig, HTTP Fehlercodes bei Abfrage).

baerenwaldfreund commented 1 year ago

Funktioniert jetzt :-)

Allerdings habe ich heute morgen gesehen, dass der Adapter eine Menge Fehlermeldungen über Nacht geworfen hat:

` 2023-02-13 07:06:48.435 - error: pbx-3cx.0 (104915) Error getting Endpoint: SystemStatus

2023-02-13 07:06:48.437 - error: pbx-3cx.0 (104915) Error getting Endpoint: ActiveCalls 2023-02-13 07:06:48.438 - error: pbx-3cx.0 (104915) Error getting Endpoint: ServiceList 2023-02-13 07:06:48.440 - error: pbx-3cx.0 (104915) Error getting Endpoint: ExtensionList 2023-02-13 07:06:48.441 - error: pbx-3cx.0 (104915) Error getting Endpoint: TrunkList 2023-02-13 07:06:48.442 - error: pbx-3cx.0 (104915) Error getting Endpoint: InboundRulesList 2023-02-13 07:06:48.443 - error: pbx-3cx.0 (104915) Error getting Endpoint: OutboundRuleList 2023-02-13 07:06:48.444 - error: pbx-3cx.0 (104915) Error getting Endpoint: IVRList 2023-02-13 07:06:48.445 - error: pbx-3cx.0 (104915) Error getting Endpoint: RingGroupList 2023-02-13 07:06:48.446 - error: pbx-3cx.0 (104915) Error getting Endpoint: CallLog 2023-02-13 07:06:48.448 - error: pbx-3cx.0 (104915) Error getting Endpoint: PhoneBookEntryList `

Und das im doppelten Takt des Abfrageintervalls. Ich hatte 3600 sec. eingestellt. Die Fehler wirft er alle 2h. Ich würde das jetzt über Tag beobachten.

Schnup89 commented 1 year ago

Das müssen wir uns noch anschauen vor dem release, kannst du bitte das debugging des Adapter aktivieren? Damit wird der Fehlercode mit ausgegeben.

Es könnte sein dass der Cookie nach 2h abläuft und er Ihn dann automatisch erneuert, dafür habe ich die Fehlermeldung in der neusten Version 0.0.2 auf "warn" gestellt damit das nicht als Fehler aufpoppt.

baerenwaldfreund commented 1 year ago

Ja, ich denke auch, dass das Cookie abläuft. Hier die aktuellen Logs:

`2023-02-13 07:50:55.707 - warn: pbx-3cx.0 (126136) PBX-Connection Changed isConnected: true

2023-02-13 09:50:55.707 - warn: pbx-3cx.0 (126136) Error getting Endpoint: SystemStatus 2023-02-13 09:50:55.709 - warn: pbx-3cx.0 (126136) Error getting Endpoint: ActiveCalls 2023-02-13 09:50:55.710 - warn: pbx-3cx.0 (126136) Error getting Endpoint: ServiceList 2023-02-13 09:50:55.711 - warn: pbx-3cx.0 (126136) Error getting Endpoint: ExtensionList 2023-02-13 09:50:55.713 - warn: pbx-3cx.0 (126136) Error getting Endpoint: TrunkList 2023-02-13 09:50:55.714 - warn: pbx-3cx.0 (126136) Error getting Endpoint: InboundRulesList 2023-02-13 09:50:55.715 - warn: pbx-3cx.0 (126136) Error getting Endpoint: OutboundRuleList 2023-02-13 09:50:55.716 - warn: pbx-3cx.0 (126136) Error getting Endpoint: IVRList 2023-02-13 09:50:55.718 - warn: pbx-3cx.0 (126136) Error getting Endpoint: RingGroupList 2023-02-13 09:50:55.720 - warn: pbx-3cx.0 (126136) Error getting Endpoint: CallLog?TimeZoneName=Europe%2FBerlin&callState=All&dateRangeType=Today&fromFilter=&fromFilterType=Any&numberOfRows=50&searchFilter=&startRow=0&toFilter=&toFilterType=Any 2023-02-13 09:50:55.721 - warn: pbx-3cx.0 (126136) Error getting Endpoint: PhoneBookEntryList?count=50&filter=&from=0 2023-02-13 09:50:55.727 - error: pbx-3cx.0 (126136) PBX-Connection Changed isConnected: false`

Ich stelle jetzt mal den Loglevel hoch.

baerenwaldfreund commented 1 year ago

`2023-02-13 12:46:11.484 - debug: pbx-3cx.0 (131794) Update json of SystemStatus

2023-02-13 12:46:11.485 - debug: pbx-3cx.0 (131794) Update json of ActiveCalls 2023-02-13 12:46:11.486 - debug: pbx-3cx.0 (131794) Update json of ServiceList 2023-02-13 12:46:11.486 - debug: pbx-3cx.0 (131794) Update json of ExtensionList 2023-02-13 12:46:11.487 - debug: pbx-3cx.0 (131794) Update json of TrunkList 2023-02-13 12:46:11.487 - debug: pbx-3cx.0 (131794) Update json of InboundRulesList 2023-02-13 12:46:11.488 - debug: pbx-3cx.0 (131794) Update json of OutboundRuleList 2023-02-13 12:46:11.489 - debug: pbx-3cx.0 (131794) Update json of IVRList 2023-02-13 12:46:11.489 - debug: pbx-3cx.0 (131794) Update json of RingGroupList 2023-02-13 12:46:11.490 - debug: pbx-3cx.0 (131794) Update json of CallLog?TimeZoneName=Europe%2FBerlin&callState=All&dateRangeType=Today&fromFilter=&fromFilterType=Any&numberOfRows=50&searchFilter=&startRow=0&toFilter=&toFilterType=Any 2023-02-13 12:46:11.490 - debug: pbx-3cx.0 (131794) Update json of PhoneBookEntryList?count=50&filter=&from=0 2023-02-13 12:46:11.501 - debug: pbx-3cx.0 (131794) Result: Unathorized (HTTP401) 2023-02-13 12:46:11.502 - warn: pbx-3cx.0 (131794) Error getting Endpoint: SystemStatus 2023-02-13 12:46:11.504 - debug: pbx-3cx.0 (131794) Result: Unathorized (HTTP401) 2023-02-13 12:46:11.505 - warn: pbx-3cx.0 (131794) Error getting Endpoint: ActiveCalls 2023-02-13 12:46:11.506 - debug: pbx-3cx.0 (131794) Result: Unathorized (HTTP401) 2023-02-13 12:46:11.507 - warn: pbx-3cx.0 (131794) Error getting Endpoint: ServiceList 2023-02-13 12:46:11.507 - debug: pbx-3cx.0 (131794) Result: Unathorized (HTTP401) 2023-02-13 12:46:11.508 - warn: pbx-3cx.0 (131794) Error getting Endpoint: ExtensionList 2023-02-13 12:46:11.509 - debug: pbx-3cx.0 (131794) Result: Unathorized (HTTP401) 2023-02-13 12:46:11.509 - warn: pbx-3cx.0 (131794) Error getting Endpoint: TrunkList 2023-02-13 12:46:11.510 - debug: pbx-3cx.0 (131794) Result: Unathorized (HTTP401) 2023-02-13 12:46:11.510 - warn: pbx-3cx.0 (131794) Error getting Endpoint: InboundRulesList 2023-02-13 12:46:11.511 - debug: pbx-3cx.0 (131794) Result: Unathorized (HTTP401) 2023-02-13 12:46:11.512 - warn: pbx-3cx.0 (131794) Error getting Endpoint: OutboundRuleList 2023-02-13 12:46:11.512 - debug: pbx-3cx.0 (131794) Result: Unathorized (HTTP401) 2023-02-13 12:46:11.513 - warn: pbx-3cx.0 (131794) Error getting Endpoint: IVRList 2023-02-13 12:46:11.514 - debug: pbx-3cx.0 (131794) Result: Unathorized (HTTP401) 2023-02-13 12:46:11.514 - warn: pbx-3cx.0 (131794) Error getting Endpoint: PhoneBookEntryList?count=50&filter=&from=0 2023-02-13 12:46:11.515 - debug: pbx-3cx.0 (131794) Result: Unathorized (HTTP401) 2023-02-13 12:46:11.516 - warn: pbx-3cx.0 (131794) Error getting Endpoint: RingGroupList 2023-02-13 12:46:11.516 - debug: pbx-3cx.0 (131794) Result: Unathorized (HTTP401) 2023-02-13 12:46:11.517 - warn: pbx-3cx.0 (131794) Error getting Endpoint: CallLog?TimeZoneName=Europe%2FBerlin&callState=All&dateRangeType=Today&fromFilter=&fromFilterType=Any&numberOfRows=50&searchFilter=&startRow=0&toFilter=&toFilterType=Any 2023-02-13 12:46:11.526 - error: pbx-3cx.0 (131794) PBX-Connection Changed isConnected: false 2023-02-13 12:46:11.543 - debug: pbx-3cx.0 (131794) Got Cookie: .AspNetCore.CookiesA=[...] 2023-02-13 12:46:11.558 - debug: pbx-3cx.0 (131794) Got Cookie: .AspNetCore.CookiesA=[...] 2023-02-13 12:46:11.559 - debug: pbx-3cx.0 (131794) Got Cookie: .AspNetCore.CookiesA=[...] 2023-02-13 12:46:11.560 - debug: pbx-3cx.0 (131794) Got Cookie: .AspNetCore.CookiesA=[...] 2023-02-13 12:46:11.560 - debug: pbx-3cx.0 (131794) Got Cookie: .AspNetCore.CookiesA=[...] 2023-02-13 12:46:11.560 - debug: pbx-3cx.0 (131794) Got Cookie: .AspNetCore.CookiesA=[...] 2023-02-13 12:46:11.561 - debug: pbx-3cx.0 (131794) Got Cookie: .AspNetCore.CookiesA=[...] 2023-02-13 12:46:11.561 - debug: pbx-3cx.0 (131794) Got Cookie: .AspNetCore.CookiesA=[...] 2023-02-13 12:46:11.561 - debug: pbx-3cx.0 (131794) Got Cookie: .AspNetCore.CookiesA=[...] 2023-02-13 12:46:11.562 - debug: pbx-3cx.0 (131794) Got Cookie: .AspNetCore.CookiesA=[...] 2023-02-13 12:46:11.564 - debug: pbx-3cx.0 (131794) Got Cookie: .AspNetCore.CookiesA=[...] `

[...] -> steht für unterschiedliche Cookieinhalte.

Der Adapter wird dann gelb. Ein Restart macht ihn wieder grün.

Schnup89 commented 1 year ago

Okay das sollte nicht sein ich prüfe das heute Abend

Schnup89 commented 1 year ago

Habe das Problem mit den mehrfachen Cookie Requests gefixed in der V0.0.3. Kannst du das Problem mit dem gelben Adapter in der 0.0.3 nachvollziehen? Ich habe es versucht, aber bei mir wird er immer wieder grün.

baerenwaldfreund commented 1 year ago

Der Adapter bleibt jetzt grün.

Diese Logs kommen jetzt alle 2h:

` 2023-02-14 13:23:51.553 - debug: pbx-3cx.0 (148024) Update json of SystemStatus

2023-02-14 13:23:51.554 - debug: pbx-3cx.0 (148024) Update json of ActiveCalls 2023-02-14 13:23:51.555 - debug: pbx-3cx.0 (148024) Update json of ServiceList 2023-02-14 13:23:51.556 - debug: pbx-3cx.0 (148024) Update json of ExtensionList 2023-02-14 13:23:51.556 - debug: pbx-3cx.0 (148024) Update json of TrunkList 2023-02-14 13:23:51.557 - debug: pbx-3cx.0 (148024) Update json of InboundRulesList 2023-02-14 13:23:51.557 - debug: pbx-3cx.0 (148024) Update json of OutboundRuleList 2023-02-14 13:23:51.558 - debug: pbx-3cx.0 (148024) Update json of IVRList 2023-02-14 13:23:51.558 - debug: pbx-3cx.0 (148024) Update json of RingGroupList 2023-02-14 13:23:51.558 - debug: pbx-3cx.0 (148024) Update json of CallLog?TimeZoneName=Europe%2FBerlin&callState=All&dateRangeType=Today&fromFilter=&fromFilterType=Any&numberOfRows=50&searchFilter=&startRow=0&toFilter=&toFilterType=Any 2023-02-14 13:23:51.559 - debug: pbx-3cx.0 (148024) Update json of PhoneBookEntryList?count=50&filter=&from=0 2023-02-14 13:23:51.572 - debug: pbx-3cx.0 (148024) Result: Unathorized (HTTP401) 2023-02-14 13:23:51.573 - warn: pbx-3cx.0 (148024) Error getting Endpoint: IVRList 2023-02-14 13:23:51.574 - debug: pbx-3cx.0 (148024) Result: Unathorized (HTTP401) 2023-02-14 13:23:51.574 - warn: pbx-3cx.0 (148024) Error getting Endpoint: SystemStatus 2023-02-14 13:23:51.575 - debug: pbx-3cx.0 (148024) Result: Unathorized (HTTP401) 2023-02-14 13:23:51.575 - warn: pbx-3cx.0 (148024) Error getting Endpoint: ActiveCalls 2023-02-14 13:23:51.575 - debug: pbx-3cx.0 (148024) Result: Unathorized (HTTP401) 2023-02-14 13:23:51.575 - warn: pbx-3cx.0 (148024) Error getting Endpoint: ServiceList 2023-02-14 13:23:51.576 - debug: pbx-3cx.0 (148024) Result: Unathorized (HTTP401) 2023-02-14 13:23:51.576 - warn: pbx-3cx.0 (148024) Error getting Endpoint: ExtensionList 2023-02-14 13:23:51.576 - debug: pbx-3cx.0 (148024) Result: Unathorized (HTTP401) 2023-02-14 13:23:51.576 - warn: pbx-3cx.0 (148024) Error getting Endpoint: TrunkList 2023-02-14 13:23:51.577 - debug: pbx-3cx.0 (148024) Result: Unathorized (HTTP401) 2023-02-14 13:23:51.577 - warn: pbx-3cx.0 (148024) Error getting Endpoint: InboundRulesList 2023-02-14 13:23:51.577 - debug: pbx-3cx.0 (148024) Result: Unathorized (HTTP401) 2023-02-14 13:23:51.577 - warn: pbx-3cx.0 (148024) Error getting Endpoint: OutboundRuleList 2023-02-14 13:23:51.577 - debug: pbx-3cx.0 (148024) Result: Unathorized (HTTP401) 2023-02-14 13:23:51.577 - warn: pbx-3cx.0 (148024) Error getting Endpoint: RingGroupList 2023-02-14 13:23:51.580 - debug: pbx-3cx.0 (148024) Result: Unathorized (HTTP401) 2023-02-14 13:23:51.580 - warn: pbx-3cx.0 (148024) Error getting Endpoint: CallLog?TimeZoneName=Europe%2FBerlin&callState=All&dateRangeType=Today&fromFilter=&fromFilterType=Any&numberOfRows=50&searchFilter=&startRow=0&toFilter=&toFilterType=Any 2023-02-14 13:23:51.580 - debug: pbx-3cx.0 (148024) Result: Unathorized (HTTP401) 2023-02-14 13:23:51.581 - warn: pbx-3cx.0 (148024) Error getting Endpoint: PhoneBookEntryList?count=50&filter=&from=0 2023-02-14 13:23:51.585 - error: pbx-3cx.0 (148024) PBX-Connection Changed isConnected: false 2023-02-14 13:23:51.599 - debug: pbx-3cx.0 (148024) Got Cookie: .AspNetCore.CookiesA=[...] `

d.h. er läuft zuerst in einen Fehler, merkt das aber, erneuert das Cookie und alles läuft wieder. Schöner wäre es, wenn automatisch vor Ablauf der Cookiegültigkeit dieses ersetzt würde.

Schnup89 commented 1 year ago

So war es ursprünglich geplant, für das automatische erneuern lege ich ein feature request an und füge das hinzu sobald ich wieder etwas mehr Zeit habe. (Mit auslesen des Cookie Ablauftimers, denn der könnte in den zukünftigen Versionen anders sein als 2h)

https://github.com/Schnup89/ioBroker.pbx-3cx/issues/6

Schnup89 commented 1 year ago

Push Request für Aufnahme in das Repo ist raus, hoffe ich hab das soweit alles richtig gemacht.

mcm1957 commented 1 year ago

Push Request für Aufnahme in das Repo ist raus, hoffe ich hab das soweit alles richtig gemacht.

https://github.com/ioBroker/ioBroker.repositories/pull/2142

Jep - sieht alles Ok aus. DANKE Ich hab ein paar Anmerkungen im PR eingetragen. Wenn du Zeit hast schau sie dir an. Ist aber ein inoffizielles Feedback!

Schnup89 commented 1 year ago

Letzer Issue ist gefixed, gibt es noch etwas das ich anpassen muss damit der Adapter veröffentlicht wird?

mcm1957 commented 1 year ago

Im Moment sieht es nicht so aus als wäre etwas von dir zu tun. Apollon77 wird den Adapter reviewen sobald er Zeit dazu findet. (Label des PR "Adapter review needed"). Sollte etwas zu tun sein, so erfährst du das über den PR. Typisch würde dann "Must be fixed" als Label aufscheinen.

Dieser Vorgang ist nur bei der erstmaligen Aufnahme eines Adapoters ins latest vorgesehen. Zukünftige Releases ikommen automatisch (binnen 24h) ins lates repo und typisch binnen weniger Tage ins stable.

Sorry - ist im Moment ein Resourcenproblem. Bitte um ein wenig Geduld und DANKE für den Aufwand den du für die Gemeinschaft gesetzt hast.

Schnup89 commented 1 year ago

Nur keinen Stress, habe mich nur gefragt ob noch etwas von meiner Seite offen ist.

Nichts zu danken! Ich muss mich für eure Arbeit an ioBroker bedanken - wenn ich ioBroker schon kostenlos nutzen kann, dann gebe ich -so weit ich kann- gerne etwas zurück.

m-s-b commented 1 year ago

@Schnup89 Machst du ein Thema im Forum/Test auf oder Fragen/issues lieber direkt in github? Kann meine Anlage via http://lokale IP erreichen. PBX und iobroker sind an getrennten Standorten, verbunden per Wireguard. Vermutlich deswegen erhalte ich öfters Error get PBX info: AxiosError: timeout of 1000ms exceeded Wäre schön wenn man den timeout hochsetzen und gerne auch das "live" Intervall anpassen könnte. Momentan kämpfe ich noch mit dem aufdröseln der zurückkommenden JSON´s.

mcm1957 commented 1 year ago

Letzer Issue ist gefixed, gibt es noch etwas das ich anpassen muss damit der Adapter veröffentlicht wird?

Wie ich aus letztem post lese gibts noch keinen test thread. Ist zwar nicht Pflicht aber guter Stil bei neuen Adaptern u bei Releases mut nennenswerten Änderungen eine Thread im Forum Abschnitt Testing zu öffnen.

Bringt einerseits Aufmerjsamkeit f deinen Adapter u andrerseits Rückmeldungen zu Problemen bzw. Wünschen oder Unklarhriten durch Nutzer.

Von meiner Seite bitte nur als Antegung sehen.

McM57

Schnup89 commented 1 year ago

@mcm1957 Ich habe mal schnell einen Forumseintrag erstellt: https://forum.iobroker.net/topic/64041/neuer-adapter-pbx-3cx-anbindung-der-3cx-telefonanlage

@m-s-b: Ich erstelle einen Github Feature-Request, wenn ich einen variablen Timeout erstelle muss ich auch diesen Timeout als kleinste Zeit für den Live-Refresh-Interval nutzen da sonst evtl. mehr Anfragen erstellt werden als nötigen (neue Anfrage geht raus obwohl alter noch nicht beantwortet wurde) . Das kann unschön enden da die Abfragen alle Asynchron aufgerufen werden. Die Anpassung bedarf etwas Arbeit, denke aber dass ich in den nächsten Wochen dazu komme.

Bzgl. der JSON Auswertung überlege ich gerade ob es sinnvoll ist eine Wiki-Seite zu erstellen mit User-Scripten für die Zerlegung der Rückgabewerte. Wenn du magst kannst du ein Issue erstellen, evtl. kann ich dir da weiterhelfen beim zerstückeln. ;)

mcm1957 commented 11 months ago

reqeust for latest: https://github.com/ioBroker/ioBroker.repositories/pull/2142

mcm1957 commented 5 months ago

Copied from https://github.com/ioBroker/ioBroker.repositories/pull/2142#

Hey, sorry for my late reply.
3cx has changed their licensing methods and removed the onPremise functionality for the free licenses.
With the free cloud-system we dont have any access to the API's and I cannot maintain the adapter anymore.

I hate it if a company forces you to use there/the cloud, and on top of that in this case they even had a onPremise System which they took away from active users.
mcm1957 commented 5 months ago

So id soneone can / will check whether any useful adapter is possible with free access he/she is welcome.