Skip to content

Teams Recording Rules

Overview

After a successful integration between MiaRec and Microsoft Teams, a recording policy is created in the Microsoft Teams Environment. When any user with the recording policy attached starts a call, the Teams Environment notifies the MiaRec TeamsBot with the potential call, TeamsBot then sends an SIPREC INVITE to the MiaRec Recorder with information about the call, the MiaRec Recorder can then choose to record or reject the call based on its configuration.

Call recording in the MiaRec-Teams environment depends on two settings:

  • Teams Recording Policy Assignment
  • MiaRec Recorder Recording Rules

Teams Recording Policy Assignment

During the Teams integration setup, a Recording Policy is provisioned. The administrator can decide how to apply the policy.

Recording Policy can be attached in the following:

  • Globally Policy is attached to all users within the organization
  • Group Policy is attached to a specified group, all members of the group will inherit the policy
  • User Policy can be attached directly to individual users

When a user with an assigned recording policy joins a call, all call scenarios are recorded unconditionally. For more granular control over recording (such as by call type or direction), MiaRec Recording Rules must be used, as described below.

This document covers only the behavior and configuration of the MiaRec Recording Rules. For details on Teams Recording Policy assignment, see Connect to Micrsoft Teams > Add Users to Recording Group.

MiaRec Recorder Recording Rules

When MiaRec TeamsBot receives an inbound call notification from Microsoft Teams Environment, TeamsBot sends a SIPREC INVITE to the MiaRec Recorder, which can accept or reject the call based on the recording rules configured.

MiaRec evaluates recording rules in a hierarchical order based on how the call is assigned:

  • Default Recording Rule - Defined globally and applied to all calls that are not associated with a tenant or user.
  • Tenant Default Recording Rule - Defined per tenant and applied to calls associated with that tenant that are not assigned to a user.
  • User Recording Rule - Defined per user and applied to calls associated with that user.
  • Custom Recording Rules - Evaluated before the standard rules (Default, Tenant, User). These rules allow you to define exceptions to the default behavior.

This evaluation ensures that the most specific applicable rule determines whether the call is recorded.

Processing Flow

The recording decision workflow is executed as follows:

  1. Teams User Makes or Receives a Call

    • If a recording policy is attached to the user (direct, group or global), a call notification is streamed to the MiaRec TeamsBot, and a SIPREC INVITE is sent to the MiaRec Recorder.
    • If no recording policy is attached, the call is not recorded.
  2. SIPREC INVITE Handling Upon receiving a SIPREC INVITE, MiaRec Recorder extracts tenant and user information from the SIPREC XML metadata.

  3. Custom Rules (Pre-Processing) The application evaluates the rules configured under Custom Rules [before].

    • If a matching rule is found, its associated action (Record or Do not record) is applied.
    • If no rules match, processing continues to the next step.
  4. User-Level Rules The application evaluates per user rules shown in Auto Rules.

    • If a match is found, the corresponding action is applied.
    • Otherwise, processing continues.
  5. Tenant-Level Rules The application evaluates per tenant rules shown in Auto Rules.

    • If a match is found, the corresponding action is applied.
    • Otherwise, processing continues.
  6. Custom Rules (Post-Processing) The application evaluates the rules configured under Custom Rules [after], if any, (rare).

    • If a match is found, the corresponding action is applied.
    • Otherwise, processing continues.
  7. Default System-level Rule If no rules match in any of the previous steps, the Default Recording Rule is applied.

Call Rejection Behavior

If a Do not record action is triggered at any point in the workflow:

  • The MiaRec Recorder responds to the SIPREC INVITE with a 403 Forbidden response.
  • The MiaRec TeamsBot does not proceed with recording the call.

Early Check of Recording Filters

To support early rule evaluation, enable the Early check of recording filters setting under System > Recording Interfaces > SIPREC in the MiaRec platform.

Detailed explanation:

