VoIP:Teams:Debug: Difference between revisions

From VTX Public Wiki

(Move Content of Debug Section in a subpage)
 
(→‎Verify User setup using Powershell: Update debug command for new version)
 
(4 intermediate revisions by one other user not shown)
Line 125: Line 125:
{{Notice|1=You can use these powershell commands too verify all your users do have a valid MS Teams license enabled ( that enables EnterpriseVoiceEnabled ) and also have the correct OnlineVoiceRoutingPolicy}}
{{Notice|1=You can use these powershell commands too verify all your users do have a valid MS Teams license enabled ( that enables EnterpriseVoiceEnabled ) and also have the correct OnlineVoiceRoutingPolicy}}


<source lang="powershell">
# Set Variables
# Set Variables
$MSTeamsDomain = "123456.teams.ipvoip.ch"
$TeamsDomain = "123456.teams.ipvoip.ch"
$MSteamsAdminUser = "admin@COMPANY.onmicrosoft.com"
# Connect to Microsoft Teams management and assign number and profile to the user
# Connect to Microsoft Teams management and assign number and profile to the user
Connect-MicrosoftTeams
$Session = New-CsOnlineSession -UserName $MSteamsAdminUser
# Verify all users with correct setup using CsOnlineVoiceRoutingPolicy-$TeamsDomain
Import-PSSession $Session -AllowClobber
Get-CsOnlineUser | Where-Object {($_.enterprisevoiceenabled -eq $true) -and ($_.OnlineVoiceRoutingPolicy -Match "^CsOnlineVoiceRoutingPolicy-$TeamsDomain$") } | Select sipaddress,InterpretedUserType,HostedVoicemailPolicy,OnlineVoiceRoutingPolicy,LineUri | Format-List
# Verify all users with correct setup using CsOnlineVoiceRoutingPolicy-$MSTeamsDomain
Get-CsOnlineUser ` -Filter {(enterprisevoiceenabled -eq $true) -and(HostingProvider -eq "sipfed.online.lync.com")} ` | Select EnterpriseVoiceEnabled,sipaddress,OnPremLineURI,OnlineVoiceRoutingPolicy,RegistrarPool | Format-List
SipAddress : sip:bob.razovski@vtx-telecom.ch
EnterpriseVoiceEnabled : True
InterpretedUserType : HybridOnlineTeamsOnlyUser
SipAddress : sip:user1@myoffice.onmicrosoft.com
HostedVoicemailPolicy :
OnPremLineURI : tel:+41215660011
OnlineVoiceRoutingPolicy : CsOnlineVoiceRoutingPolicy-123456.teams.ipvoip.ch
OnlineVoiceRoutingPolicy : CsOnlineVoiceRoutingPolicy-123456.teams.ipvoip.ch
RegistrarPool : sippoolAM42E08.infra.lync.com
LineUri : tel:+41215661234
SipAddress : sip:hello.man@vtx-telecom.ch
EnterpriseVoiceEnabled : True
InterpretedUserType : HybridOnlineTeamsOnlyUser
SipAddress : sip:user2@myoffice.onmicrosoft.com
HostedVoicemailPolicy :
OnPremLineURI : tel:+41215660012
OnlineVoiceRoutingPolicy : CsOnlineVoiceRoutingPolicy-123456.teams.ipvoip.ch
OnlineVoiceRoutingPolicy : CsOnlineVoiceRoutingPolicy-123456.teams.ipvoip.ch
RegistrarPool : sippoolAM42E08.infra.lync.com
LineUri : tel:+41215661235
</source>
EnterpriseVoiceEnabled : True
SipAddress : sip:user3@myoffice.onmicrosoft.com
OnPremLineURI : tel:+41215660013
OnlineVoiceRoutingPolicy : CsOnlineVoiceRoutingPolicy-123456.teams.ipvoip.ch
RegistrarPool : sippoolAM42E08.infra.lync.com
# Logout
Get-PSSession | Remove-PSSession


=== Verify User setup using Teams Admin Web Interface ===
=== Verify User setup using Teams Admin Web Interface ===
Line 198: Line 189:
</td></tr>
</td></tr>
</table>
</table>

== Frequent Errors ==

=== New-CsOnlineVoiceRoutingPolicy - Cannot find specified Online PSTN usage ===

* '''Problem''': When we run the script to create the call routing, you might get a red error that New-CsOnlineVoiceRoutingPolicy is not working
* '''Symptoms''': When running the script to create the call routing, you might get an error "Cannot find specified Online PSTN usage"
* '''Possible Explanation''': MS Teams platform is getting some delay and between the time we create the Online PSTN usage and the time we use it in Online Voice Routing Policy, we need to wait for Teams platform to get up to date
* '''Solution''': Wait up to 4h and try again to use the script again


