Voice

View as Markdown

Access the Voice API. You can instantiate a Voice.Client to make or receive calls.

Refer to Events for a full list of events emitted by a Voice.Client object.

Example

The following example answers any call in the office topic, and immediately plays some speech.

1import { SignalWire } from "@signalwire/realtime-api";
2
3const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" })
4
5await client.voice.listen({
6 topics: ["office"],
7 onCallReceived: (call) => {
8 call.answer();
9 call.playTTS({ text: "Hello world" });
10 }
11});

Classes