Call
The Call class represents a live RELAY call and provides methods for
controlling every aspect of the call — answering, playing audio, recording,
collecting input, bridging, conferencing, AI agents, and more. Call objects are
created automatically by RelayClient
when an inbound call arrives or when you dial an outbound call.
All call control methods are async and communicate with SignalWire over
WebSocket using the RELAY JSON-RPC protocol. Methods that start long-running
operations (play, record, detect, etc.) return Action
objects that let you stop, pause, or wait for the operation to complete.
Properties
callId
Unique identifier for this call, assigned by SignalWire.
nodeId
Identifier of the RELAY node handling this call.
projectId
SignalWire project ID that owns this call.
context
The context (routing label) the call is associated with.
tag
Correlation tag for tracking related calls. Empty string if not set.
direction
Call direction. Valid values:
"inbound"— incoming call"outbound"— outgoing call
device
Device information for the call endpoint. Contains type (e.g., "phone") and
params (e.g., {"from_number": "+1...", "to_number": "+1..."}).
state
Current call state. Valid values:
"created"— call has been initiated"ringing"— ringing at the destination"answered"— call is active"ending"— hangup in progress"ended"— call has terminated
segmentId
Call segment identifier for tracking call legs.
Methods
Register an event listener on a call.
Wait for a specific event on a call.
Wait for a call to reach the ended state.
Answer an inbound RELAY call.
End a RELAY call.
Decline control of an inbound call and return it to routing.
Disconnect (unbridge) a connected call.
Transfer call control to another RELAY application or SWML script.
Bridge a call to one or more destinations.
Put a call on hold.
Resume a held call.
Play audio content on a call.
Record audio from a call.
Play audio and collect DTMF or speech input.
Collect DTMF or speech input without playing media.
Detect answering machines, fax tones, or digits on a call.
Start an AI agent session on a call.
Connect a call to an Amazon Bedrock AI agent.
Put an AI agent session on hold.
Resume an AI agent session from hold.
Send a message to an active AI agent session.
Start noise reduction on a call.
Stop noise reduction on a call.
Send DTMF digits on a call.
Echo call audio back to the caller for testing.
Bind a DTMF digit sequence to trigger a RELAY method.
Clear DTMF digit bindings on a call.
Send a custom user-defined event on a call.
Transfer a SIP call to an external endpoint via SIP REFER.
Intercept call media and stream it to an external destination.
Stream call audio to a WebSocket endpoint.
Send a fax document on a call.
Receive a fax on a call.
Collect payment information on a call.
Start transcribing call audio.
Start or stop live transcription on a call.
Start or stop live translation on a call.
Join an ad-hoc audio conference.
Leave an audio conference.
Join a video/audio room.
Leave a video/audio room.
Place a call into a named queue.
Remove a call from a queue.
Example
Events
Events are emitted during the lifecycle of a call and its operations. Register
handlers using call.on() to react
to state changes, errors, and operation completions.
See the Events reference for the full list of calling events, their parameters, and typed event classes.