pass

View as Markdown

pass

  • pass(params): Promise<Call>

This will allow a client to decline incoming calls without ending the call and redirect the call to another Voice client.

Will trigger on the onCallReceived event.

Returns

Promise<Call>

A promise that resolves to the Call object that you can use to control the call.

Example

In this example, we listen for an incoming call and then pass the call to a different topic.

1import { SignalWire } from "@signalwire/realtime-api";
2
3const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" })
4
5const voiceClient = client.voice;
6
7await voiceClient.listen({
8 topics: ["office"],
9 onCallReceived: (call) => {
10 // pass the call to a different client
11 call.pass();
12 }
13});