Integrate with TelecomManager

This document describes how to integrate TelecomManager with your Android application.

Prerequisites

TelecomManager integration

Important

This feature of Azure Communication Services is currently in preview.

Preview APIs and SDKs are provided without a service-level agreement. We recommend that you don't use them for production workloads. Some features might not be supported, or they might have constrained capabilities.

For more information, review Supplemental Terms of Use for Microsoft Azure Previews.

TelecomManager Integration in the Azure Communication Services Android SDK handles interaction with other VoIP and PSTN calling Apps that also integrated with TelecomManager.

Configure TelecomConnectionService

Add TelecomConnectionService to your App AndroidManifest.xml

<application>
  ...
  <service
      android:name="com.azure.android.communication.calling.TelecomConnectionService"
      android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"
      android:exported="true">
      <intent-filter>
          <action android:name="android.telecom.ConnectionService" />
      </intent-filter>
  </service>
</application>

Initialize call agent with TelecomManagerOptions

With configured instance of TelecomManagerOptions, we can create the CallAgent with TelecomManager enabled.

CallAgentOptions options = new CallAgentOptions();
TelecomManagerOptions telecomManagerOptions = new TelecomManagerOptions("<your app's phone account id>");
options.setTelecomManagerOptions(telecomManagerOptions);

CallAgent callAgent = callClient.createCallAgent(context, credential, options).get();
Call call = callAgent.join(context, locator, joinCallOptions);

Configure audio output device

When TelecomManager integration is enabled for the App, the audio output device has to be selected via telecom manager API only.

call.setTelecomManagerAudioRoute(android.telecom.CallAudioState.ROUTE_SPEAKER);

Configure call resume behavior

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.

telecomManagerOptions.setResumeCallAutomatically(true);

Next steps