MSBA-239 · Lesson 7 of 12 · 20 min

Routing and dial plan questions

▶ Video coming soon A video version of this lesson is on the way.

Routing questions are where Felix had lost the most marks on MS-700 years earlier, and the practice assessment suggested little had changed: three of his seven Teams Phone misses were about voice routing or normalization. Ludovica gave this session a single goal. "By the end, you should be able to trace any number from what a user types to the gateway that carries it, on paper, without looking anything up." She drew the chain on the whiteboard before saying anything else.

This lesson takes two families of questions apart: dial plans and normalization, which apply to every connectivity option, and Direct Routing voice routing, which applies only to numbers routed through an SBC. It ends with trunk translation, location-based routing, local media optimization and SBAs, which appear as identification and configuration bullets in domain 3. The material was first taught in Teams Phone Systems: Direct Routing, Operator Connect and Calling Plans (MSBA-230).

A left-to-right chain. A user types digits. The effective dial plan normalizes them to an E.164 number. If the user is on Calling Plans or Operator Connect, the call goes to that provider. If the user is on Direct Routing, the voice routing policy lists PSTN usages in order; each usage holds voice routes; the first route whose number pattern matches is used; the route sends the call to one of its gateways, which are SBCs; outbound trunk translation may change the number before it leaves the SBC.
From digits to gateway: the routing chain.

Step one: the effective dial plan

Users type numbers in many forms: a four-digit extension, a local number without the area code, a number with a leading 9 for an outside line. A dial plan is a set of normalization rules that translate these forms into E.164 numbers, the international format that starts with a plus sign and country code. Every user has an effective dial plan made of two parts: the service country dial plan, which Microsoft provides from the user's usage location, and an optional tenant dial plan, which you create and assign. Tenant dial plan rules are evaluated before the service country rules. Within a dial plan, rules are evaluated in order and the first rule that matches wins.

ConceptWhat to remember
Service country dial planBuilt in, based on usage location; cannot be edited
Tenant dial planCreated by you, assigned to users, groups or the global level
Normalization ruleA pattern (regular expression) and a translation
Rule orderFirst match wins; put specific rules before general ones
ScopeNormalization applies to every connectivity option, not just Direct Routing
TestingTest the effective dial plan for a user with a sample number
Normalization rules built in memory, added to a tenant dial plan, and tested. Check parameter names with Get-Help.
# Tenant dial plan with two rules (fictional numbers)
$ext = New-CsVoiceNormalizationRule -Parent Global -Name "Ext-4" `
    -Pattern '^(4\d{3})$' -Translation '+1555010$1' -InMemory
$out = New-CsVoiceNormalizationRule -Parent Global -Name "Strip-9" `
    -Pattern '^9(\d{10})$' -Translation '+1$1' -InMemory
New-CsTenantDialPlan -Identity "Branch-North" -NormalizationRules @{Add=$ext,$out}

# What does a user's effective dial plan do with 4410?
Get-CsEffectiveTenantDialPlan -Identity "user@contoso.example" |
    Test-CsEffectiveTenantDialPlan -DialedNumber "4410"

Reading a normalization rule

Exam items often show a rule and ask what a number becomes, or ask you to pick the rule that produces a given result. You do not need to be a regular expression expert, but you need four symbols. A caret (^) anchors the start, a dollar sign anchors the end, \d means one digit, and {n} means exactly n of the previous item. Parentheses capture what they match, and a capture reference in the translation (a dollar sign followed by the number one) inserts the first capture.

Reading normalization rules, one per line: pattern, translation, input and result. All numbers are fictional.
# pattern        translation   input        result
^(4\d{3})$     +1555010$1    4410         +15550104410
^9(\d{10})$    +1$1          95555550123  +15555550123
^(\d{7})$      +1555$1       5550123      +15555550123
^(4\d{3})$     +1555010$1    44100        no match (five digits)

Ludovica's three-question routine for any rule: What must the input start and end with? How many digits? What does the translation keep? In the first row, the input must be exactly four digits starting with 4; the whole input is captured and appended to a prefix. In the second, a leading 9 is required and dropped, and the following ten digits are kept. In the last row, five digits fail the {3} count, so the rule does not match and the next rule (or the service country plan) gets a turn.

Corvallin's North Branch dial plan keeps a rule that strips a leading 9 for one year, because long-serving staff still dial 9 for an outside line from habit. Felix had moved the extension rule above a broader seven-digit rule in the head office dial plan on port day, when a four-digit extension starting with 5 was being caught by the wrong rule. That fix is a typical exam scenario: two rules, the wrong one matching first, and the answer is to reorder them.

Step two: voice routing for Direct Routing

For users whose calls go through an SBC, the normalized number is matched against voice routing. The pieces fit together like this:

