Setting Up Calls
Voice and video calling is built on top of the same initialize() client. No extra setup is required beyond requesting device permissions.
Start a call
const callId = await client.startCall('callee-user-id');
console.log('Call initiated:', callId);Answer or reject an incoming call
client.onCallEvent(async (event) => {
if (event.type === 'CALL_INVITE') {
await client.acceptCall(event.callId);
//, or ,
await client.rejectCall(event.callId);
}
});End a call
await client.endCall(callId);Toggle video mid-call
client.toggleVideo(callId, true); // camera on
client.toggleVideo(callId, false); // camera offTURN credentials
const turn = await client.fetchTurnCredentials();
// { username, password, uri, ttlSeconds }