Skip to content

Class: Call ​

A call: one this client placed with client.call(), or one ringing it (incomingCall). One object for the life of the call, whose getters follow its state. It stays client.activeCall (useCall() in React) after it ends, until the next call takes its place, so a view drawn after the end can still read status and endReason.

Accessors ​

answeredAt ​

Get Signature ​

ts
get answeredAt(): number | null;
Returns ​

number | null


direction ​

Get Signature ​

ts
get direction(): CallDirection;
Returns ​

CallDirection


endReason ​

Get Signature ​

ts
get endReason(): CallEndReason | null;

How the call ended, from this client's side (hangup when this side hung up, remote_hangup when the other side did); null until it has ended. The same reason callEnded gave.

Returns ​

CallEndReason | null


expiresAt ​

Get Signature ​

ts
get expiresAt(): number | null;

Absolute, from the server, so a client that was asleep decides for itself rather than trusting a countdown it never saw start.

Returns ​

number | null


from ​

Get Signature ​

ts
get from(): string | null;
Returns ​

string | null


media ​

Get Signature ​

ts
get media(): CallMedia;
Returns ​

CallMedia


peers ​

Get Signature ​

ts
get peers(): string[];

The caller on an incoming call; the invitees on an outgoing one; on a queue call, nobody until a member answers, then that member.

Returns ​

string[]


queue ​

Get Signature ​

ts
get queue(): QueueProgress | null;

A queue call's place in line, who answered, or why nobody did. Null on a direct call.

Returns ​

QueueProgress | null


room ​

Get Signature ​

ts
get room(): Room | null;

The call's room while this client is in it: null while an incoming call rings, and once the call is over.

Returns ​

Room | null


roomSid ​

Get Signature ​

ts
get roomSid(): string;
Returns ​

string


sid ​

Get Signature ​

ts
get sid(): string;
Returns ​

string


status ​

Get Signature ​

ts
get status(): CallStatus;
Returns ​

CallStatus

Methods ​

accept() ​

ts
accept(opts?): Promise<Room>;

Answer. Resolves with the room, so the common case is one await.

When another tab or device of this identity answers at the same moment, the server picks one: the other rejects with already_answered.

Refused invalid_state while this client is in a room: whether answering leaves it is the host's to decide, by leaving first.

Parameters ​

ParameterType
opts{ media?: CallMedia; }
opts.media?CallMedia

Returns ​

Promise<Room>


cancel() ​

ts
cancel(): Promise<void>;

On a queue call, leaves the queue (LeaveQueue).

Returns ​

Promise<void>


hangup() ​

ts
hangup(): Promise<void>;

Leaving the room is the hangup in a p2p call: two seats, one empty, nothing left to negotiate. Refused invalid_state while an incoming call rings: that is declined with reject().

Returns ​

Promise<void>


reject() ​

ts
reject(reason?): Promise<void>;

reason is opaque and tenant-supplied: the platform stores it and never reads it.

Parameters ​

ParameterTypeDefault value
reasonstring''

Returns ​

Promise<void>

Talkline documentation