# Integrate the Telephony SDK

## Prerequisites

1. [Complete the Getting Started Guide](https://docs.sudoplatform.com/guides/getting-started)
2. [Integrate the User SDK](https://docs.sudoplatform.com/guides/users/integrate-the-user-sdk)
3. [Integrate the Sudo SDK](https://docs.sudoplatform.com/guides/sudos/integrate-the-sudo-sdk)

## Get Started

* [Integrate the iOS SDK](#integrate-the-ios-sdk)
* [Integrate the Android SDK](#integrate-the-android-sdk)
* Integrate the Web SDK (Coming soon!)

## Integrate the iOS SDK

Add this line to your [Podfile](https://docs.sudoplatform.com/getting-started#ios-only-setup-cocoapods-in-a-project) near the line `pod 'SudoUser'`

```
pod 'SudoTelephony'
```

Install pod dependencies by running the following command in your project directory:

```
pod install --repo-update
```

This will update the local CocoaPods repository and install the latest version of the Telephony SDK.

{% hint style="info" %}
In order to instantiate a Telephony client, make sure you have followed instructions for [Getting Started](https://docs.sudoplatform.com/guides/getting-started), [User SDK](https://docs.sudoplatform.com/guides/users/integrate-the-user-sdk) and [Sudo SDK](https://docs.sudoplatform.com/guides/sudos/integrate-the-sudo-sdk) (see [Prerequisites](#prerequisites) above)
{% endhint %}

To instantiate a client in your application, add the following

{% tabs %}
{% tab title="Swift" %}

```swift
import SudoTelephony

let userClient = // ... see "Users" docs
let profilesClient = // ... see "Sudos" docs
let callingProviderConfig = // .. Optional. see "Voice Call" docs
let telephonyClient = try! DefaultSudoTelephonyClient(
    sudoUserClient: userClient, 
    sudoProfilesClient: profilesClient,
    callProviderConfiguration: callingProviderConfig
)
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
If you are integrating [voice calling](https://docs.sudoplatform.com/guides/telephony/calling) into your application, you must pass in a CallProviderConfiguration. Failure to do so will result in errors being returned when attempting to make a voice call.
{% endhint %}

{% hint style="warning" %}
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.
{% endhint %}

{% hint style="success" %}
**See it in action.** Be sure to take a look at the [open source iOS sample app](https://github.com/sudoplatform/samples-ios) on GitHub that our team published as a reference for integrating the Telephony SDK into your app as quickly and seamlessly as possible.
{% endhint %}

## Integrate the Android SDK

Add this line to the dependencies section of the app module `build.gradle` and run gradle sync

```
dependencies {
    api 'com.sudoplatform:sudotelephony:$latest_version'
}
```

{% hint style="info" %}
The latest version of the SDK can be found at [SDK Releases](https://docs.sudoplatform.com/guides/telephony/sdk-releases).
{% endhint %}

{% hint style="info" %}
In order to instantiate a Telephony client, make sure you have followed instructions for [Getting Started](https://docs.sudoplatform.com/guides/getting-started), [User SDK](https://docs.sudoplatform.com/guides/users/integrate-the-user-sdk) and [Sudo SDK](https://docs.sudoplatform.com/guides/sudos/integrate-the-sudo-sdk) (see [Prerequisites](#prerequisites) above).
{% endhint %}

To instantiate a client in your application, add the following

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
val userClient = // ... see "Users" docs
val profilesClient = // ... see "Sudos" docs

val telephonyClient = DefaultSudoTelephonyClient(
    appContext, 
    userClient, 
    profilesClient
)
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.
{% endhint %}

{% hint style="success" %}
**See it in action.** Be sure to take a look at the [open source Android sample app](https://github.com/sudoplatform/samples-android/tree/master/telephony) on GitHub that our team published as a reference for integrating the Telephony SDK into your app as quickly and seamlessly as possible.
{% endhint %}
