> ## Documentation Index
> Fetch the complete documentation index at: https://docs.goguava.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# set_voicemail_action()

> Tell the agent what to do if it reaches an answering machine

<Tabs>
  <Tab title="Python">
    `set_voicemail_action()` tells the agent what to do if it reaches an answering machine.

    <Warning>
      `set_voicemail_action()` and [`reach_person()`](/sdk-reference/reach-person) both handle voicemail and **cannot be used together**. If you are using `reach_person()`, set voicemail behavior there via its `voicemail_message` or `voicemail_hangup` parameters instead. Using both raises an error.
    </Warning>

    ```python signature theme={null}
    call.set_voicemail_action(
        hangup: bool = False,
        message: str | None = None,
    )
    ```
  </Tab>

  <Tab title="TypeScript">
    `setVoicemailAction()` tells the agent what to do if it reaches an answering machine.

    <Warning>
      `setVoicemailAction()` and [`reachPerson()`](/sdk-reference/reach-person) both handle voicemail and **cannot be used together**. If you are using `reachPerson()`, set voicemail behavior there via its `voicemailMessage` or `voicemailHangup` options instead. Using both throws an error.
    </Warning>

    ```typescript signature theme={null}
    await call.setVoicemailAction(
      action: { hangup: true } | { message: string },
    ): Promise<void>
    ```
  </Tab>
</Tabs>

## Example

<Tabs>
  <Tab title="Python">
    ```python example.py theme={null}
    @agent.on_call_start
    def on_call_start(call: guava.Call):
        call.set_voicemail_action(
            message="Hi, this is Alex from Bright Smile Dental. Please call us back at 555-0100 to confirm your appointment.",
        )
    ```

    <Tip>
      You must specify exactly one of `hangup` or `message` — passing both or neither raises an error.
    </Tip>
  </Tab>

  <Tab title="TypeScript">
    ```typescript example.ts theme={null}
    agent.onCallStart(async (call: guava.Call) => {
      await call.setVoicemailAction({
        message: "Hi, this is Alex from Bright Smile Dental. Please call us back at 555-0100 to confirm your appointment.",
      });
    });
    ```

    <Tip>
      Pass exactly one of `hangup` or `message` — the parameter type accepts `{ hangup: true }` or `{ message: string }`, not both.
    </Tip>
  </Tab>
</Tabs>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.