> For the complete documentation index, see [llms.txt](https://docs.aisera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aisera.com/aisera-platform/ai-automation-optimize-flow/ai-workflow-studio/building-workflows/using-workflow-actions/voice-actions.md).

# Voice Actions

Each of the following Actions is discussed in this topic:

* [Generic Voice Action](#generic-voice-action)
* [Hang Up Voice Action](#hang-up-voice-action)
* [Play Audio Voice Action](#play-audio-voice-action)
* [Transfer Call Voice Action](#transfer-call-voice-action)

***

### Generic Voice Action

**Description:** Sends a custom JSON payload to the voice server for executing voice operations such as sending DTMF tones, starting, stopping, pausing, or resuming call recording, sending metadata, changing call configuration, and combining multiple activities in a single request. The request is processed asynchronously by the voice server.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **payload (String, Optional):** A JSON string containing the request payload to send to the voice server. Must include a `conversation` field (the voice conversation ID) and an `activities` array. Each activity has a `type` (`"message"` or `"event"`); for events, a `name` field is also required. Supported event names: `abortPrompts`, `hangup`, `transfer`, `playUrl`, `sendDtmf`, `config`, `sendMetaData`, `startCallRecording`, `stopCallRecording`, `pauseCallRecording`, `resumeCallRecording`. Activities may also include `activityParams` or `sessionParams` for configuration. – example: `{"conversation": "conv-123", "activities": [{"type": "event", "name": "startCallRecording"}]}`

**Output:**

* **success (Boolean):** Indicates whether the voice server accepted the request. A `true` value means the request was accepted for asynchronous processing, not that the operation has completed.
* **response (String):** The raw response body returned by the voice server. Typically empty on success since the request is processed asynchronously.

{% hint style="info" %}
This is a low-level action that allows combining multiple voice activities in a single request. For common operations like hanging up, transferring, or playing audio, consider using the dedicated actions instead.
{% endhint %}

***

### Hang Up Voice Action

**Description:** Terminates an active voice call by sending a hang-up event to the voice server. Optionally plays a farewell message to the caller before disconnecting. Any audio currently being played to the caller is stopped before the message is played and the call is ended. The request is processed asynchronously by the voice server.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **voiceConversationId (String, Optional):** The conversation ID assigned by the voice provider that uniquely identifies the active call to hang up.
* **message (String, Optional):** A text message to be synthesized and played to the caller before the call is terminated. If empty or not provided, the call is hung up immediately without a message.

**Output:**

* **success (Boolean):** Indicates whether the voice server accepted the hang-up request. A `true` value means the request was accepted for asynchronous processing, not that the call has been terminated.
* **response (String):** The raw response body returned by the voice server. Typically empty on success since the request is processed asynchronously.

{% hint style="info" %}
Any audio currently playing on the call is automatically stopped before the farewell message (if provided) is played and the call is ended.
{% endhint %}

***

### Play Audio Voice Action

**Description:** Plays a pre-recorded audio file to the caller during an active voice call. Optionally plays a text-to-speech message before the audio file starts. Any audio currently being played to the caller is stopped before playback begins. The request is processed asynchronously by the voice server.

**Configuration Parameters:**

* **bargeIn (Boolean, Optional, Default: true):** When `true`, the caller can interrupt the audio playback by speaking. Set to `false` to force the caller to listen to the full audio before the bot resumes listening.

**Input:**

* **voiceConversationId (String, Optional):** The conversation ID assigned by the voice provider that uniquely identifies the active call on which to play the audio.
* **message (String, Optional):** A text message to be synthesized and played to the caller before the audio file starts. If empty or not provided, only the audio file is played.
* **audioFile (String, Optional):** The name or path of the audio file stored in the tenant's audio storage to be played to the caller.

**Output:**

* **success (Boolean):** Indicates whether the voice server accepted the play audio request. A `true` value means the request was accepted for asynchronous processing, not that the audio has finished playing.
* **response (String):** The raw response body returned by the voice server. Typically empty on success since the request is processed asynchronously.

{% hint style="info" %}
Any audio currently playing on the call is automatically stopped before the new playback begins.
{% endhint %}

***

### Transfer Call Voice Action

**Description:** Transfers an active voice call to a specified phone number. Optionally plays a text-to-speech message to the caller before initiating the transfer. Custom SIP headers can be included in the transfer request for routing or metadata purposes. Any audio currently being played to the caller is stopped before the message is played and the transfer is initiated. The request is processed asynchronously by the voice server.

**Configuration Parameters:** This action has no configuration parameters.

**Input:**

* **voiceConversationId (String, Optional):** The conversation ID assigned by the voice provider that uniquely identifies the active call to be transferred.
* **message (String, Optional):** A text message to be synthesized and played to the caller before the call is transferred. If empty or not provided, the transfer proceeds immediately without a message.
* **phoneNumber (String, Optional):** The destination phone number to transfer the call to, in E.164 format. – example: `+14155551234`
* **sipHeaders (Map\<String, String>, Optional):** A map of custom SIP headers to include in the transfer request. Each entry is sent as a name/value pair. – example: `{"X-Custom-Header": "value1", "X-Routing-Info": "value2"}`

**Output:**

* **success (Boolean):** Indicates whether the voice server accepted the transfer request. A `true` value means the request was accepted for asynchronous processing, not that the call has been transferred.
* **response (String):** The raw response body returned by the voice server. Typically empty on success since the request is processed asynchronously.

{% hint style="info" %}
Any audio currently playing on the call is automatically stopped before the farewell message (if provided) is played and the transfer is initiated. SIP headers are optional and are typically used for custom routing logic or passing metadata to the receiving system.
{% endhint %}
