|
| 1 | +--- |
| 2 | +ms.date: 03/20/2024 |
| 3 | +ms.topic: how-to |
| 4 | +author: pavelprystinka |
| 5 | +ms.author: pprystinka |
| 6 | +title: TelecomManager integration in Azure Communication Services calling SDK |
| 7 | +ms.service: azure-communication-services |
| 8 | +ms.subservice: calling |
| 9 | +description: Steps on how to integrate TelecomManager with Azure Communication Services calling SDK |
| 10 | +--- |
| 11 | + |
| 12 | + # Integrate with TelecomManager |
| 13 | + |
| 14 | + This document describes how to integrate TelecomManager with your Android application. |
| 15 | + |
| 16 | + ## Prerequisites |
| 17 | + |
| 18 | + - An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 19 | + - A deployed Communication Services resource. [Create a Communication Services resource](../../quickstarts/create-communication-resource.md). |
| 20 | + - A user access token to enable the calling client. For more information, see [Create and manage access tokens](../../quickstarts/identity/access-tokens.md). |
| 21 | + - Optional: Complete the quickstart to [add voice calling to your application](../../quickstarts/voice-video-calling/getting-started-with-calling.md) |
| 22 | + |
| 23 | + ## TelecomManager integration |
| 24 | + |
| 25 | + [!INCLUDE [Public Preview Notice](../../includes/public-preview-include.md)] |
| 26 | + |
| 27 | + `TelecomManager` Integration in the Azure Communication Services Android SDK handles interaction with other VoIP and PSTN calling Apps that also integrated with `TelecomManager`. |
| 28 | + |
| 29 | + ### Configure `TelecomConnectionService` |
| 30 | + Add `TelecomConnectionService` to your App `AndroidManifest.xml` |
| 31 | + ``` |
| 32 | + <application> |
| 33 | + ... |
| 34 | + <service |
| 35 | + android:name="com.azure.android.communication.calling.TelecomConnectionService" |
| 36 | + android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE" |
| 37 | + android:exported="true"> |
| 38 | + <intent-filter> |
| 39 | + <action android:name="android.telecom.ConnectionService" /> |
| 40 | + </intent-filter> |
| 41 | + </service> |
| 42 | + </application> |
| 43 | + ``` |
| 44 | + |
| 45 | + ### Initialize call agent with TelecomManagerOptions |
| 46 | + |
| 47 | + With configured instance of `TelecomManagerOptions`, we can create the `CallAgent` with `TelecomManager` enabled. |
| 48 | + |
| 49 | + ```Java |
| 50 | + CallAgentOptions options = new CallAgentOptions(); |
| 51 | + TelecomManagerOptions telecomManagerOptions = new TelecomManagerOptions("<your app's phone account id>"); |
| 52 | + options.setTelecomManagerOptions(telecomManagerOptions); |
| 53 | + |
| 54 | + CallAgent callAgent = callClient.createCallAgent(context, credential, options).get(); |
| 55 | + Call call = callAgent.join(context, locator, joinCallOptions); |
| 56 | + ``` |
| 57 | + |
| 58 | + |
| 59 | + ### Configure audio output device |
| 60 | + |
| 61 | + When TelecomManager integration is enabled for the App, the audio output device has to be selected via telecom manager API only. |
| 62 | + |
| 63 | + ```Java |
| 64 | + call.setAudioRoute(android.telecom.CallAudioState.ROUTE_SPEAKER); |
| 65 | + ``` |
| 66 | + |
| 67 | + ### Configure call resume behavior |
| 68 | + |
| 69 | + When call is interrupted with other call, for instance incoming PSTN call, ACS call is placed `OnHold`. You can configure what happens once PSTN call is over resume call automatically, or wait for user to request call resume. |
| 70 | + |
| 71 | + |
| 72 | + ```Java |
| 73 | + telecomManagerOptions.setResumeCallAutomatically(true); |
| 74 | + ```` |
| 75 | + |
| 76 | + ## Next steps |
| 77 | + - [Learn how to manage video](./manage-video.md) |
| 78 | + - [Learn how to manage calls](./manage-calls.md) |
| 79 | + - [Learn how to record calls](./record-calls.md) |
0 commit comments