dialPhone

View as Markdown

dialPhone

  • dialPhone(params): Promise<Call>

Makes an outbound call to a PSTN number.

Parameters

params
objectRequired

Object containing the parameters for dialing a phone number.

to
stringRequired

The party you are attempting to call.

from
string

The party the call is coming from. Must be a SignalWire number or SIP endpoint that you own.

timeout
number

The time, in seconds, the call will ring before it is considered unanswered.

maxPricePerMinute
number

The maximum price in USD acceptable for the call to be created. If the rate for the call is greater than this value, the call will not be created. If not set, all calls will be created. Price can have a maximum of four decimal places, i.e. 0.0075.

listen
object

Object that contains callbacks to listen for events. List of Call events can be found here.

Returns

Promise<Call>

A call object.

Example

1import { SignalWire, Voice } from "@signalwire/realtime-api";
2
3const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" })
4
5const voiceClient = client.voice
6
7try {
8 const call = await voiceClient.dialPhone({
9 from: "+YYYYYYYYYY",
10 to: "+XXXXXXXXXX",
11 timeout: 30
12 });
13 console.log("Call answered.", call);
14} catch (e) {
15 console.log("Call not answered.", e);
16}