PieceContainsAssigned to
Online PSTN gatewayAn SBC's FQDN, port and settingsReferenced by voice routes
PSTN usageA label onlyListed in voice routes and in voice routing policies
Voice routeA number pattern, a priority, one or more PSTN usages and one or more gatewaysBelongs to usages
Voice routing policyAn ordered list of PSTN usagesUsers or groups

When a user places a call, Teams looks at the user's voice routing policy, takes its PSTN usages in order, and within each usage looks for voice routes whose number pattern matches the normalized number. Among matching routes in the same usage, the route with the best priority is tried first. Within a route, the call goes to one of the listed gateways; if none is available, the next matching route is tried. If no route in any usage matches, the call fails.

Two usages, two routes and a policy. A local call matches the first usage's route; a long-distance call matches only the second usage's route, which has two gateways for failover.
# Satellite office routing (fictional FQDNs and numbers)
Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="Satellite-Local","Satellite-LD"}
New-CsOnlineVoiceRoute -Identity "Sat-Local" -NumberPattern '^\+1555(\d{7})$' `
    -OnlinePstnGatewayList "sbc1.contoso.example" -OnlinePstnUsages "Satellite-Local" -Priority 1
New-CsOnlineVoiceRoute -Identity "Sat-LD" -NumberPattern '^\+1(\d{10})$' `
    -OnlinePstnGatewayList "sbc1.contoso.example","sbc2.contoso.example" -OnlinePstnUsages "Satellite-LD" -Priority 1
New-CsOnlineVoiceRoutingPolicy -Identity "Satellite-Users" -OnlinePstnUsages "Satellite-Local","Satellite-LD"
Grant-CsOnlineVoiceRoutingPolicy -Identity "user@contoso.example" -PolicyName "Satellite-Users"

Worked problem

Which route carries the call?

Using the listing above, a satellite user calls +15555550199. Then a second user, who has the global voice routing policy with no usages, calls the same number. What happens in each case?

Show solution
  1. The first user's policy lists Satellite-Local first. Its route Sat-Local has pattern ^\+1555(\d{7})$, which matches +15555550199.
  2. The call goes to sbc1.contoso.example. If sbc1 is down, Teams moves on: the next matching route is Sat-LD in the second usage, whose pattern also matches, so the call can reach sbc2.
  3. The second user's policy has no PSTN usages, so no route can match and the call fails.

Answer: User one: Sat-Local through sbc1, with failover through Sat-LD to sbc2. User two: the call fails because the voice routing policy has no usages.

The common traps

Symptom in the questionLikely cause
A short extension dials the wrong numberA broader normalization rule above the extension rule
Calls go out through the wrong SBCUsage order in the policy, or route priority within a usage
A route exists but calls fail with no route foundThe route's usage is not in the user's voice routing policy
A Calling Plans user ignores the voice routing policyVoice routing policies only apply to Direct Routing numbers
International calls fail, local calls workNo route pattern matches international numbers, or an outbound call restriction blocks them

Trunk translation rules

A trunk translation rule changes a number as it passes between Teams and a specific SBC, without changing what users see or what dial plans do. You attach translation rules to the online PSTN gateway for inbound and outbound calling and called numbers. A typical use is a carrier that expects national format instead of E.164: an outbound called-number rule strips +1 before the call reaches the SBC. The difference from normalization: normalization changes what the user dialled into E.164 for everyone with that dial plan; trunk translation changes numbers only on one trunk, after routing has picked it.

Location-based routing and local media optimization

Location-based routing (LBR) enforces rules in countries where regulation forbids toll bypass, that is, carrying PSTN calls over the internet to a breakout in another location. It uses the network topology (sites and subnets) to decide whether a user at a given site may place a PSTN call through a given gateway, and it requires Direct Routing. If the exam mentions a country where regulation prohibits toll bypass, LBR is the feature. Local media optimization (LMO) keeps media between Teams clients and the SBC on the internal network when both are in the same location, instead of sending it through the internet, which suits branches with a downstream SBC behind a central proxy SBC. Both rely on correctly defined network sites and subnets.

FeatureProblem it solvesCue in a question
Location-based routingRegulatory restrictions on toll bypass"Regulations prohibit routing PSTN calls between sites over the internet"
Local media optimizationMedia hairpinning through the internet when users and SBC are local"Keep media on the internal network at the branch"
Survivable Branch AppliancePSTN calling during a loss of connection to Microsoft"Calls must continue during a WAN or internet outage"
On-network conferencingRoute audio conferencing calls through Direct Routing"Dial-in conferencing calls should use our own trunks"

SBA policies

An SBA keeps calling working at a branch during an outage. The SBA runs on or beside the branch SBC. You register the SBA in the tenant, create an SBA policy that names it, and assign the policy to users at that branch. During normal operation, nothing changes for users; during an outage, supported clients fail over to the SBA for PSTN calls. MSBA-230 noted a limitation that affected Corvallin's satellite office design: with continuous access evaluation enabled, a fallback can be limited to a window, so the security and voice teams must agree on settings before go-live.

