***

title: Actions
slug: /reference/typescript/relay/actions
description: Action classes returned from call control methods.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[play]: /docs/server-sdks/reference/typescript/relay/call/play

[record]: /docs/server-sdks/reference/typescript/relay/call/record

[detect]: /docs/server-sdks/reference/typescript/relay/call/detect

[call]: /docs/server-sdks/reference/typescript/relay/call

[relayevent]: /docs/server-sdks/reference/typescript/relay/events

[play-action]: /docs/server-sdks/reference/typescript/relay/actions/play-action

[record-action]: /docs/server-sdks/reference/typescript/relay/actions/record-action

[collect-action]: /docs/server-sdks/reference/typescript/relay/actions/collect-action

[detect-action]: /docs/server-sdks/reference/typescript/relay/actions/detect-action

[standalone-collect-action]: /docs/server-sdks/reference/typescript/relay/actions/standalone-collect-action

[fax-action]: /docs/server-sdks/reference/typescript/relay/actions/fax-action

[tap-action]: /docs/server-sdks/reference/typescript/relay/actions/tap-action

[stream-action]: /docs/server-sdks/reference/typescript/relay/actions/stream-action

[pay-action]: /docs/server-sdks/reference/typescript/relay/actions/pay-action

[transcribe-action]: /docs/server-sdks/reference/typescript/relay/actions/transcribe-action

[ai-action]: /docs/server-sdks/reference/typescript/relay/actions/ai-action

[ref-playaction]: /docs/server-sdks/reference/typescript/relay/actions/play-action

Action objects are returned from call control methods like
[`play()`][play],
[`record()`][record], and
[`detect()`][detect]. They provide a common
interface for tracking and controlling in-progress operations on a
[`Call`][call].

All action classes extend a shared base that provides `isDone`, `completed`,
`result`, `controlId`, and the `wait()` method. Specific action types add
methods relevant to their operation (e.g., `pause()` and `resume()` on
[`PlayAction`][ref-playaction]).

```typescript {11}
import { RelayClient } from '@signalwire/sdk';

const client = new RelayClient({
  project: process.env.SIGNALWIRE_PROJECT_ID!,
  token: process.env.SIGNALWIRE_TOKEN!,
  contexts: ['default']
});

client.onCall(async (call) => {
  await call.answer();
  const playAction = await call.play([{ type: 'tts', text: 'Hello!' }]);

  // Control the in-progress operation
  await playAction.pause();
  await playAction.resume();

  // Wait for completion
  const event = await playAction.wait();
});

await client.run();
```

## **Action (Base Interface)**

All action classes share these properties and methods.

### **Properties**

<ParamField path="controlId" type="string" toc={true}>
  Unique identifier for this operation, used to correlate commands and events.
</ParamField>

<ParamField path="isDone" type="boolean" toc={true}>
  `true` if the underlying promise has resolved (the operation has reached a terminal state).
</ParamField>

<ParamField path="completed" type="boolean" toc={true}>
  `true` once the action has finished and the terminal event has been processed.
</ParamField>

<ParamField path="result" type="RelayEvent | null" toc={true}>
  The terminal [`RelayEvent`][relayevent] for this action,
  or `null` if the action has not yet completed.
</ParamField>

### **Methods**

#### wait

Await the action's completion and return the terminal event.

<ParamField path="timeout" type="number | undefined" toc={true}>
  Maximum milliseconds to wait. `undefined` waits indefinitely. Throws an `Error`
  if exceeded.
</ParamField>

## **Subclasses**

<CardGroup cols={2}>
  <Card title="PlayAction" href="/docs/server-sdks/reference/typescript/relay/actions/play-action">
    Tracks audio playback. Supports pause, resume, volume, and stop.
  </Card>

  <Card title="RecordAction" href="/docs/server-sdks/reference/typescript/relay/actions/record-action">
    Tracks recording. Supports pause, resume, and stop.
  </Card>

  <Card title="CollectAction" href="/docs/server-sdks/reference/typescript/relay/actions/collect-action">
    Tracks play-and-collect. Supports stop, volume, and input timers.
  </Card>

  <Card title="DetectAction" href="/docs/server-sdks/reference/typescript/relay/actions/detect-action">
    Tracks detection (answering machine, fax, digits). Stop only.
  </Card>

  <Card title="StandaloneCollectAction" href="/docs/server-sdks/reference/typescript/relay/actions/standalone-collect-action">
    Tracks standalone input collection. Stop and input timers.
  </Card>

  <Card title="FaxAction" href="/docs/server-sdks/reference/typescript/relay/actions/fax-action">
    Tracks fax send/receive. Stop only.
  </Card>

  <Card title="TapAction" href="/docs/server-sdks/reference/typescript/relay/actions/tap-action">
    Tracks media interception. Stop only.
  </Card>

  <Card title="StreamAction" href="/docs/server-sdks/reference/typescript/relay/actions/stream-action">
    Tracks audio streaming to WebSocket. Stop only.
  </Card>

  <Card title="PayAction" href="/docs/server-sdks/reference/typescript/relay/actions/pay-action">
    Tracks payment collection. Stop only.
  </Card>

  <Card title="TranscribeAction" href="/docs/server-sdks/reference/typescript/relay/actions/transcribe-action">
    Tracks transcription. Stop only.
  </Card>

  <Card title="AIAction" href="/docs/server-sdks/reference/typescript/relay/actions/ai-action">
    Tracks an AI agent session. Stop only.
  </Card>
</CardGroup>