# Phone & SMS

Source: https://docs.autessa.com/docs/tools/phone-sms

> Tool types for placing outbound phone calls, controlling a live call (hang up, transfer, voicemail, keypad, recording, caller info, asking for keypad entry, secure keypad capture), and sending text messages.

# Phone & SMS

Let an agent place real outbound phone calls, control the call it's on (hang up, transfer, take a voicemail, press keys, pause the recording, look up the caller, take card details on the keypad), and send text messages.

These tools ride on your company's [phone numbers](/docs/guide/agentic/phone-numbers.md): every call originates from a phone configuration you own, referenced by `phoneConfigId`. The phone configuration also decides which agent answers the line, so a call placed by a tool becomes a live voice conversation with that agent. Calls are metered against your company's call-minute limit. Texts additionally need your company's [Text Messaging registration](/docs/guide/agentic/sms-setup.md) and the recipient's [consent](/docs/guide/agentic/sms-consent.md).

## Make Phone Call **TOOL** `MAKE_PHONE_CALL`

Places an outbound call from the phone number in `phoneConfigId` to `toPhoneNumber` and returns as soon as the carrier accepts it — the conversation itself runs asynchronously through the voice pipeline. The opening line can be static (`initialMessage`) or generated live: when `initialMessagePrompt` is set, the phone configuration's agent runs the prompt before the call connects and speaks the generated response when the recipient answers. Setting `initialMessagePrompt` or `voicemailAudioUrl` implicitly enables answering-machine detection, so a voicemail can be left when no one picks up — `voicemailAudioUrl` accepts an audio URL, or plain text that is converted to speech with the agent's voice. `conferenceParticipants` dials additional numbers into the call as it starts, and `skipInitialMessage` keeps the AI silent for a human-to-human bridge.

The result confirms initiation, not outcome: `{"success": true, "callSid": ..., "fromPhoneNumber": ..., "toPhoneNumber": ..., "status": ..., "amdEnabled": ...}`, plus fields describing the generated message, voicemail, and conference setup when used. How the call actually went (answered, voicemail left, which key was pressed, the transcript) lands in your company's [Phone calls table](/docs/guide/agentic/phone-numbers.md#the-phone-calls-table) once the call ends.

### Call modes

`mode` decides what happens when the other person picks up. It defaults to `AI_CONVERSATION`.

| Mode | What happens | Fields it uses |
| --- | --- | --- |
| `AI_CONVERSATION` | The number's agent holds a live conversation, as described above. | `initialMessage`, `initialMessagePrompt`, `voicemailAudioUrl`, and the rest |
| `PLAY_MESSAGE` | A spoken message is played and no AI is involved. Use it for reminders, alerts, and confirmations. | `message`, `keypadOptions`, `repeatMessage` |
| `CONNECT_TO_PEOPLE` | Once the other person answers, your staff are rung and joined to the call. No AI is involved. | `ring` |

**Play a message.** `message` is the text that's spoken. Add `keypadOptions` to ask for a key press, for example `{"1": "Confirmed", "2": "Reschedule"}`. The label of the key the person presses is saved in the call's `keypad_response` column in the Phone calls table, so a [trigger](/docs/guide/agentic/phone-numbers.md#build-your-own-automations) can act on it. `repeatMessage` sets how many times the message repeats when no key is pressed (default `1`). If an answering machine picks up, the voicemail settings work the same way as in an AI call.

**Connect to people.** `ring` lists who to ring once the call is answered, in the same shape as a number's [ring settings](/docs/guide/agentic/phone-numbers.md#ringing-people): `targets` (a list of `{ "to": ..., "label": ..., "ringSeconds": ... }`, where `to` is a phone number in E.164 format or `client:<identity>` for a teammate's browser phone), `strategy` (`SIMULTANEOUS` or `SEQUENTIAL`), `ringSeconds`, `requireKeyPress`, `whisper`, `callerId`, `waitAudio`, `maxTotalSeconds`, and `noAnswer` (what to do when nobody picks up). If nobody picks up and you didn't set `noAnswer`, the person you called hears a short apology and the call ends.

### Ringing, retries, and calling hours

