Microsoft Teams VoIP Monitoring

Prev Next

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

  1. Microsoft Graph permissions must be configured for the bot's Microsoft App ID.
  2. Permissions in the Microsoft Graph calls and online meetings API must include tenant admin consent.
    **Fig 1. Architecture diagram**

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.

  1. In the Azure portal, under the main menu click Azure Active Directory.

  2. Go to Apps Registrations and choose the app id which was registered for creating a bot, then go to API permissions and ADD permission.

  3. 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.
Fig 2. Required API permissions.
Fig 2. Required API permissions.

Once Azure finishes creating the registration resource, it will be included in the resource group list.
**Fig 3. Bot channels under resource group lists.      **

Install Bot

  1. 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.
  2. 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.
  3. Click Test and distribute under Finish.
  4. 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.

**                          Fig 3. Bot channels under resource group lists.**

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.

  1. In the left panel, click Channels and then select Teams.
  2. 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
  3. Click Save and agree to Terms of service.

Node Setup:

  1. Log in to your Enterprise Node and navigate to the sandbox directory:
    $ cd /opt/3genlabs/hawk/syntheticnode/service/shellmonitor/sandbox
  2. Install Puppeteer and Chromium using this command:
    $ npm i puppeteer
  3. Install dotenv.
    $ npm i dotenv

Implementation

Copy the following scripts to the sandbox directory:

  • msteams-voip-monitoring/node/index.js
  • msteams-voip-monitoring/node/parser.js
  • msteams-voip-monitoring/node/.env

Run these commands to change the permission and owner of the shell script:

  • chmod 500 index.js
  • chmod 500 parser.js
  • chown serveruser index.js
  • chown 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+)

**Fig 5. Catchpoint dashboard for Microsoft Teams VoIP Monitoring.**

msteams-voip-monitoring.zip