Call Flow

Full one-to-one audio call flow from token bootstrap to end.

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

StateMeaningTypical UI
ringingInvite sent and waiting for peer.Outgoing screen says "Ringing". Incoming screen shows Accept/Reject.
acceptedPeer accepted, but media is not connected yet.Show "Connecting".
connectingWebRTC offer/answer/ICE exchange is happening.Keep spinner or connection text.
connectedAudio media is established.Show call timer, mute, speaker, end buttons.
rejectedCallee declined.Close call screen or show "Call declined".
canceledCaller canceled before answer.Close incoming screen.
missedCallee did not answer before timeout.Show missed state.
endedEither side ended the call.Close screen and clean resources.

Cleanup rules

When the call ends, the client should:

  1. send call.end if it initiated the end
  2. close RTCPeerConnection
  3. stop microphone tracks
  4. close or reuse the WebSocket according to the application design
  5. reset UI state