Declining a Call

Any user that receives the call:incoming event can either join, decline, or ignore the call. This page describes how to decline with the following method:

This method triggers the call:ended event for all call members and the call:closed event for the current user.

Example

client.on('call:incoming', (call) => {
this.currentCall = call;
});
const declineCall = async () => {
try {
await client.calls.decline(this.currentCall);
console.log('Declined call');
} catch (e) {
console.error('Failed to decline call');
}
};