建立和管理撥號對應表

在您為組織規劃撥號對應表,並找出所有需要針對語音路由建立的正規化規則之後,就可以建立撥號對應表了。 有了具有有效 Teams 授權的系統管理員帳戶,您可以使用 Microsoft Teams 系統管理中心或 Windows PowerShell 來建立和管理撥號對應表。

使用 Microsoft Teams 系統管理中心

建立撥號對應表

  1. 在 Microsoft Teams 系統管理中心的左側導覽畫面中,移至 [語音>撥號對應表]

  2. 選取 [新增],然後輸入撥號對應表的名稱和描述。

  3. 在 [ 正規化規則] 下,針對撥號對應表設定一或多個 正規化規則 並建立關聯。 每個撥號對應表必須至少有一個與它相關聯的正規化規則。 若要這麼做,請執行下列一或多項操作:

    • 若要建立新的正規化規則並將它與撥號對應表建立關聯,請選取 [ 新增],然後定義規則。
    • 若要編輯已經與撥號對應表相關聯的正規化規則,請按下規則名稱的左邊來選取規則,然後選取 [ 編輯]。 進行您想要的變更,然後選取 [ 儲存]
    • 若要從撥號對應表移除正規化規則,請按下規則名稱的左邊來選取規則,然後選取 [刪除]
  4. 依照您想要的順序排列正規化規則。 選 取 [上移][下移 ] 以變更規則在清單中的位置。

    注意事項

    Teams 會從上到下周轉正規化規則清單,並使用第一個符合撥號的規則。 如果您設定撥號對應表,讓撥號號碼可以比對一個以上的正規化規則,請確定較嚴格的規則排序會高於較不嚴格的限制規則。 如果您設定的撥號對應表會將撥號號碼正規化,但不使用 “+”,通話服務將會嘗試使用租使用者和地區撥號對應規則,將號碼再度正規化。 若要避免雙正規化,建議所有正規化規則都會產生以 「+」 開頭的數位。 直接路由客戶可以視需要使用 主幹翻譯 規則來移除 「+」。

  5. 選取 [儲存]

  6. 如果您想要測試撥號對應表,請在 [測試撥號對應表] 底下輸入電話號碼,然後選取 [ 測試]

編輯撥號對應表

  1. 在 Microsoft Teams 系統管理中心的左側導覽畫面中,移至 [語音>撥號對應表]
  2. 按兩下撥號對應表名稱的左邊來選取撥號對應表,然後選取[ 編輯]
  3. 進行您要的變更,然後選取 [儲存 ]

指派撥號對應表給使用者

您指派撥號對應表的方式與指派原則相同。 您可以直接指派原則給使用者,無論是個別指派或透過批處理指派 (如果支持原則類型) ,或如果支持原則類型,使用者是 (的群組) .To 瞭解您可以指派原則給使用者的不同方式,請參閱 在 Teams 中指派原則給使用者

使用 PowerShell

啟動 PowerShell

開啟 Windows PowerShell 命令提示字元並執行下列命令:

  # When using Teams PowerShell Module

   Import-Module MicrosoftTeams
   $credential = Get-Credential
   Connect-MicrosoftTeams -Credential $credential

建立及管理您的撥號對應表

您可以使用單一 Cmdlet 或 PowerShell 腳本來建立和管理租使用者撥號對應表。

使用單一 Cmdlet

  • 若要建立新的撥號對應表,請執行下列腳本:

    New-CsTenantDialPlan -Identity RedmondDialPlan -Description "Dial Plan for Redmond" -NormalizationRules <pslistmodifier> -SimpleName "Dial-Plan-for-Redmond"
    

    如需其他範例和參數,請參閱 New-CsTenantDialPlan

  • 若要編輯現有撥號對應表的設定,請執行下列腳本:

    Set-CsTenantDialPlan -Identity RedmondDialPlan  -NormalizationRules <pslistmodifier> -SimpleName "Dial-Plan-for-Redmond"
    

    如需其他範例和參數,請參閱 Set-CsTenantDialPlan

  • 若要將使用者新增至撥號對應表,請執行下列腳本:

    Grant-CsTenantDialPlan -Identity amos.marble@contoso.com -PolicyName RedmondDialPlan
    

    如需其他範例和參數,請參閱 Grant-CsTenantDialPlan

  • 若要檢視撥號對應表上的設定,請執行下列腳本:

    Get-CsTenantDialPlan -Identity RedmondDialPlan
    

    如需其他範例和參數,請參閱 Get-CsTenantDialPlan

  • 若要刪除撥號對應表,請執行下列腳本:

    Remove-CsTenantDialPlan -Identity RedmondDialPlan -force
    

    如需其他範例和參數,請參閱 Remove-CsTenantDialPlan

  • 若要查看有效撥號對應表的設定,請執行下列腳本:

    Get-CsEffectiveTenantDialPlan -Identity amos.marble@contoso.com
    

    如需其他範例和參數,請參閱 Get-CsEffectiveTenantDialPlan

  • 若要測試撥號對應表的有效設定,請執行:

    Test-CsEffectiveTenantDialPlan -DialedNumber 14255550199 -Identity amos.marble@contoso.com
    

    如需其他範例和參數,請參閱 Test-CsEffectiveTenantDialPlan

使用 PowerShell 腳本

執行此腳本以刪除與租使用者撥號對應表相關聯的正規化規則,而不需要先刪除租使用者撥號對應表:

$b1=New-CsVoiceNormalizationRule -Identity Global/NR4 -InMemory
Set-CsTenantDialPlan -Identity RedmondDialPlan -NormalizationRules @{add=$b1}
(Get-CsTenantDialPlan -Identity RedmondDialPlan).NormalizationRules
$b2=New-CsVoiceNormalizationRule -Identity Global/NR4 -InMemory
Set-CsTenantDialPlan -Identity RedmondDialPlan -NormalizationRules @{remove=$b2}

執行此腳本以將下列正規化規則新增至名為 RedmondDialPlan 的現有租使用者撥號對應表:

$nr1=New-CsVoiceNormalizationRule -Parent Global -Description 'Organization extension dialing' -Pattern '^(\\d{3})$' -Translation '+14255551$1' -Name NR1 -IsInternalExtension $false -InMemory
Set-CsTenantDialPlan -Identity RedmondDialPlan -NormalizationRules @{add=$nr1}

執行此腳本以從名為 RedmondDialPlan 的現有租使用者撥號對應表中移除下列正規化規則:

$nr1=New-CsVoiceNormalizationRule -Identity Global/NR1 -InMemory
Set-CsTenantDialPlan -Identity RedmondDialPlan -NormalizationRules @{remove=$nr1}

當您想要同時檢查現有的正規化規則、決定要刪除哪一個規則,然後使用其索引移除時,請執行下列腳本。 正規化規則陣列的開頭是索引 0。 我們想要移除 3 位數正規化規則,因此索引 1。

(Get-CsTenantDialPlan RedmondDialPlan).NormalizationRules
Description         : 4-digit
Pattern             : ^(\\d{4})$
Translation         : +1426666$1
Name                : NR2
IsInternalExtension : False

Description         : 3-digit
Pattern             : ^(\\d{3})$
Translation         : +14255551$1
Name                : NR12
IsInternalExtension : False

$nr1=(Get-CsTenantDialPlan RedmondDialPlan).NormalizationRules[1]
Set-CsTenantDialPlan -Identity RedmondDialPlan -NormalizationRules @{remove=$nr1}

執行此腳本以尋找已獲授與 RedmondDialPlan 租使用者撥號對應表的所有使用者。

Get-CsOnlineUser | Where-Object {$_.TenantDialPlan -eq "RedmondDialPlan"}

執行此腳本以移除所有擁有 HostingProvider 之 sipfed.online.lync.com 使用者的任何指派租使用者DialPlan。

Get-CsOnlineUser -Filter {HostingProvider -eq "sipfed.online.lync.com"} | Grant-CsTenantDialPlan -policyname $null

執行這些動作以將名為 OPDP1 的現有內部部署撥號對應表新增為貴組織的租使用者撥號對應表。 您必須先將內部部署撥號對應表儲存到 .xml 檔案,然後使用它來建立新的租使用者撥號對應表。

  • 在 商務用 Skype Server 管理命令介面內部部署中執行此腳本,將內部部署撥號對應表儲存到 .xml 檔案。

    $DPName = "OPDP1"
    $DPFileName = "dialplan.xml"
    Get-CsDialplan $DPName | Export-Clixml $DPFileName
    
  • 在 Teams PowerShell 模組在線執行此腳本,以建立新的租使用者撥號對應表。

    $DPFileName = "dialplan.xml"
    $dp = Import-Clixml $DPFileName
    $NormRules = @()
    ForEach($nr in $dp.NormalizationRules)
    {
     $id1 = "Global/" + $nr.Name
     $nr2 = New-CsVoiceNormalizationRule -Identity $id1 -Description $nr.Description -Pattern $nr.Pattern -Translation $nr.Translation -IsInternalExtension $nr.IsInternalExtension -InMemory
     $NormRules += $nr2
    }
    New-CsTenantDialPlan -Identity $dp.SimpleName -Description $dp.Description -SimpleName $dp.SimpleName -NormalizationRules $NormRules