Forum Discussion
Powershell for creating a Auto Attendant
Hello
I would like to create an Auto Attendant through Powershell.
The command is New-CsAutoAttendant
Teams keeps asking about the DefaultCallFlow.
I would like to hardcode the command like this:
New-CsAutoAttendant -Name "xx" -LanguageId "fr-FR" -TimeZoneId "Romance Standard Time"
How do I add the DefaultCallFlow and then redirect it to an external number
Regards
JFM_12
Hello @JFM_12, To create a Teams Auto Attendant with New-CsAutoAttendant and redirect calls to an external number, you must define a DefaultCallFlow object that includes a call transfer action.
Here’s how you can do it in PowerShell:
# Define the external number (must be in E.164 format, e.g., +33123456789 for France) $externalNumber = "+33XXXXXXXXX" # Create the call transfer action $transferTarget = New-CsAutoAttendantCallableEntity -Identity $externalNumber -Type ExternalPstn $callTransferAction = New-CsAutoAttendantCallTransferAction -TransferTarget $transferTarget # Create the call flow with the transfer action $defaultCallFlow = New-CsAutoAttendantCallFlow -Name "Default" -Greetings @() -Menu $null -Actions $callTransferAction # Create the Auto Attendant New-CsAutoAttendant -Name "xx" ` -LanguageId "fr-FR" ` -TimeZoneId "Romance Standard Time" ` -DefaultCallFlow $defaultCallFlow
Reference Document-
1. New-CsAutoAttendant (MicrosoftTeamsPowerShell) | Microsoft Learn
2.New-CsAutoAttendantCallFlow (MicrosoftTeamsPowerShell) | Microsoft Learn
4 Replies
- Sayali-MSFT
Microsoft
Hello @JFM_12, To create a Teams Auto Attendant with New-CsAutoAttendant and redirect calls to an external number, you must define a DefaultCallFlow object that includes a call transfer action.
Here’s how you can do it in PowerShell:
# Define the external number (must be in E.164 format, e.g., +33123456789 for France) $externalNumber = "+33XXXXXXXXX" # Create the call transfer action $transferTarget = New-CsAutoAttendantCallableEntity -Identity $externalNumber -Type ExternalPstn $callTransferAction = New-CsAutoAttendantCallTransferAction -TransferTarget $transferTarget # Create the call flow with the transfer action $defaultCallFlow = New-CsAutoAttendantCallFlow -Name "Default" -Greetings @() -Menu $null -Actions $callTransferAction # Create the Auto Attendant New-CsAutoAttendant -Name "xx" ` -LanguageId "fr-FR" ` -TimeZoneId "Romance Standard Time" ` -DefaultCallFlow $defaultCallFlow
Reference Document-
1. New-CsAutoAttendant (MicrosoftTeamsPowerShell) | Microsoft Learn
2.New-CsAutoAttendantCallFlow (MicrosoftTeamsPowerShell) | Microsoft Learn- JFM_12Iron Contributor
Hi Sayali-MSFT
Great thank you.
It worked
Regards
Juan- Sayali-MSFT
Microsoft
Hello JFM_12,
Glad to hear that your issue is resolved
We would appreciate it if you could share your valuable feedback via the Microsoft Teams Developer Community Response Feedback link?
- Sayali-MSFT
Microsoft
Hello @JFM_12,Thank you for bringing this issue to our attention. We will look into it and get back to you shortly.