Testing and troubleshooting routing

Routing questions often end with "What should you do first?" The first step is nearly always to test what Teams thinks will happen, before changing anything. For dial plans, test the user's effective tenant dial plan with the number they dialled, which shows the rule that matched and the resulting number. For Direct Routing, check that the user has the expected voice routing policy and that the SBC is healthy in the Teams admin center. Only then change rules or routes.

QuestionFirst checkTypical fix
A user's short number dials the wrong destinationTest the effective tenant dial plan with that inputReorder or tighten the normalization rules
All calls through one SBC failSBC health: SIP OPTIONS, TLS certificate, DNSRenew the certificate, fix DNS or the firewall
Only international calls failRoute patterns and the user's usages; outbound restrictionsAdd a route or usage, or adjust the dial-out policy
Calls fail only for one group of usersTheir voice routing policy and its usagesAssign the correct policy or add the usage
Calls reach the carrier but are rejectedSIP response codes in the PSTN usage report and SBC logsTrunk translation to the format the carrier expects

Felix had a real example from port day. One regional carrier took a day longer than the others to update its routing for the ported numbers, so callers on that carrier reached the old PBX. Nothing in Teams was wrong, and every check in the table above passed. The lesson for the exam is that not every failed call is a Teams configuration error; if every Teams-side check passes and the problem is limited to callers on one network, the cause is outside the tenant.

A worked tracing exercise

Ludovica ended the session with a full trace. A satellite office user types 95551230. The tenant dial plan has a rule ^9(\d{7})$ with a translation that adds the country and area code, producing an E.164 number. The user is on Direct Routing with the Satellite-Users policy, which lists Satellite-Local then Satellite-LD. The local route's pattern matches numbers in the local area code, so the call goes to the first SBC. If that SBC is unavailable, the long-distance route in the second usage also matches, so the call fails over to the second SBC. If both are down and an SBA is configured for the site, supported clients can use the SBA. Felix traced it aloud in under two minutes, which was the goal of the session.

Teodor, who had listened from the corner, said that he finally understood why the voice team spoke about usages as if they were important. "They are the glue. A route without a usage in your policy does not exist for you." Ludovica wrote that sentence on the whiteboard and left it there for the rest of the week.

Questions about where routing is configured

A smaller group of routing questions asks where, rather than how. Dial plans, voice routes, voice routing policies, PSTN usages and gateways can all be managed in the Teams admin center under the voice settings, and with Teams PowerShell. Some tasks are easier in PowerShell, such as building several normalization rules at once or testing an effective dial plan, while the admin center is convenient for a single route or for checking SBC health. If a question asks for the method with the least effort for many objects, PowerShell is usually the answer; if it asks where to see the health of an SBC, the admin center is.

Common mistakes

  • MistakeAssuming route priority beats usage order.

    InsteadUsage order in the policy decides first; priority decides between routes in the same usage.

  • MistakeUsing a normalization rule to reformat numbers for one carrier.

    InsteadUse a trunk translation rule on that gateway.

  • MistakeRecommending LBR to save bandwidth.

    InsteadLBR enforces toll bypass rules; LMO keeps media local.

  • MistakeThinking dial plans only matter for Direct Routing.

    InsteadNormalization applies to every connectivity option.

Summary and key terms

  • The effective dial plan is the tenant dial plan plus the service country dial plan; tenant rules are evaluated first and the first matching rule wins.
  • Read a rule by its anchors, digit counts and captures.
  • Direct Routing: voice routing policy (ordered usages) to voice routes (patterns, priorities, gateways) to SBCs.
  • Trunk translation rules reformat numbers on one gateway after routing.
  • LBR is for toll bypass regulation, LMO keeps media local, SBAs keep calling during outages, and on-network conferencing routes conferencing calls through your trunks.
E.164
The international number format with a plus sign and country code.
Normalization rule
A rule that converts a dialled string into an E.164 number.
Effective dial plan
The combination of service country and tenant dial plan rules for a user.
Voice route
A Direct Routing object with a number pattern, priority, usages and gateways.
Voice routing policy
An ordered list of PSTN usages assigned to Direct Routing users.
Trunk translation rule
A rule that changes numbers on a specific SBC trunk.
Location-based routing
Direct Routing feature that enforces toll bypass restrictions by network site.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Which is evaluated first: tenant dial plan rules or service country rules?

    Show answer

    Tenant dial plan rules.

  2. A route exists for international numbers, but calls fail. The user's policy lists one usage. What do you check?

    Show answer

    Whether the international route belongs to that usage.

  3. A carrier wants numbers without the +1 prefix. What do you configure?

    Show answer

    An outbound trunk translation rule on that gateway.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz