Joining a Call
Any user that receives the call:incoming
event can either join, decline, or ignore the call. This page describes how to join with the following method:
This method triggers the call:answered and call:memberUpdate events.
The calls.join()
methods will return a Promise<Call>
object. Once resolved, the Call object will contain the Twilio Room.
Use this room to publish the user's audio and video tracks to all room participants.
Example
client.on('call:incoming', (call) => {// call.room will be undefinedthis.currentCall = call;});const joinCall = async () => {try {this.currentCall = await client.calls.join(this.currentCall);// this.currentCall.room will be definedconsole.log('Joined call', this.currentCall);} catch (e) {console.error('Failed to join call');}};