Introduction
Microsoft Teams Web client (https://teams.microsoft.com) enables you to use MS Teams features in a browser. It is built around webRTC, which supports streaming audio for voice calls and meetings. This article details the process of configuring a custom monitor to monitor the quality of MS Teams audio calls. It triggers a call to a bot hosted on Azure, which automatically accepts the call and captures performance metrics. You can then be alerted when there is performance degradation for MS Teams calls.
Integration Overview
Microsoft Graph
- Microsoft Graph permissions must be configured for the bot's Microsoft App ID.
- Permissions in the Microsoft Graph calls and online meetings API must include tenant admin consent.

Google Puppeteer:
Used to create an automated transaction flow, which will log in to Teams and initiate a call from the bot.
Chrome webRTC Internals:
chrome://webrtc-internals is an internal Chrome tab that holds statistics about ongoing WebRTC sessions.
Azure NodeJS App:
The App implements Microsoft’s Bot Builder framework for constructing bots using NodeJS v12(LTS). Also, Microsoft graphs communications API will be used for accessing call-related information.
Prerequisites
- Azure account with access to register bot services and deploy NodeJS app
- Microsoft Teams account with permission to upload custom apps.
- Microsoft Teams account with access to Developer Preview.
- Admin Consents for Microsoft graph APIs.
- Visual Studio code with Azure
- Linux RedHat/CentOS
- Nodejs installed on Enterprise node.
Installation & Configuration
Registering a bot with an Azure subscription
Follow this link for step by step instructions. on registering the bot. The App also needs Microsoft Graph permission. After the bot registration is done, please follow the below steps and add all the required graph permissions.
-
In the Azure portal, under the main menu click Azure Active Directory.
-
Go to Apps Registrations and choose the app id which was registered for creating a bot, then go to API permissions and ADD permission.
-
Select Microsoft graph and add these required Microsoft graph permissions:
- Applications permission – CallRecords, calls, and online meetings.
- Delegated permission – Presence and User. Read.
Finally, grant admin consent for all the permissions.
Once Azure finishes creating the registration resource, it will be included in the resource group list.

Install Bot
- Install Catchpoint-calling-bot using App Studio. Follow this link for instructions, and import the attached catchpoint-calling-bot.zip file instead of the "hello world" app shown in the article.
- Once the app package has been imported, go to the Bots section and update bot id (Microsoft App ID) copied when the bot was registered on Azure. Also, make sure to enable video and audio for the bot.
- Click Test and distribute under Finish.
- Click Install and then Add. This will install “Catchpoint Bot” in Teams.
Deploy the app to Azure
Next you will deploy the Node.js app to Azure using VS Code and the Azure App Service extension. Download and extract the attached zip file, edit the .env file, and update the values for MicrosoftAppId, MicrosoftAppPassword, and tenantID using the credentials you Captured when registering a bot on Azure). In the terminal, make sure you're in the msteams-voip-monitoring folder, then start Visual Studio Code with the following command:
$ code
Next, follow the instructions in this link under the Deploy to Azure section. This will help you to deploy the app to Azure.
Be sure to update the APP URL in .env file before deploying the app. For example, if the web app name is catchpoint-calling-bot, the app URL will be //catchpoint-calling-bot.azurewebsites.net Add this URL in the .env file.
Note: AppUrl depends on the unique web app name we provide.

Once the deployment is successful, copy the URL. We will be adding this URL in the next step.
Enable calling:
Once your Bot Channels registration is created and the App is deployed, you will need to enable the Teams channel. In the Azure portal, under Azure Services, select the Bot Channel Registration you just created.
- In the left panel, click Channels and then select Teams.
- Go to the calling tab and check the Enable calling option, and update the URL. This will be the NodeJS deployed APP URL with
/api/calls/appended to the path.
Example: https://catchpoint-calling-bot.azurewebsites.net/api/calls - Click Save and agree to Terms of service.
Node Setup:
- Log in to your Enterprise Node and navigate to the
sandboxdirectory:
$ cd /opt/3genlabs/hawk/syntheticnode/service/shellmonitor/sandbox - Install Puppeteer and Chromium using this command:
$ npm i puppeteer - Install dotenv.
$ npm i dotenv
Implementation
Copy the following scripts to the sandbox directory:
msteams-voip-monitoring/node/index.jsmsteams-voip-monitoring/node/parser.jsmsteams-voip-monitoring/node/.env
Run these commands to change the permission and owner of the shell script:
chmod 500 index.jschmod 500 parser.jschown serveruser index.jschown serveruser parser.js
Create the Custom Test
Configure a Custom Test in Catchpoint. The Script Filename should be the same as the file placed in the sandbox folder. This file would be the first point of execution when the run is triggered. In our example, it would be “index.js”.

Results
Based on the output that prints on the console, you can create Tracepoints and Indicators to capture the metrics and analyze them in the Portal.
Go to Settings > Insights and set up indicators as shown below.
| Insight Indicator Name | Format |
|---|---|
| Packet loss | Total\ packets\ Lost\ : (\d+.\d+)|Total\ packets\ Lost\ : (\d+) |
| Rtt (round trip time) | Average\ Round\ Trip\ Time\ : (\d+.\d+)|Average\ Round\ Trip\ Time\ : (\d+) |
| Jitter | Average\ Inbound\ Jitter\ : (\d+.\d+)|Average\ Inbound\ Jitter\ : (\d+) |
| Bytes sent | Total\ bytes_sent\ :\ (\d+) |
| Bytes Recieved | Total\ bytes_received\ :\ (\d+) |
