/bcalls namespace and coordinated through a lightweight REST layer that provisions tokens and lists available servers. This guide covers everything from starting your first call to sharing your screen and hanging up.
Prerequisites
- You must be a member of the Branch you want to call.
- Connect to the
/bcallsSocket.IO namespace (in addition to the main/namespace). - Your session cookie must be valid.
Only one active call can exist per Branch at a time. If a call is already in progress, you will receive an error if you try to start a second one.
Step 1 — Get Available Voice Servers
GET /api/calls/servers
Retrieve the list of available regional voice servers before starting a call. You can optionally pass the preferred server when you emit start_call.
Step 2 — Get a Call Token
POST /api/calls/token
Obtain a signed token that your WebRTC layer uses to authenticate with the voice server.
Step 3 — Connect to the /bcalls Namespace
Step 4 — Start a Call
Emitstart_call on the main / namespace (socket) with the Branch ID. Optionally pass a server_addr from the servers list to route the call to a specific region.
start_call is emitted on the main / namespace, not on /bcalls. All other call-control events (join_call, leave_call, mic_toggle, etc.) are emitted on callSocket (/bcalls).new_call event on the main / namespace with the same Call object.
Step 5 — Join an Incoming Call
When another member starts a call, you receivenew_call on the main namespace. Join by emitting join_call on the /bcalls namespace:
waiting list to the members list in the Call object, and all participants receive an update event.
Step 6 — Reject an Incoming Call
If you do not want to join, emitreject_call to dismiss the notification:
Step 7 — Manage Your Microphone
Toggle mute state withmic_toggle. When off is true you are muted; false un-mutes you:
mic_off array when you are muted. All participants receive an update event.
Step 8 — Share Your Screen
Start screen sharing withtoggle_screen_sharing:
sharing_screen object. The value is an array of participant IDs who are currently watching your stream.
Step 9 — Watch Someone’s Screen Share
Express intent to watch a specific participant’s screen withtoggle_watching_screen_sharing:
The
author must currently be sharing their screen. If they are not, you will receive an error event.Step 10 — Leave the Call
stop_call ({id: 12}) to any users still in the waiting list.
Call State Object
Everyupdate, started_call, and new_call event carries a Call object:
number
The Branch ID the call belongs to.
array of numbers
User IDs of participants currently in the call.
array of numbers
User IDs of Branch members who have been invited but have not yet joined.
array of numbers
User IDs of participants who are currently muted.
object
Map of
user_id → [watcher_ids]. Each key is a participant sharing their screen; the value is the list of participants watching them.string or null
The voice server hostname this call is routed through, if one was specified at start time.
Get the Current Call State via REST
If you need to poll the call state (for example, on page load), usePOST /api/calls/get:
null if no call is active in that Branch.