feat: phone webhook integration (callstart/callend on port 8081)

- New webhook server on port 8081 for phone system (PBX)
- Endpoints: GET/POST /{extension}/callstart and /{extension}/callend
- New 'phone_extension' field on users (Durchwahl)
- Only activates when user is anwesend or homeoffice (AIDA)
- Sets WLED to phone_active color (red) on callstart
- Restores previous Teams/AIDA color on callend
- Polling skips WLED update while phone is active
- Dashboard shows phone badge when user is in a call
- New color rule 'phone_active' (configurable via web UI)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 23:15:51 +02:00
co-authored by Claude Opus 4.6
parent 47210cb068
commit 7f2858aab6
6 changed files with 183 additions and 7 deletions
+11
View File
@@ -25,6 +25,7 @@ def init_db():
display_name TEXT NOT NULL DEFAULT '',
email TEXT DEFAULT '',
personal_nr TEXT DEFAULT '',
phone_extension TEXT DEFAULT '',
active INTEGER NOT NULL DEFAULT 0
);
@@ -60,6 +61,7 @@ def init_db():
user_azure_id TEXT PRIMARY KEY REFERENCES users(azure_id) ON DELETE CASCADE,
last_aida_status TEXT DEFAULT '',
last_teams_status TEXT DEFAULT '',
phone_active INTEGER DEFAULT 0,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
@@ -92,6 +94,14 @@ def init_db():
conn.execute("ALTER TABLE wled_devices ADD COLUMN last_check TIMESTAMP")
except Exception:
pass
try:
conn.execute("ALTER TABLE users ADD COLUMN phone_extension TEXT DEFAULT ''")
except Exception:
pass
try:
conn.execute("ALTER TABLE state ADD COLUMN phone_active INTEGER DEFAULT 0")
except Exception:
pass
defaults = {
"azure_client_id": "",
@@ -129,6 +139,7 @@ def init_db():
("teams_inactive", 0, 255, 0, ""),
("teams_offwork", 0, 255, 0, ""),
("teams_outofoffice", 0, 255, 0, ""),
("phone_active", 255, 0, 0, ""),
]
for status, r, g, b, effect in default_colors:
conn.execute(