共用通話範例案例
閱讀本文之前,請確定您已閱讀 [ 共用通話方案 ] 和 [設定共用通話]。 這些文章說明授權需求、必要條件設定,以及如何設定共用通話原則。
本文提供設定共用通話的範例案例。 它提供下列步驟的 PowerShell 範例:
- 取得共用通話使用者。
- 為使用者啟用語音功能。
- 取得自動語音應答資源帳戶的電話號碼。
- 根據自動語音應答的電話號碼類型建立緊急通話路由原則。
- 在資源帳戶上設定靜態緊急位置。
- 建立共用通話原則。
- 將共用通話原則授與使用者。
共用通話 PowerShell 範例
# Get the Shared Calling user
$user = Get-CsOnlineUser -Identity user@contoso.com
## Enable voice for the user
Set-CsPhoneNumberAssignment -Identity user@contoso.com -EnterpriseVoiceEnabled $true
## Get the phone number of the Auto attendant resource account
$mainaa = 'main-aa@contoso.com'
$PhoneNumber=Get-CsPhoneNumberAssignment -AssignedPstnTargetId $mainaa
if ($PhoneNumber.NumberType -eq 'DirectRouting') {
# Define the emergency numbers for emergency calling
$en1=New-CsTeamsEmergencyNumber -EmergencyDialString 933 -OnlinePSTNUsage WW
$en2=New-CsTeamsEmergencyNumber -EmergencyDialString 911 -OnlinePSTNUsage WW
New-CsTeamsEmergencyCallRoutingPolicy -Identity TECRP-DR -EmergencyNumbers @{add=$en1,$en2} -AllowEnhancedEmergencyServices $true
# Grant the policy to the user
Grant-CsTeamsEmergencyCallRoutingPolicy -Identity $user -PolicyName TECRP-DR
}
else {
# Define the emergency numbers for emergency calling
$en1=New-CsTeamsEmergencyNumber -EmergencyDialString 933
$en2=New-CsTeamsEmergencyNumber -EmergencyDialString 911
New-CsTeamsEmergencyCallRoutingPolicy -Identity TECRP-CPOC -EmergencyNumbers @{add=$en1,$en2} -AllowEnhancedEmergencyServices $true
# Grant the policy to the user
Grant-CsTeamsEmergencyCallRoutingPolicy -Identity $user -PolicyName TECRP-CPOC
}
# Set the static emergency location on the resource account
$CivicAddress = Get-CsOnlineLisCivicAddress -City Seattle
Set-CsPhoneNumberAssignment -LocationId $CivicAddress.DefaultLocationId -PhoneNumber $PhoneNumber.TelephoneNumber
# Create the Shared Calling policy
$ecbn1 = '+14255556789'
$ecbn2 = '+14255554321'
$ra = Get-CsOnlineUser -Identity $mainaa
New-CsTeamsSharedCallingRoutingPolicy -Identity Seattle -ResourceAccount $ra.Identity -EmergencyNumbers @{add=$ecbn1,$ecbn2}
# Grant the Shared Calling policy to the user
Grant-CsTeamsSharedCallingRoutingPolicy -Identity $user -PolicyName Seattle