---
schema_version: "1"
id: e01bb7fc9d2ca365c4d5431ab498b9bb976b38990ed73e641394d078fd799a24
title: Set Up Agentforce Voice for iOS
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/genai/agentforce-mobile-sdk/guides/ios/agentforce-mobile-sdk-ios-voice.md
canonical_url: https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-ios-voice.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 4af647f264fdca0308fdea1967e759e4eac97979f65dacbbedfbb70311e2c73e
products:
  - Agentforce Mobile SDK
  - Agentforce and Einstein Generative AI
---
# Set Up Agentforce Voice for iOS

Agentforce Voice lets you build voice-enabled agents that manage complex conversations in real time. Set up Agentforce Voice for your iOS mobile app with these steps.

## Before You Begin

Before you set up Agentforce Voice for your mobile app, create and configure a voice-enabled service agent in Agentforce Studio.

- [Create a Voice-Enabled Service Agent in Agentforce Studio](https://help.salesforce.com/s/articleView?id=ai.service_agent_voice.htm&type=5)

Voice settings are configured at the agent level and apply across all supported connections.

## Choose a Connection Path

The Agentforce Mobile SDK supports two connection paths for voice. Choose based on your requirements. Both paths require `enableVoice: true` in your SDK feature flags, configured in the next section.

|                        | Agent API (Telephony)                           | Enhanced Chat v2 (Service Cloud)                           |
| ---------------------- | ----------------------------------------------- | ---------------------------------------------------------- |
| **Setup**              | Add a Telephony connection in Agentforce Studio | Create an Embedded Service Deployment with an ECv2 channel |
| **Human escalation**   | Not supported                                   | Supported — agent can hand off to a live agent             |
| **Transcript logging** | Not available                                   | Available through Service Cloud                            |
| **Routing**            | Direct to agent                                 | Omni-Channel routing with queue fallback                   |
| **Voice mode UI**      | Always available when voice is enabled          | Appears after the agent joins the session                  |

### Agent API (Telephony Connection)

Use this path for a lightweight integration that gets voice running with minimal server-side configuration. In Agentforce Studio, add a Telephony connection to your service agent to unlock voice settings. This "Agent API" refers to the mobile SDK's internal connection to the agent — it's not the same as the [Agentforce Agent API](/docs/ai/agentforce/guide/agent-api-get-started.html) used for headless server-to-server integrations. This path doesn't require a full Service Cloud Voice telephony setup. It just activates the agent-level voice configuration for use with the mobile SDK.

1. In Agentforce Studio, open your service agent.
2. Go to **Connections** and click **Add**.
3. Select **Telephone** and save.
4. Configure voice settings (voice persona, language) in the agent's voice settings panel.

### Enhanced Chat v2 (Service Cloud Connection)

This path enables richer capabilities including human escalation and transcript logging. It requires an Embedded Service Deployment with an ECv2 channel that has voice enabled.

1. In Agentforce Studio, open your service agent.
2. Go to **Connections** and click **Add**.
3. Select **Enhanced Chat V2**, then save and activate.
4. Go to the ECv2 connection's **Routing** section and create a new channel.
5. In the channel settings, select **Allow Voice in Enhanced Chat** and publish.
6. Create a Mobile Embedded Service Deployment using that channel.

For the ECv2 path, use the Service API URL and ES Developer Name from your Embedded Service Deployment when configuring the SDK. See [Before You Begin](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/agentforce-mobile-sdk-before-you-begin.md#configure-for-service-agent) for where to find these values.

For more information, see [Connect a Service Agent to Enhanced Chat v2](https://help.salesforce.com/s/articleView?id=release-notes.rn_einstein_agentforce_ecv2_voice.htm&release=262&type=5).

After configuring your connection path, install the voice module and set up the client below. The SDK configuration is the same regardless of which path you chose.

## Install the AgentforceVoice Pod

Starting with SDK version 260.4, Agentforce Voice is a separate optional module. To use Agentforce Voice, add the LiveKit spec source and the `AgentforceVoice` pod to your project's Podfile.

```ruby
source 'https://github.com/livekit/podspecs.git'

pod 'AgentforceSDK'
pod 'AgentforceVoice', '~> 1.1'
```

Then run `pod install` from your project's root directory. For full Podfile setup instructions including other required sources, see [Install the iOS SDK](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-ios-install.md).

If you don't use Agentforce Voice, no changes are needed — voice is no longer bundled with the core SDK by default.

### LiveKit Module Naming Workaround

If you encounter a "Voice module not available" error after installing `AgentforceVoice`, it may be caused by a naming mismatch between the `LiveKitClient` pod and the module name expected by the voice framework. Add the following `pre_install` hook to your Podfile to resolve it:

```ruby
pre_install do |installer|
  installer.pod_targets.each do |target|
    if target.pod_name == 'LiveKitClient'
      target.specs.each do |spec|
        spec.attributes_hash['module_name'] = 'LiveKit'
      end
    end
  end
end
```

Then run `pod install` again and rebuild.

## Create the AgentforceClient

To set up Agentforce Voice for iOS, start by enabling the voice feature flag within your configuration object. Then, pass the feature flags into your AgentforceConfiguration object.

```swift
let featureFlags = AgentforceFeatureFlagSettings(
    enableVoice: true
)

let agentforceConfiguration = AgentforceConfiguration(
    user: guestUser, // Or your authenticated user object
    ignoreWelcomeMessage: true,
    forceConfigEndpoint: forceConfigEndpoint,
    agentforceFeatureFlagSettings: featureFlags, // Pass flags here
    agentforceConnectionInfo: agentforceConnectionInfo,
    salesforceNetwork: nil, // Optional
    salesforceNavigation: myNavigation,
    salesforceLogger: myLogger,
    themeManager: AgentforceDefaultThemeManager()
)
```

To initialize the AgentforceClient, use the configuration object you created.

```swift
let client = AgentforceClient(
    credentialProvider: credentialProvider,
    mode: .fullConfig(agentforceConfiguration)
)
```

Then, implement the `AgentforceUIDelegate` protocol. The `userInitiatedVoice` method is called when Voice View is opened from Chat View.

```swift
extension MyView: AgentforceUIDelegate {
    func userInitiatedVoice(
        for conversation: any AgentConversation
    ) {
        // custom code that calls createAgentforceVoiceView to
        // create the view and present it
    }
}
```

## Create a Chat View

To create a chat view, use the `createAgentforceChatView` method. While the voice feature flag is enabled, creating a chat view makes the voice option available to users.

```swift
func createMyAgentforceChatView(
    delegate: AgentforceUIDelegate,
    onContainerClose: @escaping () -> Void
) -> AgentforceChatView? {
    guard let agentforceClient = agentforceClient,
          let agentforceConversation = agentforceConversation else {
        return nil
    }

    return try? agentforceClient.createAgentforceChatView(
        conversation: agentforceConversation,
        delegate: delegate,
        onContainerClose: onContainerClose
    )
}
```

## Create a Voice View

To create the voice view, use the `createAgentforceVoiceView` method.

```swift
func createMyAgentforceVoiceView(
   onContainerClose: @escaping () -> Void
) -> AgentforceVoiceView? {
   guard let agentforceClient = agentforceClient,
          let agentforceConversation = agentforceConversation else {
        return nil
    }
    return try? agentforceClient?.createAgentforceVoiceView(
        conversation: agentforceConversation,
        circleSizeRatio: 0.4,
        onContainerClose: onContainerClose
    )
}
```

## Closed Captions and Agent Responses

In voice mode, the agent responds audibly, and the written response is intentionally hidden when closed captions are off. Turning closed captions on displays the live transcript of the agent's response. Closed captions default to off, so users tap the closed-caption control to turn them on.

**note:** If the agent's written response appears to be missing during a voice conversation, that's expected behavior when closed captions are off—it's not a bug. The response is still delivered audibly, and enabling closed captions shows the transcript. Agent responses always remain visible in the standard chat interface.
