dial
Initiate an outbound call. Sends a calling.dial JSON-RPC request and waits for the
server to return a calling.call.dial event confirming the call was answered or failed.
Returns a fully-initialized Call object
with valid callId and nodeId.
The devices parameter supports both serial and parallel dialing strategies. Each
inner array represents a set of devices to ring simultaneously (parallel). The outer
array represents sequential attempts — if the first group fails, the next group is
tried.
Throws RelayError if the dial fails or if no answer is received within the
dialTimeout period. The default timeout is 120 seconds.
Parameters
devices
Nested array of device definitions for serial and parallel dialing. Each device is
an object with type and params keys. You can also put the fields flat next
to type; the SDK wraps them in params and, for "phone", maps to and
from to to_number and from_number.
- Serial dial (try one after another): each inner array has one device
- Parallel dial (ring simultaneously): one inner array with multiple devices
Up to 20 devices are dialed in total, counted across all inner arrays rather than per array. Any device after the 20th is skipped.
devices[][].type
Device type. Valid values:
"phone"— PSTN phone number"sip"— SIP endpoint
To reach a resource address, such as a subscriber, use a "fabric" device
with connect on an existing call. dial places only "phone" and "sip" devices.
devices[][].params
Device-specific parameters. Which fields apply depends on the device type.
devices[][].params.to_number
Destination phone number in E.164 format. Required for "phone".
devices[][].params.from_number
Caller ID phone number in E.164 format. Required for "phone". By default,
it must be a number you bought in this project or a verified caller ID, or,
when connecting an existing call, that call’s own from or to number.
SignalWire support can lift this restriction for your account, after which
any E.164 number works.
devices[][].params.to
Destination. Required for "sip", where it’s a SIP URI starting with sip:
or sips:, and, on connect, for "fabric", where it’s a resource address.
devices[][].params.from
Caller ID. Required for "sip" and, on connect, for "fabric". Use a SIP URI
or a caller ID string, such as a phone number. For a SIP destination, a caller
ID string can contain letters, digits, and _, ., -, +, or ,. By
default it must also be a number you bought in this project or a verified
caller ID, or, when connecting an existing call, that call’s own from or to
number. SignalWire support can lift this restriction for your account.
devices[][].params.from_name
Caller ID name shown to the person you’re calling, for "sip". Use 1 to 70
characters: letters, digits, spaces, and _, ., -, +, or ,.
devices[][].params.timeout
How long to ring this device, in seconds, before giving up on it.
devices[][].params.headers
Custom SIP headers to add to the INVITE, for "sip". Each header is an object
with a "name" and a non-empty "value". A name must start with X- or be
Privacy, P-Asserted-Identity, or User-to-User. Names starting with
SignalWire, X-SignalWire, X-CID, or X-SW-Xregion are reserved and
rejected.
devices[][].params.session_timeout
Value of the SIP Session-Expires header, in seconds, for "sip". Values
from 1 to 15000 take effect; anything else is ignored and the default is used.
devices[][].params.call_state_url
HTTP or HTTPS URL that receives a webhook when this device’s call changes state. When omitted, the device uses the state URL of the call it’s connected to, if that call has one.
devices[][].params.call_state_events
Which states send a webhook to call_state_url. Valid values: "created",
"ringing", "answered", "ended". When omitted, the device uses the
events of the call it’s connected to, or only "ended" when there are none.
devices[][].params.confirm
SWML to run on this device’s call after it answers and before it’s
connected, for example to have the callee press a key to accept. Either an HTTP or HTTPS URL
that returns a SWML document, or an array of SWML methods to run inline. The
same methods are allowed as in the SWML connect.confirm
parameter.
devices[][].params.confirm_timeout
How long confirm can run, in seconds. Defaults to the device’s timeout.
options
Optional second argument with dial configuration.
options.tag
Client-provided correlation tag for event matching. Auto-generated as a UUID if not supplied.
options.maxDuration
Maximum call duration in seconds. The call is automatically ended when this limit is reached.
options.dialTimeout
How long in seconds to wait for the dial to complete (answer or failure) before throwing a timeout error. Matches the Python SDK convention.
Returns
Promise<Call> — A call object with all properties populated and ready for call control operations.