Dattavani Backend: Live Video and Voice Sessions

Dattavani Backend: Live Video and Voice Sessions A sequence diagram generated by Archify. POST /session + kid JWT Ask Tataji videostarts via /api/chat stop older active sessions closed withoutbilling POST /v1/sessions/token sandbox flag, maxduration 60 s session_id + token POST /v1/sessions/start Bearer session token;semaphore of 4 livekit_url + client token insert avatar_sessions status active; insertfailure only logged sessionId, serverUrl, token join room media skipscore-service POST /stop + kid JWT load avatar_sessions row 404 unknown; 403another kid POST /v1/sessions/stop credits_consumed, duration 0: poll GET/v1/sessions/{id}, 4tries deduct credits, mark stopped rounded up; curatedsamples are free creditsConsumed, remaining POST /conversations + kid JWT 6 starts per kid per60 s, per process membership, minutes, fair use same gates as AskTataji, in parallel POST /token retried only if noroom was made url, token, room save room to kid failure: background/end, then 503 conversation_id + token join room no credits chargedfor voice turn.completed POST /turns:HMAC-SHA512, 300 s,256 KB upsert swamiji_turns once per event_id;500 makes it retry conversation.ended ended_at, duration, reason GET /conversations last 24 h by default(app_config) calls with exchanges 1 · Start a video session 2 · Stop and bill the video 3 · Talk to Swamiji 4 · Webhooks and history Kid App · video + voice · Sequence participant Kid App video + voice LiveKit room · WebRTC media · Sequence participant LiveKit room WebRTC media Avatar API · /api/avatar-session · Sequence participant Avatar API /api/avatar-session LiveAvatar · avatar video · Sequence participant LiveAvatar avatar video Swamiji API · /api/swamiji · Sequence participant Swamiji API /api/swamiji Swamiji · voice agent · Sequence participant Swamiji voice agent Postgres · session + turn rows · Sequence participant Postgres session + turn rows Legend main request return security async trace message