Walkthrough: Microsoft Teams Direct Routing (Part 5)

This post is part of a series that will explore Microsoft Teams Direct Routing. The aim is to walk you through a configuration that worked for me so that you can potentially speed up your own deployments.

In this fifth post, we’re going to configure Microsoft Teams Local Media Optimization (LMO). Configuring LMO if useful if you have SBCs/PSTN gateways (referred to as the Downstream SBC) providing PSTN connectivity, but it isn’t possible/desirable to also connect them to Office 365. In this configuration, the media from the client flows directly to the Downstream SBC and does not route via the Office 365-connected SBC (referred to as the Proxy SBC). In this way, the media path is optimised.

There are some pre-requisites before getting started:

  • The initial setup of the SBC (see Part 1)
  • The configuration of the SBC (see Part 2)
  • The Microsoft Teams configuration (see Part 3)
  • Ensure you have sufficient capacity to host a second SBC VM
  • Lots of patience (this is quite fiddly)

SBC Setup

  • Perform the base SBC configuration for a second SBC as per the notes in Post 1
  • Configure the internal certificate only as per Post 2

Remove the proxy SBC’s ITSP configuration

Remove the Routes

  • Navigate to SETUP > SIGNALING & MEDIA > SBC > Routing > IP-to-IP Routing
  • Remove the ITSP O365 to ITSP and ITSP to O365 entries

Remove the Allowed Coders Groups

  • Navigate to SETUP > SIGNALING & MEDIA > CODERS & PROFILES > Allowed Audio Coders Groups
  • Remove the O365 entry
  • Remove the ITSP entry

Note: We’ll retain the Coder Group containing G.711 A-law

Remove the ITSP IP Profile

  • Navigate to SETUP > SIGNALING & MEDIA > CODERS & PROFILES > IP Profiles
  • Remove the ITSP entry

Remove the ITSP IP Group

  • Navigate to SETUP > SIGNALING & MEDIA > CORE ENTITIES > IP Groups
  • Remove the ITSP entry

Remove the ITSP Proxy Set

  • Navigate to SETUP > SIGNALING & MEDIA > CORE ENTITIES > Proxy Sets
  • Remove the ITSP entry

Remove the ITSP Media Realm

  • Navigate to SETUP > SIGNALING & MEDIA > CORE ENTITIES > Media Realms
  • Remove the ITSP entry

Remove the ITSP SIP Interface

  • Navigate to SETUP > SIGNALING & MEDIA > CORE ENTITIES > SIP Interfaces
  • Remove the ITSP entry

Reconfigure the Proxy SBC

Configure the internal Media Realm

  • Navigate to SETUP > SIGNALING & MEDIA > CORE ENTITIES > Media Realms
  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Name: Internal
      • Topology Location: Down
      • IP Interface Name: #1 [LAN+MGMT]
      • UDP Port Range Start: <UdpPortRangeStart> (configure this as per your requirements)
      • Number Of Media Session Legs: <SessionLegs> (configure this as per your requirements)

Configure inter-SBC SIP interface

  • Navigate to SETUP > SIGNALING&MEDIA > CORE ENTITIES > SIP Interfaces
  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Name: SBC
      • Topology Location: Down
      • Network Interface: #1 [LAN+MGMT]
      • UDP Port: 0
      • TCP Port: 0
      • TLS Port: 5061
    • MEDIA
      • Media Realm: #1 [Internal]
    • SECURITY
      • TLS Context Name: #1 [Internal]

Configure the inter-SBC Proxy Set

  • Navigate to SETUP > SIGNALING&MEDIA > CORE ENTITIES > Proxy Sets
  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Name: SBC
      • SBC IPv4 SIP Interface: #1 [SBC]
      • TLS Context Name: #1 [Internal]
    • KEEP ALIVE
      • Proxy Keep-Alive: Using OPTIONS

Configure inter-SBC Proxy Addresses

  • Navigate to SETUP > SIGNALING&MEDIA > CORE ENTITIES > Proxy Sets
  • Select the SBC entry, scroll to the bottom of the page and click the Proxy Address 0 items >> link
  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Proxy Address: sbc02.<Domain>.:5061
      • Transport Type: TLS

