Enable resource account for outbound call in Microsoft Teams Call Queues and Auto Attendants

In this post I describe how you can configure call forwarding to external PSTN phone numbers for a call queue or auto attendant in a Microsoft Teams Direct Routing configuration. Microsoft released the capability to forward phone calls via a Teams Auto Attendant and via a Teams Call Queue to a phone number. Also, the operator can have a (external/PSTN) phone number.

In the past this was not feasible this way, therefore you had to implement a workaround by configuring a “forwarding user” to reach the goal. This is no longer necessary. I’ll show you some screenshots to depict what you’ve got now with Teams Calling and Microsoft 365 Phone System.

Teams Auto Attendant – Operator – External Phone Number Option

Teams Auto Attendant – Operator – External Phone Number Option

Teams Auto Attendant – Call Flow – External Phone Number Option

Teams Auto Attendant – Call Flow – External Phone Number Option

Teams Call Queue – Call Flow – Externa Phone Number Option/s

Within call queues you have two options to forward a call to a phone number. The first option helps to deal with more as the maximum set amount of concurrent calls in a queue. The second option helps to deal with calls waiting in a queue for a certain amount of time.

Teams Call Queue – Call Flow – Externa Phone Number Option/s

What do I have to do to make this work with Teams Direct Routing?

Easy, you have to do two things:

  1. assign a Virtual Phone System User license (!!!) (if not done yet) to the Teams Resource Account (also note the docs.microsoft.com statement saying, “Phone System licenses aren’t supported”, so assigning a E3 + phone system license might not work)
  2. assign an Online Voice Routing Policy to the resource account which is assigned to the call queue or auto attendant [with PowerShell]
  3. Wait for some time (as I was testing this, I configured this in the late afternoon and the next morning it was working as expected, this might be different and I’m not aware of a default duration till it is applied and will work)

I’ll not explain how to get and assign the license, I’ll explain the assignment of the Online Voice Routing Policy because at the time of writing this post, you have to assign the policy by using PowerShell.

Assign an Online Voice Routing Policy to a resource account

#Teams Direct Routing
#Enable resource account for outbound call in Microsoft Teams Call Queues and Auto Attendants
#Example code

Import-Module SkypeOnlineConnector

#Login
if ($cred -eq $null) {$cred = Get-Credential}
#W/O MFA: 
$sfbosession = New-CsOnlineSession -Credential $cred
#WITH MFA: 
#$SFBOsession= New-CsOnlineSession ADMIN-UPN
#Import module
Import-PSSession -Session $sfbosession -AllowClobber

#List Online Voice Routing Policies
Get-CsOnlineVoiceRoutingPolicy 

#Assign Online Voice Routing Policy to Microsoft Teams Resource Account for Teams Direct Routing
$user = "teams-resource-account@domain.tld"
$userovrp = "teams-direct-routing-online-voice-routing-policy"


Grant-CsOnlineVoiceRoutingPolicy -Identity $user -PolicyName $userovrp
#Get a cup or some more cups of coffee and wait!!!
#Check assignment 
Get-CsOnlineUser $user | select OnlineVoiceRoutingPolicy

<#Please note
although it's set quickly it can take quite some time till it is really applied, you can see this on the SBC SIP traces which still points to Teams phone system which is rejecting the referred call with a "403 Forbidden", it detail it states some like that there is no viable outbound route.
#>

Remove-PsSession $sfbosession

Conclusion, opinion and summary

I’ve been waiting for this for some time by now, and now that the feature is available, without creating a workaround, I like it. Especially, because you can also do some automation by using PowerShell for your cloud hotlines based on Microsoft Teams call queues and auto attendants.

Additional resources

