Microsoft Teams Connector

  • Updated

About

The Microsoft Teams Connector allows you to integrate uPBX with Microsoft Teams using Direct Routing. This enables seamless calling between Teams users and native uPBX users via shared infrastructure, both internally and externally.

Prerequisites

Before you begin, see below for what you'll need:

  1. An active Microsoft 365 subscription. The following SKUs are supported:
    • Office 365 E1, E3, E5, A3, A5
    • Microsoft 365 E3, E5, A3, A5
    • Microsoft 365 Business Basic, Standard, or Premium
  2. A Microsoft Teams Phone Standard license for each user
  3. Administrator access to the Microsoft Teams instance you want to connect

What You Can Do With the Teams Connector

  • Include Teams users in Ring Groups, Call Queues, and internal call flows
  • Seamlessly bring Microsoft Teams users into your existing uPBX workflow
  • Operate in hybrid mode or transition gradually to Teams-only environments

When connected

Virtual Office: uPBX will automatically create a dedicated “office” for your Teams users.

Teams Extensions: Any user you provision in Teams appears and behaves exactly like a native uPBX extension.

Full Feature Set: Your Teams users can join Ring Groups, Call Queues, and use all standard User Activities.

Important limitations

No handset monitoring: Teams-based extensions cannot be assigned a monitor key on a physical SIP handset.

Emergency routing: They cannot act as monitored targets for emergency call paths.

Caller-ID handling

If an incoming call to a Teams user has a caller ID shorter than 5 digits (e.g. internal extensions), uPBX will replace it with the Connector’s Default Outbound Number when forwarding or routing the call externally. This ensures the call presents a valid number to external recipients.


Setup Process

uPBX Portal Configuration

To configure a new connector for Microsoft Teams, click on the 'PBX Connectors' icon from the uPBX Configuration screen.

Here you can see your existing connectors.

  • To manage an existing connector, click 'Manage'.
  • To create a new connector, click 'Add Connector'.

Connector Configuration

The left-hand side of the screen contains connector-level settings:

Field Description
Connector Type Selected should be Microsoft Teams
Name A label to identify this connector (e.g. "Microsoft Teams Connector Demo")
Country Sets the default regional settings (e.g. number formatting)
Timezone Used for logs and time-sensitive operations
Default Outbound Number The number used for outbound calls from Teams users
MS Teams Domain A unique domain allocated for use with Microsoft Teams Direct Routing (e.g. 25ce6eb0.teams.mycloudpbx.com.au)
Domain Verification Text The TXT record value provided by Microsoft (e.g. ms=123456).
When creating the connector, this value will be provided in the DNS Verification section below, so leave this field blank and click Save for now.
Once the connector is created, the MS Teams Domain is generated. This is used to verify your domain with Microsoft 365.

Before we verify the domain, we will first create users within the uPBX Configuration Portal on the Connector Management Screen. This should match the extension numbers you will create/set within Microsoft Teams. See below for steps.

uPBX Extensions

The right-hand panel allows you to define which internal users (extensions) are part of the Teams integration; these will be linked later:

Column Description
Ext Number Internal extension number (e.g. 101114115)
Label / Name Optional descriptive label (e.g. "Ben", "Jerry")
Action Click Delete to remove a user from the Teams connector
Adding a User:
  1. Enter the extension number in the User Extension field (e.g. 116)
  2. Click Add User
  3. Optionally assign a name to help identify the user
  4. Click Update Users to save changes

Teams Configuration

Domain/DNS Verification

To complete Microsoft Teams Direct Routing setup, you must verify the Teams domain in Microsoft 365.

