封鎖撥入通話Block inbound calls

電話系統直通路由與通話方案支援封鎖從公用交換電話網絡 (PSTN) 的輸入電話。Phone System Direct Routing and Calling Plans support blocking inbound calls from the Public Switched Telephone Network (PSTN). 此功能可讓您針對清單中的每個撥入 PSTN 呼叫,針對其進行檢查,以進行數位模式的租使用者識別碼。This feature allows a tenant global list of number patterns to be defined 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.

這個輸入呼叫封鎖功能只能在源自 PSTN 的撥入通話中運作,且僅適用于租使用者全域基礎。This inbound call blocking feature only works on inbound calls that originate from the PSTN and only works on a tenant-global basis. 在每個使用者的基礎上無法使用。It's not available on a per-user basis.

注意

封鎖的呼叫者可能會在已封鎖的情況中遇到稍有不同的行為。Blocked callers may experience slightly different behaviors when they've been blocked. 此行為是根據封鎖的呼叫者的載波如何處理呼叫不允許成功完成的通知而定。The behavior is based on how the blocked caller’s carrier handles the notification that the call isn't allowed to be successfully completed. 範例中可能會包含一則指示來電無法完成的載波訊息,或只是要放下通話。Examples may include a carrier message stating the call can't be completed as dialed, or simply dropping the call.

呼叫封鎖管理員控制與資訊Call blocking admin controls and information

封鎖號碼的管理員控制項只使用 PowerShell 提供。Admin controls for blocking numbers are provided using PowerShell only. 數位區塊模式定義為一般運算式模式。Number block patterns are defined as regular expression patterns. 運算式的順序不重要-清單中第一個符合的模式會導致通話封鎖。The order of the expressions is unimportant – the first pattern matched in the list results in the call being blocked. 在封鎖的呼叫者清單中新增或移除的新號碼或模式,模式可能需要長達24小時才能生效。A new number or pattern that's added or removed in the blocked callers list may take up to 24 hours for the pattern to become active.

呼叫封鎖 PowerShell 命令Call blocking PowerShell commands

您可以使用 [新增]、[取得]、[設定]、[移除 - CsInboundBlockedNumberPattern ] Cmdlet 來管理數位模式。You manage number patterns by using the New, Get, Set, Remove -CsInboundBlockedNumberPattern cmdlets. 您可以使用這些 Cmdlet 來管理指定的模式,包括切換指定模式啟用的功能。You can manage a given pattern by using these cmdlets, including the ability to toggle the activation of a given pattern.

查看並啟用整個呼叫封鎖功能是透過 取得設定 - CsTenantBlockingCallingNumbers Cmdlet 來管理。Viewing and activating the entire call blocking feature is managed through the Get, Set -CsTenantBlockingCallingNumbers cmdlets.

  • CsTenantBlockedCallingNumbers 會傳回全域封鎖號碼清單的參數,包括啟用 (True/False) 。Get-CsTenantBlockedCallingNumbers returns the parameters for the global blocked number list including Enabled (True/False). 只有在開啟或關閉此功能時,才能手動修改單一全域租使用者原則。There's a single global tenant policy that can't be modified manually other than to turn the feature on or off.
  • Set-CsTenantBlockedCallingNumbers 可讓您在租使用者層級開啟和關閉全域租使用者封鎖通話。Set-CsTenantBlockedCallingNumbers allows modifying the global tenant blocked calls to be turned on and off at the tenant level.

範例Examples

封鎖數位Block a number

在這個範例中,[ 啟用 ] 和 [ 描述 ] 參數是選用的。In this example, the Enabled and Description parameters are optional.

New-CsInboundBlockedNumberPattern -Name “<name>” -Enabled $True -Description “<description>” -Pattern “^[+]?13125550000”

建立新的模式會將模式新增為 [預設啟用]。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. 在只封鎖垃圾郵件號碼的情況下,請考慮將規則命名為與要相符的數位模式相同,然後根據需要在描述中新增其他資訊。In the case of simply blocking spam numbers, consider naming the rule the same as the number pattern that's being matched and add additional information in the description as required.

模式是使用正則運算式與 (Regex) 進行相符。Patterns are matched using Regular Expressions (Regex). 在進行測試和驗證前,請先留出時間進行複製。Allow time for replication before you test and validate.

允許數位Allow a number

在這個範例中,需要身分 識別 參數。In this example, the Identity parameter is required.

Remove-CsInboundBlockedNumberPattern -Identity “<identity>”

如果身分識別不可知,請使用 CsInboundBlockedNumberPattern Cmdlet,先找出適當的模式,並記下身分識別。If the identity isn't known, use the Get-CsInboundBlockedNumberPattern cmdlet to first locate the proper pattern and note the identity. 然後,執行 CsTenantBlockedNumberPattern Cmdlet,並傳遞適當的身分識別值。Then, run the Remove-CsTenantBlockedNumberPattern cmdlet and pass the appropriate identity value.

在進行測試和驗證前,請先留出時間進行複製。Allow time for replication before you test and validate.

查看所有數位模式View all number patterns

執行此 Cmdlet 會傳回為租使用者輸入的所有封鎖號碼清單:Running this cmdlet returns a list of all blocked numbers that are entered for a tenant:

Get-CsInboundBlockedNumberPattern

使用內建的 PowerShell 篩選功能,根據需要分析傳回的值。Use built-in PowerShell filtering abilities to parse the returned values as required.

新增數位例外狀況Add number exceptions

您可以使用 [新增]、[取得]、[設定]、[移除 - CsTenantBlockNumberExceptionPattern ] Cmdlet,在封鎖的數位模式中新增例外狀況。You can add exceptions to blocked number patterns by using the New, Get, Set, Remove -CsTenantBlockNumberExceptionPattern cmdlets.

範例Examples

新增數位例外狀況Add a number exception

在這個範例中,會建立新的數位例外模式,而且預設會將模式新增為 [啟用]。In this example, a new number exception pattern is created and will by default add the pattern as enabled. [ 啟用 ] 和 [ 描述 ] 參數是選擇性的。The Enabled and Description parameters are optional.

New-CsTenantBlockedNumberExceptionPattern -Identity <XdsGlobalRelativeIdentity> -Tenant <GUID> -Pattern <String> -Enabled <bool> -Description <string>
New-CsTenantBlockedNumberExceptionPattern -Identity InternationalPrefix -Tenant daacb588-18ef-4f77-8c83-955af9615930 -Pattern "^011(\d*)$" -Description "Allow international prefix in US"  

查看所有數位例外狀況View all number exceptions

在這個範例中,身分 識別 參數是選擇性的。In this example, the Identity parameter is optional. 如果未指定身分 識別 參數,這個 Cmdlet 會傳回為租使用者輸入的所有數位例外模式清單。If the Identity parameter isn't specified, this cmdlet returns a list of all number exception patterns entered for a tenant.

Get-CsTenantBlockedNumberExceptionPattern -Identity <XdsGlobalRelativeIdentity> -Tenant <GUID>
Get-CsTenantBlockedNumberExceptionPattern -Tenant daacb588-18ef-4f77-8c83-955af9615930

修改數位例外狀況Modify a number exception

在這個範例中,身分 識別 參數是強制性的。In this example, the Identity parameter is mandatory. CsTenantBlockedNumberExceptionPattern Cmdlet 可讓您針對指定的數位模式身分修改一或多個參數。The Set-CsTenantBlockedNumberExceptionPattern cmdlet lets you modify one or more parameters for a given number pattern identity.

Set-CsTenantBlockedNumberExceptionPattern -Identity <XdsGlobalRelativeIdentity> -Tenant <GUID> -Enabled <bool> -Description <string> -Pattern <string> 
Set-CsTenantBlockedNumberExceptionPattern -Identity InternationalPrefix -Tenant daacb588-18ef-4f77-8c83-955af9615930  -Pattern "^022(\d*)$" 

移除數位例外狀況Remove a number exception

在這個範例中,需要身分 識別 參數。In this example, the Identity parameter is required. 這個 Cmdlet 會從租使用者清單中移除指定的數位模式。This cmdlet will remove the given number pattern from the tenant list. 如果身分識別不可知,請使用 CsInboundBlockedNumberPattern Cmdlet,先找出適當的模式,並記下身分識別。If the identity isn't known, use the Get-CsInboundBlockedNumberPattern cmdlet to first locate the proper pattern and note the identity. 然後,執行 CsTenantBlockedNumberExceptionPattern Cmdlet,並傳遞適當的身分識別值。Then, run the Remove-CsTenantBlockedNumberExceptionPattern cmdlet and pass the appropriate identity value.在進行測試和驗證前,請先留出時間進行複製。 Allow time for replication before you test and validate.

Remove-CsTenantBlockedNumberExceptionPattern -Identity <XdsGlobalRelativeIdentity> -Tenant <GUID>
Remove-CsTenantBlockedNumberExceptionPattern -Identity InternationalPrefix -Tenant daacb588-18ef-4f77-8c83-955af9615930

測試是否已封鎖某個數位Test whether a number is blocked

使用 CsInboundBlockedNumberPattern Cmdlet 來驗證租使用者中是否有一個數位被封鎖。Use the Test-CsInboundBlockedNumberPattern cmdlet to verify whether a number is blocked in the tenant.

在這個範例中, PhoneNumber 使用者參數是必要的。In this example, the PhoneNumber and Tenant parameters are required. PhoneNumber 參數應該是不含任何其他字元(例如 + 或-)的數值字串。The PhoneNumber parameter should be a numeric string without any additional characters such as + or -. 在 TRPS 中, 租使用者參數 是選擇性的。In TRPS, the Tenant parameter is optional. 如果該數位在租使用者中遭到封鎖,則所產生的 isNumberBlocked 參數會傳回 True 值,如果未封鎖,則傳回 False。The resulting isNumberBlocked parameter returns a value of True if the number is blocked in the tenant and False if it's not blocked.

Test-CsInboundBlockedNumberPattern –Tenant <GUID> -PhoneNumber <String>
Test-CsInboundBlockedNumberPattern -Tenant e09ad6bc-1d3c-4650-8cae-02f6c5a04b45 -PhoneNumber 4255550101
HTTPResponseCodehttpResponseCode isNumberBlockedisNumberBlocked errorMessageerrorMessage
200200 滿足True
Test-CsInboundBlockedNumberPattern -Tenant e09ad6bc-1d3c-4650-8cae-02f6c5a04b45 -PhoneNumber 6045550188
HTTPResponseCodehttpResponseCode isNumberBlockedisNumberBlocked errorMessageerrorMessage
200200 虛假False

關於 Regex 的筆記A note about Regex

如前所述,封鎖式呼叫者的模式相符是使用 Regex 來完成。As stated earlier, the pattern matching for blocking callers is done by using Regex. 有多個工具可供線上使用,以協助驗證 Regex 模式相符。Multiple tools are available online to help validate a Regex pattern match. 如果您不熟悉 Regex 模式,建議您花一些時間來熟悉基本概念。If you aren't familiar with Regex patterns, we recommend that you take some time to familiarize yourself with the basics. 若要確保您取得預期的結果,請在您將封鎖的新數位與您的租使用者加入之前,使用驗證模式相符的工具。To make sure you get expected results, use a tool for validating pattern matches before you add new blocked number matches to your tenant.