Enable “HD” AMR Calling on Teams Direct Routing with Ribbon SBC and Telstra SIP

By | November 15, 2020

Update: Telstra has officially stated that AMR is “Not Supported” on TIPT for Trunking (Sip Connect). The article I link to below is for their hosted call centre product.
However, the Broadsoft Switch at the Telstra TIPT core will just pass along whatever it receives, so whilst it will “work” you may not get support and may have to deactivate AMR if raising a support case.
Follow at your own risk

Ever made a call from one mobile to another and enjoyed that sweet sweet HD call quality?

Crystal Clear…

Well, you’re not alone! Many users have been embracing the higher call quality offered by VoLTE and VoWiFi implementations offered by smartphone vendors thanks to native support from carriers.

At the core of this quality, improvement is of course a newish codec.

G722.2

G722.2 AMR or AMR for short is a (relatively) new wideband codec to better carry large amounts of audio data over 3G networks. And includes features mainly suited to carriers, like discontinuous transmission and octet alignment for better efficiency on cellular networks.

I say it’s a “newish” codec, but it’s actually been around since 3G rolled around. It is, however, still pretty young in comparison to g711 (1972!) which is basically ISDN shoved into packets. Still, it’s not as new as Silk, Satin or Opus.

G722.2 is a big deal as it has become the “defacto” standard for HD calling between carriers, especially when it comes to mobile calls.

Telstra actually added support for AMR for VoLTE/VoWiFi back in 2017 and, back then, if you had a misconfigured SBC, it would wreck all sorts of havoc in SfB response groups. (Long story short, disable G722 on your ITSP side)

But Skype and Teams don’t support AMR?

Well, yes. The Skype Mediation Server doesn’t support anything but g711. But, when you Media Bypass, you can use a whole bunch of codecs including SILK which is an amazing wideband codec, based off the free OPUS codec which has its roots in the original Skype.

Microsoft Teams, also supports SILK via Direct Routing nativley!

So lets go through everything we need to do to start transcoding AMR calls into SILK, right now.

Prerequisites

A Ribbon SBC with;

  • Enough DSP power to transcode SILK and AMR calls (estimates below)
    • SBC 1000 w/3 DSPs ~ 28 HD calls
    • SBC 2000 w/4 DSPs ~ 160 HD calls
    • SWe Lite w4 vCpu’s ~ 150 HD calls
    • Azure SWe Lite ~ 133 HD calls
    • (These are estimates based on 2/3’s of DSP performance using SILK WB to AMR-NB instead of g711), these are not official numbers
    • More information on SBC units here and SWe Lite units here (Requires Login)
  • SILK licences on your SBCs
    • As of November 2020, these are free
    • Ask your reseller
  • AMR Support Licence on your SBC
    • You only need 1 AMR licence to enable AMR support.
    • (Don’t get a 1 million dollar quote as I did)
  • Telstra Enterprise SIP Trunk (or another carrier that supports AMR)

Licence Setup

Start off by getting your new licenses from your Ribbon reseller into the SBC. Navigate to Settings > System > Licensing > Install New License and paste your new License Key in the box and press Decode

Make sure you use Decode first to ensure you aren’t losing any features you need.

In this case, you can see I still have my SIP calling license. But I now also have AMR-WB and SILK licenses as well

Scroll back up and hit Apply. Then reboot the SBC using your normal process.

Setting up the Codec profiles

We will be setting up 3 codec profiles

  • SILK for Teams and Skype4B
  • AMR-VoWifi for Carrier VoWiFi calls
  • AMR-VoLTE for Carrier VoLTE calls

Head over to Settings > Media > Media Profiles and click Create Media Profile > Voice Codec Profile

In the Create Voice Codec Profile window use the following settings

SILK

SettingValue
DescriptionSILK
CodecSILK
Rate2000 0
Use FECTrue
Settings for SILK codec

Repeat the process and create the additional profiles for AMR using the following settings.

AMR-VoWiFi

SettingValue
DescriptionAMR-VoWiFi
CodecG.722.2
Rate15850
Payload Type96
Codec Settings for VoWiFi

AMR-VoLTE

SettingValue
DescriptionAMR-VoLTE
CodecG.722.2
Rate8850
Payload Type97
Codec Settings for VoLTE

Note: The above settings are correct for Telstra Enterprise SIP at the time of writing. If in doubt, or you’re using another carrier. Inspect an invite from the carrier to see what codecs they support.

When your done, you should have a Media Profiles list similar to below.

