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:
+5
-3
@@ -90,7 +90,8 @@ def poll_status():
|
||||
users_with_assignments = conn.execute("""
|
||||
SELECT u.azure_id, u.display_name, u.personal_nr,
|
||||
a.segment, d.hostname,
|
||||
s.last_aida_status, s.last_teams_status
|
||||
s.last_aida_status, s.last_teams_status,
|
||||
COALESCE(s.phone_active, 0) as phone_active
|
||||
FROM users u
|
||||
JOIN assignments a ON a.user_azure_id = u.azure_id
|
||||
JOIN wled_devices d ON d.id = a.wled_device_id
|
||||
@@ -130,6 +131,7 @@ def _process_user(user, aida_lines, settings, conn):
|
||||
segment = user["segment"]
|
||||
last_aida = user["last_aida_status"] or ""
|
||||
last_teams = user["last_teams_status"] or ""
|
||||
phone_active = user["phone_active"]
|
||||
|
||||
# Immer Teams-Status abfragen (fuer Dashboard-Anzeige)
|
||||
teams_status = ""
|
||||
@@ -144,8 +146,8 @@ def _process_user(user, aida_lines, settings, conn):
|
||||
if aida_status == last_aida and teams_status == last_teams:
|
||||
return # No change
|
||||
|
||||
# --- WLED nur steuern wenn AIDA-Status bekannt ---
|
||||
wled_changed = aida_status is not None and (
|
||||
# --- WLED nur steuern wenn AIDA-Status bekannt und kein aktives Telefonat ---
|
||||
wled_changed = aida_status is not None and not phone_active and (
|
||||
aida_status != last_aida or
|
||||
(aida_status == "anwesend" and teams_status != last_teams)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user