sendDigits

View as Markdown

sendDigits

  • sendDigits(digits): Promise<Call>

Play DTMF digits to the other party on the call.

Parameters

digits
stringRequired

The DTMF digits to send to the other party on the call.

Returns

Promise<Call>

A promise that resolves to the current Call object.

Example

In this example, we dial a phone number and send DTMF tones to the other party on the call. After the tones are sent, we hangup the call.

1import { SignalWire } from "@signalwire/realtime-api";
2
3const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" })
4
5const voiceClient = client.voice;
6
7// Listen for incoming calls
8await voiceClient.listen({
9 topics: ["office"],
10 onCallReceived: async (call) => {
11 console.log("Call received");
12 // Answer the call
13 call.answer();
14
15 // Send DTMF tones to the Inbound leg of the call
16 await call.sendDigits("123")
17 console.log("DTMF tones sent!");
18 call.hangup();
19
20 }
21});