By default, the MiaRec recorder postpones recording rule evaluation until RTP is received from the remote endpoint. In this configuration, recording is initially started for all calls, and at a later stage, the recorder may discard the received audio if the rules indicate that the call should not be recorded.

Because of this delayed evaluation, participants may receive a recording announcement even when the call is ultimately not recorded. To prevent such false announcements, the Early check of recording filters setting must be enabled.

Associating calls to a Tenant or a User

Recording Rules are dependent on calls being assigned to the correct User/Tenant. This section describes how MiaRec Recording associates calls.

On each SIPREC INVITE received by the MiaRec Recorder, in the XML Metadata, information about each participant is provided. This includes unique <userID> and <tenantID> tags. These tags are used to associate the recordings to the User and/or Tenant.

Example XML payload

--miarec-boundary
Content-Disposition: recording-session
Content-Type: application/rs-metadata

<?xml version="1.0" encoding="UTF-8"?>
<recording xmlns="urn:ietf:params:xml:ns:recording">
  <datamode>complete</datamode>
  <session>
    <associate-time>2026-04-01T22:02:02.868Z</associate-time>
  </session>
...
  </participant>
  <extensiondata>
    <teamsRecordingMetadata xmlns="http://miarec.com/teams">
      <callID>10006980-666c-46cb-a74b-6ba0698af209</callID>
      <callDirection>Outbound</callDirection>
      <callType>pstn</callType>
      <userID>UNIQUE-USER-ID</userID>              <<<<<<< Unique to each participant >>>>>>>
      <userName>User's Name</userName>
      <tenantID>UNIQUE-TENANT-ID</tenantID>        <<<<<<< Unique to each Teams Tenant >>>>>>>
      <dialedDigits>+18005551234</dialedDigits>
    </teamsRecordingMetadata>
  </extensiondata>
</recording>
--miarec-boundary--

User Association

User association requires the <userID> and <tenantID> tags from the XML payload to be matched to User's extension configuration, defined on the User's Profile. When matched, the calls will be associated to the User.

For Teams deployment, the User's Extension is defined as <UNIQUE-USER-ID>@<UNIQUE-TENANT-ID>

user-associate

Tenant Association

Tenant association requires the <tenantID> tag from the XML payload to be matched to tenant configuration defined on the tenant profile, ASSOCIATE CALLS WITH TENANT section. When matched, the call is associated to the tenant.

Match condition: Teams-tenantID = "<UNIQUE-TENANT-ID>"

tenant-associate


Configuration

Procedure overview

  1. Enable Early Check of Recording Filters
  2. Configure Default Recording Rule
  3. Configure Tenant Recording Rules
  4. Configure User Recording Rules
  5. Configure Custom Recording Rules (Optional)

1. Enable Early Check of Recording Filters

To ensure proper operation of the recording decision workflow, Early Check of Recording Filters must be enabled.

Standard - Teams Only Recording

Applies to all MiaRec Recorder(s) in your deployment

Navigate to Administration > System > Recording Interfaces > SIPREC

Under Recording Filters Behavior, enable Early check of recording filters

recording-rule-enable-early-check

Multi-platform setups

(e.g., BroadWorks and Microsoft Teams): Configuration needs to be applied on a per recorder basis, applied to Teams-only recorders

Navigate to Administration > Maintenance > Recording Servers

Create an override setting with the following:

  • Recorder name = <YOUR-TEAMS-RECORDER-NAME>
  • Category = Protocol::SIPREC
  • Key = EarlyCheckRecordingFilters
  • Value = true

recording-rule-enable-early-check-override

2. Configure Default Recording Rule

Default Recording Rule is applied globally and applies to any call that is not associated to a Tenant or a User.

Navigate to Administration > System > Recording Rules

On the Settings tab, select Edit Configuration

Choose one of the following for Default recording rule

  • Always - Calls will always be recorded
  • On-demand - User will have the ability to turn recording on or off, if no action is selected during the call, the recording will be discarded
  • On-demand (default:keep) - User will have the ability to turn recording on or off, if no action is selected during the call, the recording will be kept
  • Do not record - Calls will never be recorded