Steps:

  1. Go to the Microsoft 365 Admin Center
  2. Navigate to Settings → Domains
  3. Click Add Domain
  4. Enter the MS Teams Domain from the Connector screen in the uPBX portal
  5. Select Add a TXT record to the domain's DNS records
  6. Microsoft will provide you with a TXT value (e.g. MS=ms12345678)
  7. Enter this value into the Domain Verification Text field on the Connector screen in the uPBX portal.
  8. Save the connector
  9. Complete domain verification in Microsoft 365

    Note:
    After adding a new TXT record, it can take up to 15 minutes for the change to propagate and become publicly visible. In some cases, Microsoft’s verification systems may take longer to detect the update.

    We recommend waiting 15–30 minutes after saving the TXT record before attempting verification.

Activate your uPBX Teams Domain

To activate, we will need to create a single 'Activation User', this user will be temporary and can be removed once setup is complete.

Steps:

  1. In the Microsoft 365 Admin Center navigate to Users → Active User → Add a User
  2. Enter the following details
  3. Setting Value
    First Name Teams
    Last Name Activation
    Display Name Teams Activation
    Username Teams Activation
    Domain Add the domain name provided in prior steps. (e.g. 25ce6eb0.teams.mycloudpbx.com.au)
  4. Check Automatically create a password.
  5. Uncheck Require this user to change their password when they first sign in.
    • If the option is there, uncheck Send password in email upon completion.
  6. Assign the User a Microsoft 365 subscription with Microsoft Teams Phone

Voice Routing Policies

Configure Direct Routing (PSTN Gateway)

You can configure Direct Routing in one of two ways, either using PowerShell or the Teams Admin Center (GUI).

Option 1: PowerShell
  1. Open PowerShell as administrator and run the below commands:
    • Install Teams module if not already installed
      Install-Module MicrosoftTeams
    • Set execution policy
      Set-ExecutionPolicy RemoteSigned
    • Connect to Teams with admin credentials
      Connect-MicrosoftTeams
      When prompted enter your Microsoft Teams Admin user details.
    • Create/Add the PSTN Usage Record (equivalent to step 2 in Admin Center)
      Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="example.teams.mycloudpbx.com.au"
    • Create the Voice Route (equivalent to steps 4–7)
      New-CsOnlineVoiceRoute -Identity example.teams.mycloudpbx.com.au -NumberPattern ".*" -Priority 1 -OnlinePstnUsages example.teams.mycloudpbx.com.au -OnlinePstnGatewayList example.teams.mycloudpbx.com.au
Note:
Replace example.teams.mycloudpbx.com.au with your unique domain, noting that it appears in three locations within the command (e.g. 25ce6eb0.teams.mycloudpbx.com.au).
Option 2: Teams Admin Center (GUI)
  1. In Teams Admin Center, navigate to Voice → Direct Routing → Manage PSTN usage records
  2. Click Add, enter your unique Teams URL (e.g. 25ce6eb0.teams.mycloudpbx.com.au), and click Apply
  3. Next, navigate to Voice → Voice routes
  4. Click Add to create a new voice route
  5. Enter the same domain name as used in previous steps
  6. Under PSTN Usage Records, select the usage record you created in step 2
  7. After adding the PSTN usage record to the policy, click Save

Assign Voice Routing Policies

  1. Navigate to Users → Manage users
  2. Select the users you want to assign the voice routing policy to.
  3. Click Edit settings at the top and assign your Voice routing policy, example.teams.mycloudpbx.com.au, to the selected users
Note:
Replace example.teams.mycloudpbx.com.au with your unique domain (e.g. 25ce6eb0.teams.mycloudpbx.com.au)

Teams activation can take up to 24 hours.

You can check the activation status by going to Analytics & reports Usage reports and running the PSTN usage report.

Dial Plans

Microsoft Teams uses E.164. We will create a series of normalisation rules to align with the standard telephone number format for end users.

