Voice Client

View as Markdown

The Voice Client allows you to make outbound calls and receive inbound calls. Access it via the voice property on a SignalWire Client.

1import { SignalWire } from "@signalwire/realtime-api";
2
3const client = await SignalWire({ project: "<project-id>", token: "<api-token>" });
4const voiceClient = client.voice;

Use dialPhone or dialSip to initiate outbound calls, or listen to receive inbound calls on specific topics. See Events for all available events.

Examples

Receiving calls

1await voiceClient.listen({
2 topics: ["office"],
3 onCallReceived: async (call) => {
4 console.log("Got call", call.from, call.to);
5 await call.answer();
6 }
7});

Making calls

1const call = await voiceClient.dialPhone({
2 from: "+15551234567",
3 to: "+15559876543",
4 timeout: 30,
5});