''As you can see after some time, the same command did work''
<table>
<tr><td>
[[Image:Teams-script-error-Cannot-Find-Online-PSTN-Usage.png|thumb|1200px|left|Teams Error - Cannot Find Online PSTN Usage - Wait a few hours and try again]]
</td></tr>
</table>

=== Cannot Import Module SkypeOnlineConnector ===

* '''Information''': By default, it is not allowed to execute powershell scrip on a Windows PC, you need to explicitly allow it
* '''Problem''': If you did not follow the Microsoft documentation while installing the SkypeOnlineConnector module, you will not be able to import it
* '''Symptoms''': You will get the powershell error below
* '''Solution''': Open a powershell prompt as admin and set "Set-ExecutionPolicy RemoteSigned -Force" ( cf below )
* '''Additional Information''': cf https://docs.microsoft.com/en-us/SkypeForBusiness/set-up-your-computer-for-windows-powershell/download-and-install-windows-powershell-5-1


''Confirmation of the problem, here Execution Policy is Restricted, i.e disabled''
<source lang="powershell">
Get-ExecutionPolicy
Restricted
</source>

''Solution''
<source lang="powershell">
Set-ExecutionPolicy RemoteSigned -Force

Get-ExecutionPolicy
RemoteSigned
</source>


''Error that you are getting''
<source lang="powershell">
Modules d'importation : Le fichier "C:\Program Files\Common Files\Skype for Business
Online\Modules\SkypeOnlineConnectorSkypeOnlineConnectorStartup.psm1" ne peut pas être chargé, car l'exécution de
Les scripts sont désactivés sur ce système. Pour plus d'informations, voir "about_Execution_Policies".
(https:/go.microsoft.com/fwlink/?LinkID=135170).
En ligne:1 Caractère:1
+ modules d'importation "C:\Program Files\Common Files\Skype for Business Onlin ...