Media Lists

Okay, now we have set up the Media Profiles, We need to add those profiles to the associated Media Lists.

Go to your ITSP Signaling Group and check what Media List it’s using,

Navigate to Settings > Signaling Groups > (ITSP Signaling Group Name) and note the Media List ID in the Media Properties.

Whilst you’re here, you should also check that DSP is enabled in the Supported Audio/Fax Modes

Repeat the process for your Teams Signaling Group and note down its Media List ID

Now, lets update the Media List for your ITSP by navigating to Settings > Media > Media List > ITSP Media List

In the ITSP Media List, click on Add/Edit button, select the G.722 codecs and click OK.

Once that’s completed, use the Up and Down buttons to re-arrange the codecs in the same order in the image below and click Apply

g729 is an evil codec and should burn in hell.

Repeat the process for the Teams Media List as well, this time including SILK as well as the AMR codecs.

Testing

Now that we have the Media Lists configured and assigned to the Signalling Groups, we can test the calling.

Grab a mobile phone, ideally on the same carrier as your ITSP. Ensure VoLTE and VoWiFi are enabled and make a test call to your Teams Number.

In this example, my Android Phone displays an HD notification when using VoLTE and negotiating AMR.

Here’s an example without the HD marking for a G711 call.

If we look at the LX logs we can also see AMR is also proposed and accepted in the Invite.

Success

The technical bits explained

Okay, so I’ve told you how to set it up. But how does it work?
Well, I’ve given a few talks on how SIP itself works so feel free to check them out over at 365May’s YouTube channel. But let’s break all this down.

Transcoding

Before we get too deep into it. It’s important to note that Telstra (and in fact, most carriers) will not Transcode (change) one codec to another, as it’s very computationally expensive. Scale that to hundreds of thousands of calls and it becomes costly to deploy and maintain these systems.

So instead they use Media Relay, which means the SBC’s at the carrier will pass a list of allowed codecs between two endpoints, and facilitate the communication between them. But honestly doesn’t care what’s inside the packets.

Think of it like the post office, you and someone else agree to send letters to each other and you’re going to use English in those letters. The post office expects you to write English on the outside of the letter so they understand it, but they don’t know what’s inside.

Because the carrier doesn’t speak SILK, and Teams doesn’t speak AMR. we use the SBC’s built in DSP’s to convert one audio format to another.

Airtime?

Why is this important? Well, before Smartphones came along. Carriers (in Australia at least) still used to talk to each other via ISDN trunking circuits. meaning G711 was the best you could get, as that’s easy to convert to and from. If a call came from another carrier and you only supported G729… You didn’t get that call.

Smartphones and the push for VoLTE and VoWiFi pushed carriers to natively support these codecs as they are bandwidth and more importantly airtime efficient.

It uses considerably less airtime to pump your call over a 4g or 5g data link than having your phone drop to 3G to make a phone call.

Less airtime means more phone calls and data for the amount of frequency allocated to the carrier, which means more money for the carrier and better quality calls for us!

The SIP Invite

Okay okay, I’ll get back on topic. As you probably already know, when a call comes from a carrier to your SBC, it arrives as a SIP Invite.

That Invite contains tons of information about the call. Where it’s from, who it’s for. Where the media endpoints are and how we are going to transmit media (sound)

In the above Invite from the carrier, the SDP shows that the BroadSoft SBC at Telstra is proposing 4 audio codecs and their order of preference in the m=audio (media audio) line.

  1. AMR Wideband (Best)
  2. AMR Narrowband
  3. G729 (Worst)
  4. G711 (Better than 729, but uses more bandwidth so carriers hate it)

Using the information that we have from the Invite and the allowed codec list, your SBC will respond agreeing to one of the codecs, depending on what’s highest on the SBC’s allowed codec list and the Invite’s allowed codec list.

In the example of this call, the SBC agrees to use AMR in the 183 Early Media packet, but the negotiation can also take place in the 200 OK

Wrap up

That’s it for today, I hope that you have been able to enable HD calling on your SBC and possibly learnt a little bit about how SIP calls work.

For more information on SIP in Teams Direct Routing, check out my session at M365 May.

One thought on “Enable “HD” AMR Calling on Teams Direct Routing with Ribbon SBC and Telstra SIP

  1. Pingback: Enhance Your Existing Sonus/Ribbon SBC's With Teams Direct Routing Using A Secondary Certificate - UcMadScientist.com

Leave a Reply

Your email address will not be published. Required fields are marked *

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