Configure Dial Plans

  1. In Teams Admin Center navigate to Voice → Dials Plans
  2. Click Add
  3. Name the Dial Plan [STATE] uPBX.
    • We recommend creating a dial plan for each State/Territory your users are located in, this will allow for localised dialling for their location.
    • For each State or Territory, configure the dial plan rules listed under the Overall and State rule sections below.
  1. Click Add
  2. Enter a Name, select Advanced as the rule creation mode, and follow the steps below to create a new rule for each of the following entries. Once filled click save.

  3. Overall rules: Australia
    Name Rule Creation Mode If Condition Then Do This
    AU-National Advanced ^0([2\|3\|7\|8]{1}[0-9]{8})$ +61$1
    AU-Mobile Advanced ^0([4\|5]{1}[0-9]{8})$ +61$1
    AU-13-1300 Advanced ^(13(\d{4}\|00\d{6}))$ +61$1
    AU-1800 Advanced ^(1800\d{6})$ +61$1
    AU-0011 Advanced ^0011(\d+)$ +61$1
    AU-000 Advanced ^(000)$ $1
    State rules: Australia
    Name Rule Creation Mode If Condition Then Do This
    AU-Local-02 Advanced ^([2-9]\d{7})$ +612$1
    AU-Local-03 Advanced ^([2-9]\d{7})$ +613$1
    AU-Local-07 Advanced ^([2-9]\d{7})$ +617$1
    AU-Local-08 Advanced ^([2-9]\d{7})$ +618$1
    Overall rules: New Zealand
    Name Rule Creation Mode If Condition Then Do This
    NZ-National Advanced ^0([2\|3\|4\|6\|7\|9]{1}[0-9]{7})$ +64$1
    NZ-Mobile Advanced ^0(2\d{7,9})$ +64$1
    NZ-0800 Advanced ^(0800\d{6,7})$ +64$1
    NZ-0508 Advanced ^(0508\d{6,7})$ +64$1
    NZ-0900 Advanced ^(0900\d{6,7})$ +64$1
    State rules: New Zealand
    Name Rule Creation Mode If Condition Then Do This
    NZ-Local-02 Advanced ^([2-9]\d{6})$ +64$1
    NZ-Local-03 Advanced ^([2-9]\d{6})$ +64$1
    NZ-Local-04 Advanced ^([2-9]\d{6})$ +64$1
    NZ-Local-06 Advanced ^([2-9]\d{6})$ +64$1
  4. Once all the rules for the dial plan have been created, click Save

Assign Dial Plans

  1. If all the dial plans have been created, next you will need to assign the Policy to users.
    Do this by selecting Users → Manage Users and Select the User, click Policies
  2. Select Voice Routing Policy then Edit
  3. Choose example.teams.mycloudpbx.com.au from the Drop Down List, then click Apply

Emergency Call Routing

Configure Emergency Call Routing

Normalisation rules will be created to align with the E.164 telephone number format required by Microsoft Teams.

  1. In Teams Admin Center navigate to Voice → Emergency Policies
  2. Click Call Routing Policies → Add
  3. In the Name field, enter AU/NZ Emergency uPBX (or a name of your choice)
  4. Under Emergency Dial Strings, click Add twice and enter the following:
    • Dial String: 000 (Australia)
    • Dial String: 111 (New Zealand)
  5. Select example.teams.mycloudpbx.com.au from the PSTN Usage Records dropdown
  6. Click Save

Assigning the Policy to Users

  1. Navigate to Users → Manage Users, select the user, and click Policies
  2. Under Emergency Call Routing, click Edit
  3. Select AU/NZ Emergency uPBX from the dropdown list

Teams User Linking

  1. In Teams Admin Center, navigate to Users → Manage Users
  2. For each user who should use Direct Routing:
    • Assign a phone number matching the extension configured in uPBX (e.g. 101)
      • Leave the Extension field blank
    • Ensure the appropriate Voice Routing Policy is applied
Reminder:
Each Teams user must have an Extension Number assigned that matches the one configured earlier on the uPBX Connector Configuration screen. This extension number is essential to map Teams users to uPBX users and allow uPBX to route calls to the correct Microsoft Teams instance.