8 comments

  1. Fabien Gaille

    Hi Erik and thank you for this post.

    Even if it’s already better than it used to be. I’m still struggling. Maybe you do have an idea… What I would like to achieve is the following :

    Based on Date / Hours, forward the call to someone, simultaneously on the mobile phone + Teams client. If no answers after 20 seconds, forward to someone else, also on mobile phone + Teams client.

    Even of S4B, forwarding to a mobile phone is a bit, the last step of a workflow and this is annoying as Hell. For the time being, I’m using a third party solution, AudioCodes IVR, which allow me to create the required workflow. I was wondering if I missed something ? Are for example, simultaneous ring possible on a PSTN phone number + Teams client ?

    Don’t tell me it’s not possible by design, to protect loop or so, we should have the ability to implement what we need…

    Thank you,
    Fabien

    • Erik

      Hello Fabien,

      You are welcome!

      What you could do is to create auto attendants configure business and out off hours dates/hours (as needed). So, that you have several auto attendants in place. No call queues. Instead of forwarding a call from an auto attendant to a external pstn number (during business hours), you forward the call to the Teams user directly. And in case one auto attendant is configured with out of business hours the call should go to another auto attendant (resource account) and get handled there.
      In each auto attendant you could configure the forwarding to the target Teams user (not to external (pstn) phone number!) and if the enterprise voice enabled teams user has his teams client open plus also configured a call forwarding rule to his pstn/mobile phone number, he’ll receive the call on both, teams client + phone number. The user could also just use the Teams client on his mobile device (as far as mobile internet is available).

      Please note, as far as I tested, you can use an auto attendant which forwards the call to a teams user and in case the teams user has call forwarding enabled to a pstn number, the pstn number will receive the call, afaik. This will not work if you forward the call from an auto attendant via call queue to the target teams user/s. Also to note, the forwarding mechanism can add latency to the call flow that’s why it should be tested thoroughly.
      Regarding the teams user call forwarding settings, there you can configure the 20 seconds with but than the call forwarding to the mobile / pstn will not work because of the 20 second time which only applies to the call forwarding settings (“Ring for this many seconds before redirecting”) and not for the (“if unanswered”) mechanism. However, you could tweak this and send calls to (“if unanswered”) to the voicemail but instead of (“Let the caller record a message”) in the teams user voicemail settings, you or the Teams user can choose to (“Transfer the call to someone else”) either a pstn phone number or Teams user can be used here, afaik. This is really not easy for users to cope with and includes some other tradeoffs, e.g. no more active voicemail to record messages.

      If you are looking for something more interactive where users might interact with a call queue, you might find the post from Luca Vitali helpful, too. https://lucavitali.wordpress.com/2020/11/23/how-to-use-lightweight-bot-and-azure-automation-to-interact-with-teams-call-queue/

      I hope this helps.

      Best Regards
      Erik

    • Fabien Gaille

      Thank you very much Erik,

      I’m not able to answer your comment so I create a new one… 😀

      What a mess… I can’t implement that at all. For the time being, the guys in charge of customer support can login to our AudioCodes system and define in less than a minute, who are the first and backup engineer (Change every weekend and holidays). But I’ll also check your link, I know Luca’s blog and it’s quite often really helpful.

      Maybe something else you may know, I’m able to do the same with AudioCodes and Teams, simultaneous ring on Teams client and mobile phone but when I try to pick up the call on Teams, I get the following : Sorry we couldn’t connect you => The call is droped. I haven’t checked the Teams logs yet, I’m just wondering if you have magic ideas 🙂

      Thank you and take care,
      Fabien

      • Erik

        Regarding the call drop, this is hard to guess without any data.
        I’d recommend to take a look into the Audiocode SBC syslogs for sip tracing. There you should see the sequence diagram and this usually helps to figure out why a call is being dropped.
        Maybe a reason code or a SIP code will tell why. No magic idea 😉

        Thank you and take care, too,
        Erik

  2. Quati

    Hi Erik!

    I was expecting this functionality as well.
    But I configured it as you did 2 days ago, and it still doesn’t work. I still get a “SIP/2.0 403 Forbidden” when auto attendant try to transfer to external number.

    “REASON: Q.850;cause=63;text=”925e1bf9-6eaa-4f5d-a82a-6ba88d91112a;User is not Enterprise Voice enabled. User is not allowed to make user based dial out.”
    I’m using AudioCodes in an Azure VM (POC server).

Comment / Kommentar verfassen

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.