WP-CHAT-CALL-SERVER-01 — Hoàn thiện máy chủ chat/gọi (không thiết bị thật)
Domain: D-CHAT · Surfaces: API · CON · 2026-08-22 · Status: IMP
Không CallKit / TURN bắt buộc / react-native-webrtc package.
Máy chủ đã có (trước WP này)
| Khối |
API / WS |
Ghi chú |
| Hội thoại |
GET/POST /chat/conversations* · tin · đọc · mute · đính kèm |
IMP |
| Signaling |
Socket.IO /chat · call:ring · call:signal · call:answered · call:ended |
IMP |
| Cuộc gọi REST |
POST /chat/calls · answer · end · GET /chat/calls · GET /chat/calls/:id |
IMP |
| Nhỡ |
Timer 45s + sweep khi list/get |
WP-CHAT-CALL-LOCK-01 |
| Push |
call.incoming / call.missed · skip khi đang trong thread |
IMP |
Bổ sung WP này
| # |
Gap |
Cách làm |
| 1 |
Gọi chồng khi RINGING/ACTIVE |
409 «Bạn/Người nhận đang trong cuộc gọi khác» |
| 2 |
Restart API mất timer RINGING |
Interval 15s sweepStaleRings toàn bảng |
| 3 |
Bubble CALL không đổi status |
patchCallMessage RINGING→ACTIVE/MISSED/ENDED/… |
| 4 |
ICE chỉ hard-code FE |
GET /chat/ice-servers · STUN mặc định · TURN = WELIFE_ICE_SERVERS |
| 5 |
Presence chỉ emit cho chính mình |
Broadcast presence + peers[].online trên list/detail |
| 6 |
Answer/end lặp |
Answer ACTIVE idempotent · end terminal trả bản ghi hiện tại |
Không làm — BLOCKED
- CallKit / PushKit / ConnectionService
- TURN bắt buộc / secret trên client
- Package
react-native-webrtc (gãy Expo Go)
Files
api/src/modules/chat/call-ice.util.ts · call-ring.util.ts · chat.service.ts · chat.controller.ts · chat-realtime.service.ts · chat-socket.bootstrap.ts
mobile/src/services/api.ts · CallScreen.tsx · ConversationsScreen.tsx
api/.env.example · WELIFE_ICE_SERVERS