Azure Android Calling SDK: Creation of first CallAgent takes more than 1 minute on some devices

Oleksandr Hulak 0 Reputation points
2025-01-21T15:11:06.1766667+00:00

On some of our Augmented Reality Android devices, it takes more than 1 minute to create the first TeamsCallAgent for a Teams user, which is a critical P1 bug for our app development. Following CallAgents are created within a second.

Devices the bug was reproduced on: https://www.realwear.com/devices/navigator-500, https://www.realwear.com/devices/navigator-520

Repro rate: 2/5

Operating system: Android 13

SDK version com.azure.android:azure-communication-calling: 2.8.0 to 2.13.0-beta1

Tenant ID: 3fb8c4c4-8d65-442d-8093-6d8790fc6b85

Application ID: 324a832d-0b94-40c3-a14f-f031124bc689

User ID: 0fd9f5cd-a64b-4f2d-9c2a-44b3d4b76d2b

Immutable ACS resource ID: 7227b130-f2ec-4707-90c3-dd3a9f40cbfb

Steps to reproduce:

  1. Take code from the Azure Calling sample repo https://github.com/Azure-Samples/communication-services-android-quickstarts/tree/main/Add%20Voice%20Calling
  2. Follow the README to set it up for Teams accounts - in gradle.properties set isCTE=true, and in MainCTEActivity initialize UserToken for your Microsoft Teams 365 account.
  3. Launch the sample app.
  4. If it worked fine - reboot the device, launch the app again with the same token.

Expected results:

The new CallClient().createTeamsCallAgent(..).get() call should complete in a matter of a couple of seconds, a few seconds tops.

Actual results:

The first new CallClient().createTeamsCallAgent(..).get() gets completed in about 70 seconds (ranging from 35 to 90 seconds). We tried with other devices of the same model, same OS, same environment, and internet connection - the bug is reproducible on some of them, and isn't on the others. See more details below. After the first CallAgent is initialized, everything works fine - incoming & outgoing calls, disposing and creating new call agents.

Technical notes:

To collect the attached app process logs Azure CallClient 1 min init app log.txt, we modified the sample's createAgent() function:

private void createAgent() {

        Log.d("TESTING", "Creating a call agent");

        try {

            CallClient client = new CallClient();

            CommunicationTokenCredential credential = new CommunicationTokenCredential(UserToken);

            teamsAgent = client.createTeamsCallAgent(getApplicationContext(), credential).get();

            Log.d("TESTING", "Created 1st call agent");

            teamsAgent.dispose();

            Log.d("TESTING", "Disposed 1st call agent");

            teamsAgent = client.createTeamsCallAgent(getApplicationContext(), credential).get();

            Log.d("TESTING", "Created 2nd call agent");

            client.getDebugInfo().getSupportFiles();

        } catch (Exception ex) {

            Log.e("TESTING", "Failed to create call agent", ex);

            Toast.makeText(getApplicationContext(), "Failed to create call agent.", Toast.LENGTH_SHORT).show();

        }

    }


Things tried:

  • updating the calling library to the latest Beta
  • reverting back the code to what we had in November & December 2024, when the same code worked well on the same devices (e.g. Navigator-520 with MAC 04:EE:E8:50:86:F9)
  • looking into Android system logs
  • using a different Azure account in another tenant
  • both debug and release builds, from Android studio and just installing APK
  • reinstalling the app, rebooting the device
  • factory reset the device, fresh install the app
  • ensuring we call any possible “dispose()” methods before creating an Azure calling agent and client
  • some delays to prevent any race conditions
  • tracking communication token requests - from my additional logging, no token refresh is made, only the initial communication token is used
  • if we put into a loop 20 retries to create a TeamsCallAgent, with a 5-second timeout each, then the first ±15 attempts fail, and then on 16th it’s successful. If we wait for 90 seconds (do new Handler().postDelayed(this::createAgent, 90_000) in MainCTEActivity::onCreate), and then create CallAgent - the bug is still reproducible with a bit lower delay (± 50 seconds). It happens only for the 1st agent per a process.

See the Azure support log file attached acs_sdk-0-s1245496781_blog.log.

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
982 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.