Reconfigure the O365 IP Profile

  • Navigate to SETUP > SIGNALING&MEDIA > CODERS & PROFILES > IP Profiles
  • Select the 0365 entry and click Edit
  • Enter the following and click APPLY:
    • SBC Signalling
      • Remote Representation Mode: Add Routing Headers
    • SBC Forward and Transfer
      • Remote REFER Mode: Regular
      • Remote 3xx Mode: Transparent

Configure inter-SBC IP Profile

  • Navigate to SETUP > SIGNALING&MEDIA > CODERS & PROFILES > IP Profiles
  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Name: SBC
    • MEDIA SECURITY
      • SBC Media Security Mode: Secured
    • SBC MEDIA
      • Extension Coders Group: #0 [AudioCodesGroup_1]
    • SBC SIGNALING
      • P-Asserted-Identity Header Mode: Add
    • SBC FORWARD AND TRANSFER
      • Remote REFER Mode: Regular
      • Remove Replaces Mode: Standard
      • Remote 3xx Mode: Transparent

Reconfigure IP Groups

  • Navigate to SETUP > SIGNALING&MEDIA > CORE ENTITIES> IP Groups
  • Select the O365 entry and click Edit
  • Enter the following and click APPLY:
    • GENERAL
      • Internal Media Realm: #1 [Internal]
    • SBC ADVANCED
      • Teams Media Optimization Handling: Teams Decides
      • Teams Media Optimization Initial Behavior: Direct Media
      • Call Setup Rules Set ID: 0

  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Name: SBC
      • Proxy Set: #1 [SBC]
      • IP Profile: #2 [SBC]
      • Media Realm: #1 [Internal]
    • SBC GENERAL
      • Classify By Proxy Set: Enable
    • SBC ADVANCED
      • Tags: Site=sbc02.<Domain>
    • MESSAGE MANIPULATION
      • Outbound Message Manipulation Set: 2

Configure Call Setup Rules

  • Navigate to SETUP > SIGNALING&MEDIA > SIP DEFINITIONS > Call Setup Rules
  • Click New
  • Enter the following and click APPLY:
    • CONDITION
      • Condition: Var.Session.0 == ”
    • ACTION
      • Action Subject: Var.Session.0
      • Action Type: Modify
      • Action Value: Header.Request-URI.URL.Host.Name

  • Click New
  • Enter the following and click APPLY:
    • CONDITION
      • Condition: Var.Session.0 != ”
    • ACTION
      • Action Subject: DstTags.Site
      • Action Type: Modify
      • Action Value: Var.Session.0

Configure Message Manipulation Rules

  • Navigate to SETUP > SIGNALING&MEDIA > MESSAGE MANIPULATION > Message Manipulations
  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Index: 0
      • Name: Privacy Header
      • Manipulation Set ID: 2
    • MATCH
      • Condition: Header.Privacy contains ‘id’
    • ACTION
      • Action Subject: Header.Privacy
      • Action Type: Remove

Re-Configure IP-to-IP Call Routing Rules

  • Navigate to SETUP > SIGNALING&MEDIA > SBC > Routing > IP-to-IP Routing
  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Name: O365 to SBC
    • MATCH
      • Source IP Group: O365
    • ACTION
      • Destination Type: Destination Tag
      • Routing Tag Name: Site

  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Name: SBC to O365
    • MATCH
      • Source IP Group: SBC
    • ACTION
      • Destination Type: IP Group
      • Routing Tag Name: O365

Reconfigure the Classification rule

  • Navigate to SETUP > SIGNALING&MEDIA > SBC > Classification
  • Select the O365 entry and click Edit
  • Enter the following and click APPLY:
    • Name: O365 Downstream
    • Destination Host: sbc02.<Domain>