+ CategoryInfo : Erreur de sécurité : ( 🙂 [Modules d'importation], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand
</source>


=== Get-CsOnlinePowerShellEndpoint : The remote name could not be resolved: 'lyncdiscover.xxx' ===

* '''Problem''' : You get an red colored error when using the scripts
* '''Symptoms''': When starting to use a powershell script or command, you get an error like Get-CsOnlinePowerShellEndpoint : The remote name could not be resolved: 'lyncdiscover.xxx'
* '''Possible Explanation''': You are using an admin account where needed lyncdiscover.$DOMAIN DNS entry is not set correctly
* '''Solution''': Please verify and dix your Admin account DNS setup
* '''Workaround''' : Add the suffix "-OverrideAdminDomain $MSTeamsDomain" to the New-CsOnlineSession command

Latest revision as of 15:44, 14 November 2022


Start powershell script in Command Line to be able to see the errors[edit | edit source]

  • Problem: If you enter wrong credentials, or wrong domain, or if the domain or user is not yet ready on Microsoft side, you might get an error that disappears too quickly
  • Solution: use the powershell -File file.ps1 command to be able to see the errors


  1. Start a "cmd" ( Start menu and enter "cmd" + Enter to display the Black Window
  2. Use the command powershell -File file.ps1 ( replacing file.ps1 with the correct path of the ps1 file )
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

H:\>c:

C:\>powershell -File "C:Users\bob\Desktop\VTX_Connect_Teams_Create_Routing_Rules
.ps1"
VTX Teams Connect domain name is XXXX.teams.ipvoip.ch
VTX Teams Admin Username is vtxadmin@XXXX.teams.ipvoip.ch
Connecting to Microsoft Online Management with the credentials you provided
Get-CsOnlinePowerShellEndpoint : The remote name could not be resolved:
'lyncdiscover.xxxx.teams.ipvoip.ch'
At C:\Program Files\Common Files\Skype for Business
Online\Modules\SkypeOnlineConnector\SkypeOnlineConnectorStartup.psm1:149
char:26
+ ... targetUri = Get-CsOnlinePowerShellEndpoint -TargetDomain $adminDomain ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-CsOnlinePowerShellEndpoin
   t], WebException
    + FullyQualifiedErrorId : System.Net.WebException,Microsoft.Rtc.Management
   .OnlineConnector.GetPowerShellEndpointCmdlet


C:\>powershell -File "C:Users\bob\Desktop\VTX_Connect_Teams_Create_Routing_Rules
.ps1"


Verify Voice Routing[edit | edit source]

To verify Voice Routing, you can either use Powershell command lines or check from Admin Teams Web interface in the following 2 sections

Verify Voice Routing using Powershell[edit | edit source]

PS H:\> Get-CsOnlinePstnUsage
Identity : Global
Usage    : {CsOnlinePstnUsage-123456.teams.ipvoip.ch}


PS H:\> Get-CsOnlineVoiceRoute

Identity              : CsOnlineVoiceRoute-123456.teams.ipvoip.ch
Priority              : 0
Description           :
NumberPattern         : .*
OnlinePstnUsages      : {CsOnlinePstnUsage-123456.teams.ipvoip.ch}
OnlinePstnGatewayList : {123456.teams.ipvoip.ch}
Name                  : CsOnlineVoiceRoute-123456.teams.ipvoip.ch


PS H:\> Get-CsOnlineVoiceRoutingPolicy

Identity         : Global
OnlinePstnUsages : {}
Description      :
RouteType        : BYOT

Identity         : Tag:CsOnlineVoiceRoutingPolicy-123456.teams.ipvoip.ch
OnlinePstnUsages : {CsOnlinePstnUsage-123456.teams.ipvoip.ch}
Description      :
RouteType        : BYOT


PS H:\> Get-CsCallingLineIdentity

Identity                  : Global
Description               :
EnableUserOverride        : True
ServiceNumber             :
CallingIDSubstitute       : LineUri
BlockIncomingPstnCallerID : False

Verify Voice Routing using Teams Admin Web Interface[edit | edit source]

  1. Verify Voice Routing Rule
    1. Connect to https://admin.teams.microsoft.com/direct-routing/v2/voice-routes and verify the routing rule (cf screenshot)
  2. Verify Voice Routing Policy
    1. Connect to https://admin.teams.microsoft.com/policies/teamsonlinevoicerouting and verify Voice Routing policy (cf screenshot )
    2. Name should be CsOnlineVoiceRoutingPolicy-<service_nummber>.teams.ipvoip.ch
    3. PSTN Usage Record should be CsOnlinePstnUsage-<service_nummber>.teams.ipvoip.ch


Microsoft Teams Admin - Verify Routing Rule
Microsoft Teams Admin - Verify Routing Policy
Microsoft Teams Admin - Verify PSTN Usage record

Verify User Setup[edit | edit source]

To verify User setup, you can either use Powershell command lines or check from Admin Teams Web interface in the following 2 sections

Verify User setup using Powershell[edit | edit source]

 # Set Variables
 $TeamsDomain = "123456.teams.ipvoip.ch"
 
 # Connect to Microsoft Teams management and assign number and profile to the user
 Connect-MicrosoftTeams
 # Verify all users with correct setup using CsOnlineVoiceRoutingPolicy-$TeamsDomain
 Get-CsOnlineUser | Where-Object {($_.enterprisevoiceenabled -eq $true) -and ($_.OnlineVoiceRoutingPolicy -Match "^CsOnlineVoiceRoutingPolicy-$TeamsDomain$") } | Select sipaddress,InterpretedUserType,HostedVoicemailPolicy,OnlineVoiceRoutingPolicy,LineUri | Format-List
 
 SipAddress               : sip:bob.razovski@vtx-telecom.ch
 InterpretedUserType      : HybridOnlineTeamsOnlyUser
 HostedVoicemailPolicy    :
 OnlineVoiceRoutingPolicy : CsOnlineVoiceRoutingPolicy-123456.teams.ipvoip.ch
 LineUri                  : tel:+41215661234
 
 SipAddress               : sip:hello.man@vtx-telecom.ch
 InterpretedUserType      : HybridOnlineTeamsOnlyUser
 HostedVoicemailPolicy    :
 OnlineVoiceRoutingPolicy : CsOnlineVoiceRoutingPolicy-123456.teams.ipvoip.ch
 LineUri                  : tel:+41215661235

Verify User setup using Teams Admin Web Interface[edit | edit source]

  1. Verify user licenses
    1. Connect to https://admin.microsoft.com/AdminPortal/Home#/users and verify that your user does have a "Microsoft Teams" license and a "Microsoft 365 Phone System" license
    2. Verify in https://admin.microsoft.com/AdminPortal/Home#/teamsprovisioning that your user Teams license provisioning is finished ( it can take several hours )
  2. Verify user number
    1. Connect to https://admin.teams.microsoft.com/users and verify that "Phone Number" has been correctly setup via powershell
  3. Verify user routing rules
    1. Connect to https://admin.teams.microsoft.com/user and select your user
    2. Go in the Policies tab section and look at the last entry "Voice routing policy", is should be CsOnlineVoiceRoutingPolicy-<service_number>.teams.ipvoip.ch
Microsoft Admin - Verify User license
Microsoft Admin - Verify Teams provisioning status
Microsoft Teams Admin - Verify user number
Microsoft Teams Admin - Verify user voice routing policy

Verify number provisioning in MS Teams app[edit | edit source]

  1. Verify the number on the MS Teams app
    1. Open the MS Teams app
    2. Go in the Calls section ( if you do not see it, then the "Phone System" license is not correctly set )
      1. (Mobile) You might get a popup informing that you have a new license and that app needs to be restarted
      2. (PC) Restart is not supposed to be needed, if you have waited a long time, please try to exit the app and start it back
    3. Verify that you can see the phone number in the Call section and that you can pass incoming and outgoing calls


Microsoft Teams App - Verify user number