Skip to main content

Voice

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

info

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.

import { SignalWire } from "@signalwire/realtime-api";

const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" })


await client.voice.listen({
topics: ["office"],
onCallReceived: (call) => {
call.answer();
call.playTTS({ text: "Hello world" });
}
});

Classes