fix: callend restores AIDA color, not Teams (Teams comes via polling)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Christian Mueller 2026-04-23 23:23:57 +02:00
parent 73f25c4c7e
commit 69fa30f79c

View File

@ -19,7 +19,7 @@ async def webhook_info():
Endpoints: Endpoints:
GET/POST /{durchwahl}/callstart - Anruf gestartet (WLED -> Rot) GET/POST /{durchwahl}/callstart - Anruf gestartet (WLED -> Rot)
GET/POST /{durchwahl}/callend - Anruf beendet (WLED -> zurueck auf Teams-Status) GET/POST /{durchwahl}/callend - Anruf beendet (WLED -> zurueck auf Zeiterfassungs-Status)
Beispiel: Beispiel:
curl http://localhost:8081/123/callstart curl http://localhost:8081/123/callstart
@ -108,14 +108,14 @@ async def call_end(extension: str):
if aida not in ("anwesend", "homeoffice"): if aida not in ("anwesend", "homeoffice"):
return f"Ignored: {user['display_name']} not in office" return f"Ignored: {user['display_name']} not in office"
# Farbe zuruecksetzen basierend auf aktuellem Status # Farbe zuruecksetzen auf Zeiterfassungs-Status
teams = user["last_teams_status"] or "" # (Teams-Farbe kommt automatisch beim naechsten Polling)
if aida == "homeoffice": if aida == "anwesend":
color = _get_color("homeoffice", conn)
elif teams:
color = _get_color(teams, conn)
else:
color = _get_color("available", conn) color = _get_color("available", conn)
elif aida == "homeoffice":
color = _get_color("homeoffice", conn)
else:
color = _get_color("abwesend", conn)
url = build_wled_url( url = build_wled_url(
user["hostname"], color["r"], color["g"], color["b"], user["hostname"], color["r"], color["g"], color["b"],
@ -131,7 +131,7 @@ async def call_end(extension: str):
log_activity( log_activity(
user["azure_id"], user["display_name"], user["azure_id"], user["display_name"],
aida, f"phone_end -> {teams}", url, result_text, aida, "phone_end", url, result_text,
) )
logger.info("Webhook callend: %s -> %s (%s)", user["display_name"], result_text, teams) logger.info("Webhook callend: %s -> %s (%s)", user["display_name"], result_text, teams)