- **`ringTimeoutSeconds`**: how long to let the phone ring before the call counts as not answered, from `5` to `120` (default `30`). Keep it under about 25 seconds if you'd rather not reach voicemail, or raise it to give people time to get to the phone.
- **`retry`**: try again when the call doesn't go through. `onBusy`, `onNoAnswer`, and `onFailed` choose which outcomes to retry, `maxAttempts` is the total number of tries including the first, from `1` to `5` (default `1`, meaning no retries), and `delayMinutes` is the wait between tries, from `1` to `1440` (default `10`).
- **`callingHours`**: only call during these hours, in the time zone you give (usually the recipient's). `timezone` (for example `America/Chicago`), `weekly` (a list of `{ "day": "MONDAY", "open": "09:00", "close": "17:00" }`, in the same format as [business hours](/docs/guide/agentic/phone-numbers.md#business-hours-and-holidays)), and `outsideHours`: `WAIT` (default) places the call as soon as the next window opens, and `FAIL` doesn't place it and returns an error instead. Retries that land outside the hours wait for the next window too.

Waiting calls and retries aren't hidden. Each one is a one-time [scheduled job](/docs/guide/scheduled-jobs.md) that runs this same tool with the same settings, so you can see when the next try will happen, and cancel it, on the Scheduled Jobs page.

```json title="Retry a reminder call, weekdays 9 to 6 only"
{
  "ringTimeoutSeconds": 25,
  "retry": { "onBusy": true, "onNoAnswer": true, "maxAttempts": 3, "delayMinutes": 60 },
  "callingHours": {
    "timezone": "America/Chicago",
    "weekly": [
      { "day": "MONDAY", "open": "09:00", "close": "18:00" },
      { "day": "TUESDAY", "open": "09:00", "close": "18:00" },
      { "day": "WEDNESDAY", "open": "09:00", "close": "18:00" },
      { "day": "THURSDAY", "open": "09:00", "close": "18:00" },
      { "day": "FRIDAY", "open": "09:00", "close": "18:00" }
    ],
    "outsideHours": "WAIT"
  }
}
```

### Settings for this call

Every call follows the [call settings](/docs/guide/agentic/phone-numbers.md#recording-transcripts-and-limits) of the number it's placed from: transcript, recording, Call Redaction, call limits, caller info, voice and language, AI call behavior, and answering machine detection. Set `callSettings` to override them for this call only. Each section you include (`transcript`, `recording`, `redaction`, `limits`, `callerInfo`, `speech`, `ai`, `answeringMachine`) replaces that whole section of the number's settings, and sections you leave out keep the number's values. The sections are described in the [call settings object](/docs/api/poweruser/phone-numbers.md#the-call-settings-object).

```json title="Record this call and stop it after 10 minutes"
{
  "callSettings": {
    "recording": { "save": true, "announcement": "This call may be recorded." },
    "limits": { "maxDurationMinutes": 10 }
  }
}
```

### Example

```json title="Tool config"
{
  "toolType": "MAKE_PHONE_CALL",
  "phoneConfigId": "V1StGXR8Z5",
  "toPhoneNumber": "@@{TO_PHONE_NUMBER}",
  "initialMessage": "",
  "initialMessagePrompt": "Greet @@{CUSTOMER_NAME} and say you are calling about their open support ticket.",
  "environmentVariables": {},
  "promptTemplateVariables": {},
  "voicemailAudioUrl": "Hi, this is Acme Support calling about your ticket. We'll try again tomorrow.",
  "conferenceParticipants": [],
  "skipInitialMessage": false,
  "clientDisplayMessage": ""
}
```

```json title="Tool config: appointment reminder with a key press"
{
  "toolType": "MAKE_PHONE_CALL",
  "phoneConfigId": "V1StGXR8Z5",
  "toPhoneNumber": "@@{TO_PHONE_NUMBER}",
  "mode": "PLAY_MESSAGE",
  "message": "Hi, this is Acme Dental reminding you of your appointment tomorrow at 10 AM. Press 1 to confirm, or 2 if you need to reschedule.",
  "keypadOptions": { "1": "Confirmed", "2": "Reschedule" },
  "repeatMessage": 2
}
```

**Configuration fields**

- `phoneConfigId` (string (ID)) — Which phone number to call from — the only true config-level field (persisted on the tool). References a phone configuration by ID.
- `toPhoneNumber` (string) — Required string value.
- `initialMessage` (string) — Required string value.
- `initialMessagePrompt` (string) — Prompt sent to the LLM to dynamically generate the initial message before the call connects. When provided, the agent conversation starts before the call is placed, the LLM generates a response to this prompt, and that response is spoken when the recipient answers. AMD (Answering Machine Detection) is automatically enabled when this is set, allowing the message to be left as voicemail if no one answers.
- `task` (string · optional) — AI_CONVERSATION: what the AI on the call is to do, in plain words, e.g. "Ask whether they are open today and until what time". The number's AI gets it before the callee's first reply, so it does this call's job rather than only what it was set up for. At most {@value #MAX_TASK_CHARS} characters. Optional.
- `agentId` (integer · optional) — AI_CONVERSATION: the agent that talks on the call in place of the number's own AI, which is set up to answer the number's incoming calls. Set by the platform for task calls (PhoneCallPlacementService, the company's calling agent); not a tool argument. Must belong to the number's company. Optional.
- `environmentVariables` (object · optional) — AI_CONVERSATION: the agent that talks on the call in place of the number's own AI, which is set up to answer the number's incoming calls. Set by the platform for task calls (PhoneCallPlacementService, the company's calling agent); not a tool argument. Must belong to the number's company. Optional.
- `promptTemplateVariables` (object · optional) — AI_CONVERSATION: the agent that talks on the call in place of the number's own AI, which is set up to answer the number's incoming calls. Set by the platform for task calls (PhoneCallPlacementService, the company's calling agent); not a tool argument. Must belong to the number's company. Optional.
- `voicemailAudioUrl` (string) — URL to a WAV/MP3 audio file to play as voicemail when AMD detects an answering machine. When set, AMD is automatically enabled. If a machine answers, this audio is played and the call hangs up.
- `voicemailBehavior` (string) — What to do when an answering machine answers instead of a person: `LEAVE_MESSAGE` (default), `HANG_UP`, or `STAY_ON`.  With `LEAVE_MESSAGE` the call ends as soon as Twilio confirms the message finished playing. `HANG_UP` ends the call without saying anything, for calls that are only worth making if a person picks up.
- `conferenceParticipants` (array<string>) — Additional phone numbers to dial into the conference when the call starts. Each participant will be called and joined to the conference when they answer.
- `skipInitialMessage` (boolean) — When true, the AI agent will not speak an initial message when the call connects. Useful when conference participants are set and the call should be a direct human-to-human connection with the AI silently listening.
- `clientDisplayMessage` (string) — Custom message passed to all browser client participants via connection.customParameters. Applied to all client: participants in the conference when they are dialed.
- `mode` (string · optional) — `AI_CONVERSATION` (default): the number's AI talks with the callee. `PLAY_MESSAGE`: play `#message` (optionally asking for a key from `#keypadOptions`). `CONNECT_TO_PEOPLE`: once the callee answers, ring the people in `#ring` into the call. Optional.
- `message` (string · optional) — PLAY_MESSAGE: what is said, in the number's AI voice. Optional for other modes.
- `keypadOptions` (object · optional) — PLAY_MESSAGE: digit to label, e.g. {"1": "Confirmed"}; the chosen label lands in the call log's keypad_response. Optional.
- `repeatMessage` (integer · optional) — PLAY_MESSAGE: how many times the message plays when no valid key is pressed. Optional; default 1.
- `ring` (object · optional) — CONNECT_TO_PEOPLE: who to ring and how; noAnswer defaults to a short apology and hang-up. Optional for other modes.
- `callSettings` (object · optional) — Per-call override of the from-number's call settings; each section given replaces that whole section. Optional.
- `ringTimeoutSeconds` (integer · optional) — How long the callee's phone rings before the call counts as not answered: 5..120 seconds. Optional; default 30.
- `retry` (object · optional) — Call again when the call doesn't connect (busy, no answer, failed), up to maxAttempts calls in all, delayMinutes apart. Each retry is a scheduled event you can see and cancel. Optional; default no retry.
- `callingHours` (object · optional) — Only place the call inside these hours (in their own time zone). Outside them the call waits for the next opening (outsideHours WAIT, the default, as a scheduled event) or fails (FAIL). Optional.

## Add Conference Participant **TOOL** `PHONE_ADD_CONFERENCE_PARTICIPANT`

Dials another participant into the conference of the phone call the agent is currently on — give this tool to an agent that answers or places calls so it can loop in a human on request. `phoneNumber` accepts a regular phone number or `client:{identity}` for a browser-based client, and the participant joins asynchronously when they answer. Once a participant is added, the AI switches to listen-only mode so the humans can talk directly. Outside an active call the tool is a graceful no-op: it returns success with a note that the person will be looped in, without dialing anyone.

During a call the result is `{"success": true, "message": ..., "phoneNumber": ..., "conferenceRoom": ..., "participantCallSid": ...}`.

### Example

```json title="Tool config"
{
  "toolType": "PHONE_ADD_CONFERENCE_PARTICIPANT",
  "phoneNumber": "@@{PARTICIPANT_PHONE_NUMBER}",
  "displayMessage": "Connecting you with the caller now."
}
```

**Configuration fields**

- `phoneNumber` (string) — Required string value.
- `displayMessage` (string) — Custom message passed to browser clients via connection.customParameters

## Call controls

These tools let an agent that is on a phone call act on the call itself: hang up, transfer, take a message, press keys, pause the recording, look up who it's talking to, ask the caller to type a number on the keypad, or take card details on the keypad without hearing them. Give them to any agent or multi-agent that answers or places calls. From the number's detail page, the **Call tools** card shows which ones the answering agent already has and adds the rest in one click.

They work on the call the agent is currently on, so none of them takes a phone number or call ID for "this call". When the agent isn't on a call (for example, in a chat or a test run in the builder), each one does nothing and returns `{"success": true, "onCall": false, "message": ...}`, so it's safe to give them to an agent that also handles chat and text messages.

While these tools run, the voice stays silent by default, since most of them play their own audio. Secure Keypad Capture is always silent; the others can be given their own phrases. See [What the voice says while tools run](/docs/guide/agentic/phone-numbers.md#what-the-voice-says-while-tools-run).

Every result has the shape `{"success": ..., "onCall": ..., "message": ...}`, plus the extra fields listed for each tool. [Secure Keypad Capture](#secure-keypad-capture-) and [Ask for Keypad Entry](#ask-for-keypad-entry-) are the exceptions: they return a `status` instead. Secure Keypad Capture's is `NOT_ON_CALL` off a call. `message` is plain language, so the agent can repeat it to the caller if it needs to. All fields accept `@@{VAR_NAME}` placeholders.

## Hang Up Call **TOOL** `PHONE_HANG_UP`

Ends the call when the agent decides the conversation is over. The agent finishes what it's saying first, so the caller hears the goodbye before the line goes quiet. The call is logged with `ended_by` set to `AGENT`.

- **`reason`**: kept for your records.
- **`goodbyeMessage`**: a fixed goodbye spoken just before hanging up, such as "Thanks for calling Acme. Goodbye!" Use it when you want every call to end with the same words, whatever the agent last said.
- **`delaySeconds`**: wait this long before hanging up, from `0` to `10`, so a caller who's still saying goodbye isn't cut off mid-word.

Tell the agent when to use it in its instructions, for example: "When the caller says they have everything they need, say goodbye and then hang up." For calls that should end whenever the agent says a particular phrase, the number's [hang-up phrases](/docs/guide/agentic/phone-numbers.md#ai-call-behavior) do the same job without a tool.

### Example

```json title="Tool config"
{
  "toolType": "PHONE_HANG_UP",
  "reason": "Caller's question was answered",
  "goodbyeMessage": "Thanks for calling Acme. Have a great day!",
  "delaySeconds": 1
}
```

**Configuration fields**

- `reason` (string · optional) — Why the agent is ending the call, kept with the call record. Optional.
- `goodbyeMessage` (string · optional) — Said to the caller just before hanging up, after the agent's own reply, e.g. "Thanks for calling, goodbye." Optional.
- `delaySeconds` (integer · optional) — Extra seconds to wait after the last words before hanging up, 0 to 10. Optional; defaults to no wait.

## Transfer Call **TOOL** `PHONE_TRANSFER_CALL`

Hands the caller to a person. `to` is a phone number in E.164 format (for example `+14155550100`), `client:<identity>` to ring a teammate's browser phone, or the name of an entry in the tool's `directory`.

- **`mode`**: `COLD` (default) connects the caller and the agent leaves the call as soon as the person answers. `WARM` keeps the agent on the line in listen-only mode, so it can hear the handoff without speaking.
- **`announcement`**: what the agent says to the caller before transferring, such as "Let me connect you with our billing team."
- **`ringSeconds`**: how long to ring the person before giving up (default `25`).
- **`onNoAnswer`**: what happens if the person doesn't pick up. `RESUME_AI` (default) brings the agent back so it can keep helping the caller, `TAKE_VOICEMAIL` lets the caller leave a message, and `HANG_UP` ends the call.
- **`whisper`**: a short message only the person answering hears before they're connected, such as "Transfer from the AI receptionist: caller needs a refund." The caller doesn't hear it.
- **`requireKeyPress`**: the person who answers must press 1 to accept the call. Turn it on when you transfer to cell phones, so the person's own voicemail can't pick up the caller. If they don't press 1, the `onNoAnswer` step runs.
- **`clientDisplayMessage`**: shown on the teammate's screen when `to` is a browser phone, for example "Caller needs help with a refund."

The caller never sits in silence: if the person is busy, doesn't answer, or hangs up, the `onNoAnswer` step runs. The person the call was transferred to is saved in the call's `transferred_to` column.

[Add Conference Participant](#add-conference-participant-) is the older way to bring someone in. It works like a warm transfer with no fallback, so use Transfer Call for new agents.

### Transfer directory

Give the tool a `directory` and the agent can choose who to transfer to by name, without seeing or typing phone numbers. Each entry has a `name`, a `to` (a phone number or `client:<identity>`), and an optional `description` that tells the agent when to pick it. The names and descriptions are listed in the tool's description, so the agent knows its choices, and it passes the entry's `name` as `to`. Leave `to` as a placeholder such as `@@{TRANSFER_TO}` so the agent fills it in.

`allowAnyNumber` controls whether the agent can also transfer to a number that isn't in the directory. It defaults to `false` when the tool has a directory, so the agent can only reach the people you listed, and `true` when it doesn't, so `to` can be any number.

### Examples

```json title="Tool config: one fixed number"
{
  "toolType": "PHONE_TRANSFER_CALL",
  "to": "@@{BILLING_TEAM_PHONE}",
  "mode": "COLD",
  "announcement": "I'll connect you with our billing team now. One moment.",
  "ringSeconds": 25,
  "onNoAnswer": "TAKE_VOICEMAIL"
}
```

```json title="Tool config: a directory the agent picks from"
{
  "toolType": "PHONE_TRANSFER_CALL",
  "to": "@@{TRANSFER_TO}",
  "directory": [
    { "name": "Billing", "to": "+14155550100", "description": "Refunds, invoices, and payment problems." },
    { "name": "Scheduling", "to": "+14155550101", "description": "Booking, moving, or canceling appointments." },
    { "name": "Office manager", "to": "client:<identity>", "description": "Complaints, or when the caller asks for a manager." }
  ],
  "allowAnyNumber": false,
  "announcement": "Let me connect you now. One moment.",
  "whisper": "Call transferred by the Acme receptionist.",
  "requireKeyPress": true,
  "onNoAnswer": "RESUME_AI"
}
```

**Configuration fields**

- `to` (string) — Who to bring on: a phone number like +15551234567, `client:` for an Autessa browser phone, `member:` for the browser phone of a member of the company, or, when a `#directory` is set, the name of one of its entries. Several targets separated by commas ring at once; the first to answer takes the call.
- `mode` (string · optional) — `COLD` (default): the agent drops off once they pick up. `WARM`: the agent stays on, listening only. Optional.
- `announcement` (string · optional) — Said to the caller before dialling, e.g. "Let me connect you with our billing team." Optional.
- `ringSeconds` (integer · optional) — How many seconds to ring before giving up. Optional; defaults to 25.
- `onNoAnswer` (string · optional) — What happens when nobody picks up: `RESUME_AI` (default), `TAKE_VOICEMAIL` or `HANG_UP`. Optional.
- `clientDisplayMessage` (string · optional) — Shown on the browser phone being rung, when `to` is a browser phone. Optional.
- `whisper` (string · optional) — Said only to the person being brought on, before they are connected, e.g. "Transfer from the front desk: a caller asking about a refund." The caller doesn't hear it. Optional.
- `requireKeyPress` (boolean · optional) — The person must press 1 to accept the call, so their own voicemail can't pick it up and leave the caller talking to a recording. Optional; defaults to false.
- `directory` (array<object> · optional) — The people this tool can transfer to, each with a name the agent uses as `to`. When set, the agent passes a name ("Billing") and the tool dials that entry's number. Optional.
- `allowAnyNumber` (boolean · optional) — Whether `to` may be a number or browser phone that is not in the `#directory`. Optional; defaults to true without a directory and false with one, so an agent given a directory can only reach the people in it.
- `name` (string) — What the agent calls them, e.g. "Billing" or "Dr. Lee". Matched without regard to case.
- `to` (string) — Their phone number like +15551234567, `client:` for an Autessa browser phone, or `member:` for a company member's browser phone; several, comma-separated, ring at once.
- `description` (string · optional) — When to transfer to them, e.g. "Refunds and invoice questions". Optional.

## Take a Voicemail **TOOL** `PHONE_TAKE_VOICEMAIL`

Lets the caller leave a message, for example when they ask for someone who isn't available. The agent stops talking, the greeting is played, there's a beep, and the caller's message is recorded. The recording and its transcript are saved in the call's `voicemail_recording` and `voicemail_transcript` columns, and the call's status becomes `VOICEMAIL_RECEIVED`. The call ends when the caller finishes, so this is the agent's last step on the call. That's what the [Email me new voicemails](/docs/guide/agentic/phone-numbers.md#quick-automations) automation listens for.

- **`greeting`**: played before the beep. Leave it empty for a standard greeting.
- **`greetingAudio`**: a recording to play instead of `greeting`, as an `https://` link or an audio file you [uploaded for the number](/docs/api/poweruser/phone-numbers.md#get-an-audio-upload-link).
- **`maxSeconds`**: the longest message the caller can leave (default `120`).
- **`finishOnKey`**: the key the caller presses to finish the message (default `#`). Set it to `""` so no key ends the message.
- **`transcribe`**: set to `false` to keep only the audio (default `true`).
- **`notifyEmails`**: up to 5 email addresses that get the voicemail as soon as it's saved, with its transcript and a link to the call. Use it when this agent's voicemails should go to different people than the number's [Email me new voicemails](/docs/guide/agentic/phone-numbers.md#quick-automations) list.

If the number has [Call Redaction](/docs/guide/agentic/phone-numbers.md#removing-personal-info-from-recordings) turned on, the voicemail goes through it too.

### Example

```json title="Tool config"
{
  "toolType": "PHONE_TAKE_VOICEMAIL",
  "greeting": "Please leave your name, number, and a short message after the beep, and we'll call you back today.",
  "maxSeconds": 120,
  "finishOnKey": "#",
  "transcribe": true,
  "notifyEmails": ["frontdesk@example.com"]
}
```

**Configuration fields**

- `greeting` (string · optional) — What the caller hears before the tone, e.g. "Please leave your name and number." Optional.
- `greetingAudio` (string · optional) — A recording played instead of `#greeting`: an https link to an mp3 or wav file, or an `s3://` audio URI from the phone number's audio upload link. Optional.
- `maxSeconds` (integer · optional) — The longest message the caller can leave, in seconds (1 to 600). Optional; defaults to 120.
- `finishOnKey` (string · optional) — The key the caller presses to finish their message early: one of 0-9, `*` or `#`. An empty value means no key ends it. Optional; defaults to `#`.
- `transcribe` (boolean · optional) — Whether to transcribe the message into the Phone calls table. Optional; defaults to true.
- `notifyEmails` (array<string> · optional) — Email addresses (at most 5) told about each new message, with its transcript. Optional.

## Press Phone Keys **TOOL** `PHONE_PRESS_KEYS`

Presses keys on the phone keypad, the way a person would, so an agent placing a call can get through another company's phone menu ("press 2 for billing") or enter an extension. `digits` can contain `0`–`9`, `*`, and `#`. Add `w` for a half-second pause between keys, for example `1ww4421#`.

Leave `digits` as a placeholder the agent fills in when it hears the menu, or fix it for a menu that never changes.

Some phone systems miss key presses that are too short or too close together. If presses aren't recognized, slow them down:

- **`toneMs`**: how long each key is held, from `40` to `1000` milliseconds (default `160`).
- **`gapMs`**: the pause between keys, from `40` to `2000` milliseconds (default `100`).

### Example

```json title="Tool config"
{
  "toolType": "PHONE_PRESS_KEYS",
  "digits": "@@{DIGITS}",
  "toneMs": 250,
  "gapMs": 200
}
```

**Configuration fields**

- `digits` (string) — The keys to press, in order: 0-9, `*` and `#`. Use `w` for a half-second pause.
- `toneMs` (integer · optional) — How long each key's tone plays, in milliseconds (40 to 1000). Optional; defaults to 160.
- `gapMs` (integer · optional) — Silence between keys, in milliseconds (40 to 2000). Optional; defaults to 100.

## Pause or Resume Call Recording **TOOL** `PHONE_PAUSE_RECORDING`

Pauses the call recording, or resumes it. `action` is `PAUSE` or `RESUME`. Use it around anything you don't want in the recording, such as a card number read out loud: tell the agent to pause before asking for the number and resume once it's been collected. When the number isn't recording the call, the tool does nothing and says so in `message`.

Set **`autoResumeSeconds`** on a `PAUSE` to resume the recording by itself after that many seconds, from `5` to `600`. It's a safety net: if the agent forgets to resume, the rest of the call is still recorded.

Pausing only affects the recording. The agent still hears everything, and what was said stays in the agent's conversation history. To take card details without the agent hearing them, use [Secure Keypad Capture](#secure-keypad-capture-) instead. To remove personal info from recordings and transcripts automatically, use [Call Redaction](/docs/guide/agentic/phone-numbers.md#removing-personal-info-from-recordings).

### Example

```json title="Tool config"
{
  "toolType": "PHONE_PAUSE_RECORDING",
  "action": "PAUSE",
  "autoResumeSeconds": 90
}
```

**Configuration fields**

- `action` (string) — `PAUSE` or `RESUME`.
- `autoResumeSeconds` (integer · optional) — When pausing, start recording again on its own after this many seconds (5 to 600), so a forgotten RESUME never loses the rest of the call. Ignored when resuming. Optional; by default the recording stays paused until resumed.

## Get Caller Info **TOOL** `PHONE_GET_CALLER_INFO`

Tells the agent who it's talking to and whether they've called before. During a call the result adds:

| Field | What it holds |
| --- | --- |
| `phoneNumber` | The other person's number. |
| `name` | Their name from the carrier's caller-ID records, when the number has [caller-name lookup](/docs/guide/agentic/phone-numbers.md#caller-info) turned on and a name was found. |
| `city`, `state`, `country` | Where the number is registered, as reported by the carrier. |
| `forwardedFrom` | The number the call was forwarded from, if it was forwarded and the carrier reports it. |
| `direction` | `INBOUND` or `OUTBOUND`. |
| `recentCalls` | Earlier calls with this number from your [Phone calls table](/docs/guide/agentic/phone-numbers.md#the-phone-calls-table), newest first, each with `startedAt`, `direction`, `durationSeconds`, `status`, and `transcriptExcerpt` (the first 500 characters of the transcript). |

Fields the carrier didn't provide are empty. The same caller details are also available without a tool call, as [built-in variables](/docs/guide/agentic/environment-variables.md#built-in-variables) like `@@{callerName}`.

All settings are optional:

- **`fields`**: which of the fields above to return, for example `["name", "recentCalls"]`. Leave it out to get them all. Returning less keeps the agent focused and its context short.
- **`historyCount`**: how many earlier calls to include in `recentCalls`, from `0` to `20` (default `5`).
- **`includeTranscripts`**: set to `false` to leave `transcriptExcerpt` out of `recentCalls` (default `true`), for example when past calls may contain details this agent shouldn't see.
- **`lookupName`**: look up the caller's name from carrier caller-ID records right now, even if the number doesn't have [caller-name lookup](/docs/guide/agentic/phone-numbers.md#caller-info) turned on (default `false`). The carrier charges a small fee for each lookup, which is added to the call's price.

### Example

```json title="Tool config"
{
  "toolType": "PHONE_GET_CALLER_INFO",
  "fields": ["name", "city", "state", "recentCalls"],
  "historyCount": 3,
  "includeTranscripts": true,
  "lookupName": false
}
```

**Configuration fields**

- `fields` (array<string> · optional) — Which details to return, from: phoneNumber, name, city, state, country, forwardedFrom, direction, recentCalls, callerIdCheck (whether the phone company confirmed the number), voiceCheck (whether the voice sounded real). Optional; by default all of them.
- `historyCount` (integer · optional) — How many earlier calls with this person to include (0 to 20). Optional; defaults to 5.
- `includeTranscripts` (boolean · optional) — Whether each earlier call includes the start of its transcript. Optional; defaults to true.
- `lookupName` (boolean · optional) — Look up the caller's name with their phone carrier right now, when it isn't already known. Each lookup is a paid Twilio caller-name lookup. Optional; defaults to false.

## Secure Keypad Capture **TOOL** `PHONE_SECURE_COLLECT`

Takes a card number, bank account, account number, or SSN from the caller on their phone keypad, so nobody hears it and the AI never sees it. Use it for phone payments and identity checks.

While the tool runs:

1. The call recording is paused.
2. The AI stops listening. Anything the caller says meanwhile is dropped, not transcribed.
3. The caller hears a prompt for each field in turn and types it on the keypad, ending with `#`. Each entry is checked (a valid card number, a valid routing number, the right length, an expiry date that isn't in the past). An invalid entry is asked for again, up to `maxRetries` times.
4. The digits are saved for the conversation with [Protect sensitive data](/docs/guide/agentic/sensitive-data.md), the same way a value typed in chat is.
5. The caller is brought back to the agent, and recording and listening resume.

The agent gets only a placeholder, like any other [saved value](/docs/guide/agentic/sensitive-data.md#what-the-ai-sees). The digits never appear in the transcript, the recording, the conversation history, or the logs. The tool waits until the caller finishes, up to about three minutes.

**Settings:**

- **`fields`**: what to collect, in order. One kind per tool: `CARD_NUMBER`, `CARD_EXPIRY`, `CARD_CVV`, `POSTAL_CODE` for a card; `BANK_ROUTING`, `BANK_ACCOUNT` for a bank account; `ACCOUNT_NUMBER` for your own account number; or `SSN`.
- **`prompts`**: what the caller hears before each field, keyed by field name, such as `"CARD_NUMBER": "Please enter your card number, then press pound."` Fields without a prompt use a built-in one. Prompts are spoken in the number's voice and language.
- **`maxRetries`**: how many times an invalid entry is asked for again (default `2`).
- **`timeoutSeconds`**: how long to wait for the caller to start typing each field (default `10`).

The caller can press `*` at any time to cancel and go back to the agent.

**What the agent can pass:**

- **`fields`**: a subset of the configured fields, for example only `["CARD_CVV"]` when the caller already gave the rest.
- **`groupHandle`**: an existing card handle such as `PM_1`, to add the new fields to that card instead of starting a new one.

**Result:**

| `status` | Meaning |
| --- | --- |
| `COLLECTED` | Everything was entered. The result adds `handle` (such as `PM_1`) and `display` (such as `card ending 4242, exp 08/29`). |
| `CANCELLED` | The caller pressed `*`. |
| `FAILED` | An entry was still invalid after the last retry, or the capture couldn't run. |
| `TIMEOUT` | The caller didn't enter anything in time. |
| `NOT_ON_CALL` | The agent isn't on a phone call, for example in a chat. Use a [private argument with a vault field](/docs/guide/agentic/sensitive-data.md#private-arguments-that-save-to-the-vault) there. |

Tell the agent when to use it, for example: "When the caller is ready to pay, tell them they'll enter their card on the keypad and that you won't hear it, then use Secure Keypad Capture. If they cancel, offer to transfer them to the billing team." Then pass the handle to a tool with [vault access](/docs/guide/agentic/sensitive-data.md#how-tools-use-the-values) to make the payment.

### Example

```json title="Tool config"
{
  "toolType": "PHONE_SECURE_COLLECT",
  "fields": ["CARD_NUMBER", "CARD_EXPIRY", "CARD_CVV", "POSTAL_CODE"],
  "prompts": {
    "CARD_NUMBER": "Please enter your card number, then press pound.",
    "CARD_EXPIRY": "Enter the expiration date as four digits, month then year, then press pound.",
    "CARD_CVV": "Enter the security code on the back of the card, then press pound.",
    "POSTAL_CODE": "Enter your billing ZIP code, then press pound."
  },
  "maxRetries": 2,
  "timeoutSeconds": 10
}
```

```json title="Result"
{
  "status": "COLLECTED",
  "handle": "PM_1",
  "display": "card ending 4242, exp 08/29"
}
```

**Configuration fields**

- `fields` (array<string>) — What the caller may be asked for, in one group: `CARD_NUMBER, CARD_EXPIRY, CARD_CVV, POSTAL_CODE` (a card), `BANK_ROUTING, BANK_ACCOUNT` (a bank account), `ACCOUNT_NUMBER` or `SSN`. Required.
- `prompts` (object · optional) — Field name -> what the caller hears for it. Optional; each field has a default prompt.
- `maxRetries` (integer) — Re-asks of a field after a wrong entry before giving up (0 to 5, default 2).
- `timeoutSeconds` (integer) — Seconds the keypad waits for the next key (3 to 60, default 10).
- `introMessage` (string · optional) — Said once before the first field. Optional; by default "You can press star at any time to cancel."
- `invalidMessage` (string · optional) — Said before asking again after a wrong entry. Optional.
- `groupHandle` (string) — Add to this vault item instead of a new one (usually the agent's {@value #ARG_GROUP_HANDLE} argument).

## Ask for Keypad Entry **TOOL** `PHONE_KEYPAD_INPUT`

Asks the caller to type a number on their keypad (an account number, a menu choice, a date of birth) and gives the digits to the agent. It's how an agent set to keypad entry **When the agent asks** takes numbers; see [Agent listening and keypad settings](/docs/guide/agentic/phone-numbers.md#agent-listening-and-keypad-settings).

**Ask for Keypad Entry or Secure Keypad Capture?**

| Use | When |
| --- | --- |
| **Ask for Keypad Entry** | The agent needs the number itself: to look up an account, pick an option, or check a date of birth. The agent sees the digits. |
| **[Secure Keypad Capture](#secure-keypad-capture-)** | Card or bank details, or anything the agent must not see. The AI never hears or sees the digits, and the details are checked as they're typed. |

When the tool runs:

1. The agent says the prompt, such as "Please type your account number, then press pound."
2. The caller types. The entry ends when they press the finish key, type the most digits allowed, or stop typing for a few seconds.
3. The agent gets the digits back as the tool's result and carries on.

On a call where callers can type **Any time**, the caller stays on the call while they type. On any other call, the caller briefly leaves the call to type, then comes back to the agent; the recording pauses while they're away and the agent doesn't listen meanwhile.

The digits go through the agent's [Protect sensitive data](/docs/guide/agentic/sensitive-data.md) like any tool result, so a card number typed here is still replaced with a placeholder before the agent sees it. For card or bank details, use Secure Keypad Capture instead.

**Settings** (the agent can also pass each of them):

- **`prompt`**: what the agent says first. Use `@@{prompt}` to let the agent word it for each question.
- **`minDigits`**: the fewest digits that count as an entry, from `1` to `32` (default `1`).
- **`maxDigits`**: the most digits, from `1` to `32` (default `32`). The entry ends as soon as this many are typed.
- **`finishKey`**: `"#"`, `"*"`, or `"NONE"` to end only by the pause. Unset uses the agent's own keypad finish key, else `#`. Pressing `*` cancels the entry, unless `*` is the finish key.
- **`timeoutSeconds`**: how long to wait for the caller, from `3` to `60` seconds (default `10`).

**Result:**

| `status` | Meaning |
| --- | --- |
| `COLLECTED` | The caller typed an entry. The result adds `digits`, such as `"4821"`, without the finish key. |
| `CANCELLED` | The caller pressed `*`. |
| `TIMEOUT` | The caller didn't type anything in time. |
| `FAILED` | The entry was still too short after being asked for again twice, or it couldn't be taken. |
| `NOT_ON_CALL` | The agent isn't on a phone call, for example in a chat. Ask for the number in the conversation instead. |

Tell the agent when to use it, for example: "When you need the caller's account number, use Ask for Keypad Entry. If they cancel or don't type it in time, ask them to say it instead."

### Example

```json title="Tool config"
{
  "toolType": "PHONE_KEYPAD_INPUT",
  "prompt": "Please type your eight-digit account number, then press pound.",
  "minDigits": 8,
  "maxDigits": 8,
  "finishKey": "#",
  "timeoutSeconds": 15
}
```

```json title="Result"
{
  "status": "COLLECTED",
  "digits": "40821937"
}
```

**Configuration fields**

- `prompt` (string · optional) — What the caller hears first, e.g. "Enter your account number, then press pound." Optional; a default asks for the number.
- `minDigits` (integer) — Fewer digits are asked for again (1 to 32, default 1).
- `maxDigits` (integer) — The entry ends once this many digits are in (1 to 32, default 32).
- `finishKey` (string · optional) — `"#"`, `"*"` or `"NONE"` (the pause ends it). Optional; default the agent's keypad finish key, else "#". Star cancels unless it is the finish key.
- `timeoutSeconds` (integer) — Seconds to wait for the next key (3 to 60, default 10).

## Record Texting Consent **TOOL** `SMS_RECORD_CONSENT`

Records that a person agreed to get texts from your business, with its proof, on the [Who you can text](/docs/guide/agentic/sms-consent.md) page. The agreement counts right away, and the person gets the opt-in confirmation message from your [texting registration](/docs/guide/agentic/sms-setup.md) — or as soon as texting is turned on, if it isn't yet.

- **On a call:** give the tool to your AI agent and tell it to read your consent script word for word, wait for a clear yes, and then use the tool. The caller's number and the call are linked automatically, and the call's row in the Phone calls table shows **Agreed to texts**.
- **On your texting consent site:** the [sign-up page](/docs/guide/agentic/sms-setup.md#your-texting-consent-site) uses this tool to record each sign-up with the exact wording shown and the page address. It's set up for you.

Settings:

- **`consentText`**: the words the person agreed to, such as your call script. On a call, use the exact script the agent reads.
- **`sendConfirmation`**: send the confirmation text. On by default.
- **`confirmFromPhoneConfigId`**: the number the confirmation is sent from. By default, the number that was called, or your texting number.

The result is `{ "recorded": true, "confirmation": "SENT" }` (or `PENDING` until texting is on, `SKIPPED`, `FAILED`), or `{ "recorded": false, "error": "…" }` with a plain-language reason, for example a number that isn't a valid US mobile number. Anyone who replies STOP is never texted until they reply START.

### Example

```json title="Tool config"
{
  "toolType": "SMS_RECORD_CONSENT",
  "consentText": "Can we text you appointment reminders at this number? Message frequency varies, msg & data rates may apply, and you can reply STOP at any time to opt out. Is that okay?",
  "sendConfirmation": true
}
```

**Configuration fields**

- `consentText` (string · optional) — The consent wording the person agreed to: the script the agent reads, or the form's disclosure. A `consentText` argument passed at run time wins. Optional.
- `confirmFromPhoneConfigId` (string (ID) · optional) — The number that sends the confirmation text. Optional; defaults to the call's number, else the company's texting number. References a phone configuration by ID.
- `sendConfirmation` (boolean · optional) — Send the registration's opt-in confirmation text. Optional; defaults to true.
- `phone` (string · optional) — The person's mobile number. Optional on a call, where it defaults to the caller; required anywhere else.
- `pageUrl` (string · optional) — The page the person agreed on (the form's address). Optional, except from a custom app, where it's required.

## Send SMS **TOOL** `SEND_SMS`

Sends one text message from the phone number in `phoneConfigId` to `toPhoneNumber`. Only US recipients are supported; formats like `(415) 555-0100` and `+14155550100` are both accepted. `message` is at most 1600 characters — the carrier splits longer texts into segments, and the result reports how many were used. `clientDisplayMessage` is never sent to the recipient; it's echoed back in the result so the calling app can show it next to the outcome.

Every send is checked before anything goes out:

- the phone number belongs to your company and is active;
- your company has finished [Text Messaging registration](/docs/guide/agentic/sms-setup.md), or the number comes from your own connected Twilio account;
- the recipient has an approved [consent record](/docs/guide/agentic/sms-consent.md), or texted your company within the last year;
- the recipient hasn't opted out by replying STOP.

On success the result is `{"success": true, "messageId": ..., "twilioMessageSid": ..., "status": ..., "from": ..., "to": ..., "segments": ...}`. The `status` is the carrier's acceptance (`QUEUED`, `ACCEPTED`, `SENDING`, or `SENT`); delivery is tracked afterwards and shows in the number's message history.

### When a text isn't sent

A refused or failed text returns `{"success": false, "errorCode": ..., "errorMessage": ...}`. The `errorMessage` is written for people and says what to do, so an agent can pass it on as-is.

| Error code | Why |
| --- | --- |
| `SMS_NOT_REGISTERED` | Your company hasn't registered for texting yet. |
| `REGISTRATION_PENDING` | The registration is still in carrier review. |
| `REGISTRATION_ACTION_REQUIRED` | The registration was rejected and needs a fix. |
| `REGISTRATION_SUSPENDED` | Carriers suspended the registration. |
| `NUMBER_NOT_ATTACHED` | Texting isn't set up for this number yet. |
| `CONSENT_REQUIRED` | The recipient hasn't consented and hasn't texted you in the last year. |
| `OPTED_OUT` | The recipient replied STOP. They're texted again only after they reply START. |
| `INVALID_NUMBER` | The recipient isn't a valid US phone number. |
| `NUMBER_INACTIVE` | The phone number was released or is no longer active. |
| `PHONE_CONFIG_NOT_FOUND` | No phone number matches `phoneConfigId`. |
| `ACCESS_DENIED` | The phone number belongs to another company, or you don't have access to it. |
| `BYO_CREDENTIALS_INVALID`, `BYO_ACCOUNT_SUSPENDED`, `BYO_ACCOUNT_DISCONNECTED` | The number comes from your own Twilio account, and that account needs attention. |
| `INVALID_CONFIG` | `phoneConfigId`, `toPhoneNumber`, or `message` is missing. |
| `SEND_FAILED` | The carrier didn't accept the text. Try again later. |

### Send SMS example

```json title="Tool config"
{
  "toolType": "SEND_SMS",
  "phoneConfigId": "V1StGXR8Z5",
  "toPhoneNumber": "@@{TO_PHONE_NUMBER}",
  "message": "Hi @@{CUSTOMER_NAME}, your appointment with Acme is confirmed for tomorrow at 10am. Reply STOP to opt out.",
  "clientDisplayMessage": ""
}
```

## Related

- [Tool Types overview](/docs/tools.md)
- [Phone numbers guide](/docs/guide/agentic/phone-numbers.md)
- [Text Messaging setup](/docs/guide/agentic/sms-setup.md)
- [SMS consent](/docs/guide/agentic/sms-consent.md)
- [Tools guide](/docs/guide/agentic/tools.md)
- [Core tool types](/docs/tools/core.md)

