Call Flow
End-to-end sequence
1. Backend validates business permission
2. Client receives session token + ws_url + ice_servers
3. Client connects WebSocket
4. Caller sends call.invite
5. Service sends call.ringing to callee
6. Callee accepts
7. Caller starts WebRTC offer
8. Peers exchange answer and ICE candidates
9. Media connects
10. Client sends/receives call.connected
11. Either side sends call.end when finished
Caller invites receiver example
Caller Client Application Backend Blendlix Call Service Receiver Client
| | | |
| request call session | | |
|------------------------------>| check caller/receiver access | |
| | request session token | |
| |----------------------------->| |
| | token + ws_url + ICE | |
|<------------------------------|<-----------------------------| |
| connect WebSocket | | |
|------------------------------------------------------------->| |
| call.invite | | |
|------------------------------------------------------------->| call.ringing |
| | |--------------------------->|
| | | accept |
| | |<---------------------------|
| call.accepted | | |
|<-------------------------------------------------------------| |
| webrtc.offer | | |
|------------------------------------------------------------->| webrtc.offer |
| | |--------------------------->|
| webrtc.answer | | |
|<-------------------------------------------------------------|<---------------------------|
| ICE candidates both ways | | ICE candidates both ways |
|<------------------------------------------------------------>|<-------------------------->|
| audio connected | | audio connected |
State progression
initiated -> ringing -> accepted -> connecting -> connected -> ended
Other valid endings:
ringing -> rejected
ringing -> canceled
ringing -> missed
connecting -> failed
connected -> ended
What each state means
| State | Meaning | Typical UI |
|---|---|---|
ringing | Invite sent and waiting for peer. | Outgoing screen says "Ringing". Incoming screen shows Accept/Reject. |
accepted | Peer accepted, but media is not connected yet. | Show "Connecting". |
connecting | WebRTC offer/answer/ICE exchange is happening. | Keep spinner or connection text. |
connected | Audio media is established. | Show call timer, mute, speaker, end buttons. |
rejected | Callee declined. | Close call screen or show "Call declined". |
canceled | Caller canceled before answer. | Close incoming screen. |
missed | Callee did not answer before timeout. | Show missed state. |
ended | Either side ended the call. | Close screen and clean resources. |
Cleanup rules
When the call ends, the client should:
- send
call.endif it initiated the end - close
RTCPeerConnection - stop microphone tracks
- close or reuse the WebSocket according to the application design
- reset UI state