recording-rule-default-rule

Result: Any Recording not matching a more specific (Tenant, User or Custom) rule, will be assigned this recording action.

3. Configure Tenant Recording Rules

Automatic Tenant Recording Rules are configured for each tenant profile, and apply to any call that is associated to the tenant but is NOT associated to a user.

Navigate to the tenant profile page, Administration > User Management > Tenants and select the Tenant profile

Under ASSOCIATE CALLS WITH TENANT SETTINGS section, select one of the following for Record unknown users

  • Record Calls associated to this tenant that are not associated to a specific user, will be recorded.
  • Do not record Calls associated to this tenant that are not associated to a specific user, will NOT be recorded.

recording-rule-tenant-default-rule

Result The auto recording rule for the tenant will be updated with the specified action

recording-rule-tenant-auto-rule

4. Configure User Recording Rules

Automatic User Recording Rules are configured for each user profile, and apply to any call that is associated to the user.

Navigate to the user profile page, Administration > User Management > Users and select the User profile

Under RECORDING SETTINGS section, select one of the following actions for Record

  • Always - Calls associated to this user will always be recorded
  • On-demand - Calls associated to this user will be recorded only when the user chooses to record the call
  • Never - Calls associated to this user will never be recorded
  • Default - Calls associated to this user will follow the Default Recording Rule

recording-rule-user

Result The auto recording rule will be updated with the specified action.

recording-rule-user-auto-rule

5. Configure Custom Recording Rules (Optional)

Operators may choose to create more granular recording rules for tenants or users. Rules can be created to ignore certain call types or directions. This can be accomplished by creating a Custom recording rule.

Custom Rules work best when they are processed before Auto Rules and when the action is Do not record. When a custom rule is used, it is assumed that there is an auto rule to record the user/tenant. Therefore Custom rules should be structured so that they preempt the auto record rule with an exception, tenant will always record calls unless scenario "X", like Tenant will record all calls UNLESS the call is outbound.

Why is this important?

If a custom rule is configured with the Record action, it may consume an additional recording license when triggered. Since the user is already allocated a recording license through the default configuration, this can lead to license oversubscription.

Configuration

Navigate to Administration > System > Recording Rules

On the Custom rules[before] tab, select +Add

Define the following

  • Tenant - Select the Tenant
  • Condition - Define the Match Criteria to apply this rule
  • Action - Do Not Record
  • Position Before auto rules

Teams-specific conditions

Teams-tenantID = "<YOUR_TENANT_ID>" Match criteria for custom recording rules for Teams tenants, should always include this even for specific per-user cases. This is required to match the rule to the call.

Teams-callType defines the type of call

  • pstn calls connecting to external, non-Teams participants
  • p2p calls between two Teams users
  • meeting multipart conference meeting between Teams clients
  • unknown calls to Teams queues

Example Custom Rule: Only Record External Calls (Tenant-wide)

The following rule is evaluated before the standard rules and explicitely rejects recording for calls that match the specified tenant ID and call type (p2p and meeting).

  • Condition Teams-tenantID = "<YOUR_TENANT_ID>" AND (Teams-callType = "p2p" OR Teams-callType = "meeting")
  • Action Do not record

recording-rule-custom-tenant-external

Result Only external calls (Call types pstn and unknown) for this tenant will be recorded.

Example Custom Rule: Only Record Specific Inbound Calls (Tenant-wide)

Call direction is defined by protocol-call-direction attribute:

  • 0 - unknown
  • 1 - outbound
  • 2 - inbound

Assuming the following rule is evaluated before the standard rules, it explicitely rejectes recording for the call outbound calls for the specified tenant.

  • Condition Teams-tenantID = "<YOUR_TENANT_ID>" AND protocol-call-direction = "1"
  • Action Do not record

recording-rule-custom-tenant-inbound

Result Only Inbound calls to this tenant will be recorded