As Microsoft Teams continues to replace conventional telephony systems, there are more and more tasks to be done in this area that we are normally used to doing in a conventional telephony system.
In this article we will deal with a smaller topic, which is nevertheless very important.

From a user perspective, we can block incoming numbers in our teams client. But is this also possible tenant wide? Short answer: YES!
Microsoft Calling Plans, Direct Routing, and Operator Connect all support blocking inbound calls from the Public Switched Telephone Network (PSTN). This feature allows an administrator to define a list of number patterns and exceptions at the tenant global level so that the caller ID of every incoming PSTN call to the tenant can be checked against the list for a match. If a match is made, an incoming call is rejected.
This inbound call blocking feature only works on inbound calls that originate from the PSTN and only works on a tenant global level. Individual Teams users can’t manipulate this list. The Teams client does allow individual users to block PSTN calls.

 

Blocking numbers from the user’s point of view

 

To view and manage the numbers you have blocked, select settings and more next to your profile picture at the top of Teams, then select Settings > Privacy.
Under Blocked contacts, select Edit blocked contacts to view and remove all the numbers you have blocked from the list.
Select Block calls without caller ID to block anonymous calls.

 

Blocking numbers at tenant level

 

Activate the call blocking feature

To view and activate the call blocking feature, use the Get- and Set-CsTenantBlockingCallingNumbers Teams PowerShell Module cmdlets.

  • Get-CsTenantBlockedCallingNumbers returns the inbound block number patterns and the inbound exempt number patterns parameters for the global blocked number list. This cmdlet also returns whether blocking has been Enabled (True or False).
  • Set-CsTenantBlockedCallingNumbers allows you to specify whether the global tenant blocked calls are turned on or off at the tenant level.

 

Manage block number patterns

You manage number patterns by using the New-, Get-, Set-, Test-, and Remove-CsInboundBlockedNumberPattern Teams PowerShell Module cmdlets.

  • Get-CsInboundBlockedNumberPattern returns a list of all blocked number patterns added to the tenant list including Name, Description, Enabled (True/False), and Pattern.
  • New-CsInboundBlockedNumberPattern adds a blocked number pattern to the tenant list.
  • Remove-CsInboundBlockedNumberPattern removes a blocked number pattern from the tenant list.
  • Set-CsInboundBlockedNumberPattern modifies one or more parameters of a blocked number pattern in the tenant list.
  • Test-CsInboundBlockedNumberPattern tests whether calls from a given phone number will be blocked.

 

Examples

Block a number

In the following example, the tenant administrator wants to block all calls coming from the number range 1 (312) 555-0000 to 1 (312) 555-9999. The number pattern is created so that both numbers in range with + prefixed and numbers in the range without + prefixed are matched. You don’t need to include the symbols – and () in the phone numbers because the system strips these symbols before matching. To turn on the number pattern, set the Enabled parameter to True. To disable this specific number pattern, set the parameter to False.

New-CsInboundBlockedNumberPattern -Name "BlockRange1" -Enabled $True -Description "Block Contoso" -Pattern "^\+?1312555\d{4}$"

In the next example, the tenant administrator wants to block all calls coming from the number 1 (412) 555-1234. To turn on the number pattern, the Enabled parameter is set to True.

 

New-CsInboundBlockedNumberPattern -Name "BlockNumber1" -Enabled $True -Description "Block Fabrikam" -Pattern "^\+?14125551234$"

Creating a new pattern adds the pattern as enabled by default. The description is an optional field to provide more information.

We recommend that you provide a meaningful name to easily understand why the pattern was added. To block spam numbers, consider naming the rule the same as the number pattern that’s being matched, and then add additional information in the description as required.

Patterns are matched using Regular Expressions (Regex). For more information, see Using Regex.

Allow time for replication before you test and validate.

 

Allow a number

You can allow a number to call by removing the blocked number pattern. In the following example, the tenant administrator wants to allow 1 (412) 555-1234 to make calls again.

Remove-CsInboundBlockedNumberPattern -Identity “BlockNumber1”

 

Source reference

Most of this article references the Microsoft Technet article: Block inbound calls