Configure a new Classification rule for OPTIONS

  • Click New
  • Enter the following and click APPLY:
    • Name: O365 Proxy
    • Source IP Address: 52.114.*.*
    • Destination Host: sbc01.<Domain>
    • Message Condition: O365-Contact
    • Action Type: Allow
    • Source IP Group: #0 [O365]

Configure the Downstream SBC

Configure the ITSP Media Realm

  • Navigate to SETUP > SIGNALING&MEDIA > Core Entities
  • Select the existing realm and click Edit
  • Enter the following and click APPLY:
    • GENERAL
      • Name: ITSP
      • Topology Location: Up
      • IP Interface Name: #1 [WAN]
      • UDP Port Range Start: <UdpPortRangeStart> (configure this as per your requirements)
      • Number Of Media Session Legs: <SessionLegs> (configure this as per your requirements)

Configure the Internal Media Realm

  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Name: Internal
      • Topology Location: Down
      • IP Interface Name: #0 [LAN+MGMT]
      • UDP Port Range Start: <UdpPortRangeStart> (configure this as per your requirements)
      • Number Of Media Session Legs: <SessionLegs> (configure this as per your requirements)

Configure ITSP SIP interface

  • Navigate to SETUP > SIGNALING&MEDIA > CORE ENTITIES > SIP Interfaces
  • Select the existing interface and click Edit
  • Enter the following and click APPLY:
    • GENERAL
      • Name: ITSP
      • Topology Location: Up
      • Network Interface: #1 [WAN]
      • UDP Port: 5060
      • TCP Port: 0
    • MEDIA
      • Media Realm: #1 [ITSP]
    • SECURITY
      • TLS Context Name: <Null>

Configure inter-SBC SIP interface

  • Click New
  • Select the existing interface and click Edit
  • Enter the following and click APPLY:
    • GENERAL
      • Name: SBC
      • Topology Location: Down
      • Network Interface: #1 [LAN+MGMT]
      • UDP Port: 0
      • TCP Port: 0
      • TLS Port: 5061
      • Enable TCP Keepalive: Enable
    • MEDIA
      • Media Realm: #1 [Internal]
    • SECURITY
      • TLS Context Name: #1 [Internal]

Configure the ITSP Proxy Set

  • Navigate to SETUP > SIGNALING&MEDIA > CORE ENTITIES > Proxy Sets
  • Select the existing interface and click Edit
  • Enter the following and click APPLY:
    • GENERAL
      • Name: ITSP
      • SBC IPv4 SIP Interface: #1 [ITSP]
    • KEEP ALIVE
      • Proxy Keep-Alive: Using OPTIONS

Configure the inter-SBC Proxy Set

  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Name: ITSP
      • SBC IPv4 SIP Interface: #1 [ITSP]
    • KEEP ALIVE
      • Proxy Keep-Alive: Using OPTIONS

Configure ITSP Proxy Address

  • Select the ITSP entry, scroll to the bottom of the page and click the Proxy Address 0 items >> link
  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Proxy Address: <ItspFqdn> (Configure as per your PSTN provider)
      • Transport Type: UDP
      • Proxy Priority: 0
      • Proxy Random Weight: 0

  • Click the Back button

Configure SBC Proxy Address

  • Select the SBC entry, scroll to the bottom of the page and click the Proxy Address 0 items >> link
  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Proxy Address: SBC01.<Domain>:5061
      • Transport Type: TLS
      • Proxy Priority: 0
      • Proxy Random Weight: 0

Configure ITSP Coder Groups

  • Navigate to SETUP > SIGNALING&MEDIA > CODERS & PROFILES > Coder Groups
  • Select Coder Group Name 0 : AudioCodersGroup_0
  • Confirm the following are set:
    • 1st Entry
      • Coder Name: G.711-Alaw
      • Packetization Time: 20
      • Rate: 64
      • Payload Type: 8
      • Silence Suppression: Disabled

Configure inter-SBC Coder Groups

  • Select Coder Group Name 1 : Does Not exist
  • Enter the following and click APPLY:
    • 1st Entry
      • Coder Name: G.711-Alaw
      • Packetization Time: 20
      • Rate: 64
      • Payload Type: 8
      • Silence Suppression: Disabled

  • Configure ITSP IP Profile
    • Click New
    • Enter the following and click APPLY:
      • GENERAL
        • Name: ITSP
      • MEDIA SECURITY
        • SBC Media Security Mode: Not Secured
      • SBC EARLY MEDIA
        • Remote Early Media RTP Detection Mode: By Signaling
      • SBC MEDIA
        • Extension Coders Group: #0 [AudioCodesGroup_0]
      • SBC SIGNALING
        • P-AssertedIdentity Header Mode: Add
      • SBC FORWARD AND TRANSFER
        • Remote REFER Mode: Handle Locally
        • Remote Replaces Mode: Handle Locally
        • Remote 3xx Mode: Handle Locally

Configure SBC IP Profile

  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Name: SBC
    • MEDIA SECURITY
      • SBC Media Security Mode: Secured
    • SBC EARLY MEDIA
      • Remote Early Media RTP Detection Mode: By Media
    • SBC MEDIA
      • Extension Coders Group: #0 [AudioCodesGroup_1]
      • ICE Mode: Lite
      • RTCP Mode: Generate Always
    • SBC SIGNALING
      • SIP UPDATE SUPPORT: Not Supported
      • Remote reINVITE Support: Supported only with DSP
      • Remote Delayed Offer Support: Not Supported
    • SBC FORWARD AND TRANSFER
      • Remote REFER Mode: Handle Locally
      • Remote Replaces Mode: Handle Locally
      • Remote 3xx Mode: Handle Locally
    • SBC HOLD
      • Remote Hold Format: Inactive

Configure ITSP IP Group

  • Navigate to SETUP > SIGNALING & MEDIA > CORE ENTITIES> IP Groups
  • Select the existing entry and click Edit
  • Enter the following and click APPLY:
    • GENERAL
      • Name: ITSP
      • Topology Location: Up
      • Type: Server
      • Proxy Set: #1 [ITSP]
      • IP Profile: #2 [ITSP]
      • Media Realm: #1 [ITSP]
      • SIP Group Name: sbc02.<Domain>
    • SBC GENERAL
      • Classify By Proxy Set: Enable

Configure SBC IP Group

  • Click New
  • Enter the following and click APPLY:
    • GENERAL
      • Name: SBC
      • Type: Server
      • Proxy Set: #1 [SBC]
      • IP Profile: #2 [SBC]
      • Media Realm: #1 [Internal]
      • SIP Group Name: sbc02.<Domain>

Configure SRTP

  • Navigate to SETUP > SIGNALING&MEDIA > MEDIA > Media Security
  • Enter the following and click APPLY:
    • GENERAL
      • Media Security: Enable

Configure IP-to-IP Call Routing Rules

  • Navigate to SETUP > SIGNALING&MEDIA > SBC > Routing > IP-to-IP Routing
  • Click New
  • Enter the following and click APPLY:
    • 1st rule
      • GENERAL
        • Name: Terminate OPTIONS
      • MATCH
        • Source IP Group: Any
        • Request Type: OPTIONS
      • ACTION
        • Dest Type: Dest Address
        • Destination Address: Internal
    • 2nd rule
      • GENERAL
        • Name: REFER from O365
      • MATCH
        • Source IP Group: Any
        • Call Trigger: REFER
        • ReRoute IP Group: #1 [SBC]
      • ACTION
        • Dest Type: IP Group
        • Dest IP Group: #1 [SBC]
    • 3rd rule
      • GENERAL
        • Name: SBC to ITSP
      • MATCH
        • Source IP Group: #1 [SBC]
      • ACTION
        • Dest Type: IP Group
        • Dest IP Group: #0 [ITSP]
    • 3rd rule
      • GENERAL
        • Name: ITSP to SBC
      • MATCH
        • Source IP Group: #1 [ITSP]
      • ACTION
        • Dest Type: IP Group
        • Dest IP Group: #0 [SBC]

We’ll complete the configuration in the next post in the series.

Thanks for reading!

Leave a comment