Lifestyle, Main Menu - Mobile App, microsoft teams, News, privacy, Snapsonic, WebRTC

Microsoft Teams Phone System, Direct Routing, and SBCs, a journey. (pt.4/4)

Last week we spent some time reviewing the TLS and SIP Options requirements for Microsoft Direct Routing, this week it’s payday! Time to make some final adjustments and place some calls.

Setting your outbound routes

For my setup, I wanted to route the outbound calls to my CPaaS, where I could do many other things besides just Origination or Termination. After some experimenting, we had our route configured and we could try some calls.

Calls were now flowing from my Teams client to my SBC and onto my CPaaS / external PSTN phone numbers. Much to my jubilation, the quality was pretty good, check it out for yourself…

Inbound routes

Now the harder part, routing calls into Teams. For this part, I had to route to the Microsoft SIP resources + assign external numbers from my CPaaS to the Teams active users. This is where things get “interesting”. 

As it turns out, the only way you can assign an external number to a user in Teams (today at least) is to run commands from a Power Shell connected to the Teams instance. Since I am a Mac user, that meant spinning up a VirtualBox, installing Windows on a VM, installing PowerShell and SFB modules. (Microsoft, please tell me there is a C# or Graph API coming for this).

Be sure to Run PS as Administrator

Then we need to run the command to connect to the SFB resources…

It will create some remoting modules…

Once authenticated you will end up back at the prompt, where you can enter the commands to add your phone numbers.

That command looks something like this…

Set-CsUser -Identity “” -OnPremLineURI tel:1234567890 -EnterpriseVoiceEnabled $true -HostedVoiceMail $true

Tech tip: Here is a link to all the Skype module commands.

If it works, it will return you back to the PS prompt. A quick look inside Teams and we will see that the number has been associated with the user as an On-premises number.

Here we see the Teams user with the assigned number inside the Team client interface…

Now, we have to route the inbound number from the CPaaS to the SBC and then onto Teams. In my case, I registered my SBC to a CPaaS SIP endpoint and used that connection to send inbound calls from my number to the SBC endpoint. The SBC then forwards the calls to the Teams SIP servers and decides where to send the media. Even though all my endpoints were in the Vancouver area, the media sometimes connected in East USA, which seems weird, maybe their Western hubs were overloaded, not sure.

Et Voila! Once everything was set up, calls inbound started working. Celebrate your small victories, as my dad always said. Here is a screenshot of me answering a call from an external number to my Teams phone number.

I added a bit of redundancy (few more servers) monitoring + failover logic and rolled it out for my buddy’s business.

He’s elated. Not only is the price right, but he now has a great deal more flexibility in how he uses the systems. He added some SIP desk phones to the mix, which now ring simultaneously when someone calls a Teams number.

I also added some SMS capabilities, TTS (Text To Speech), Call Recording and Call Whisper to his setup. 

The next post will be on using external telephony resources with some of the Microsoft Phone System features like; Auto-Attendant, Call Queues, Transfer, etc.

I hope you found this article interesting. We have had good interest in the offering thus far and now are now thinking of building a complete all-in-one solution that would do all of this through an intuitive interface eg. connect external phone systems, carriers/aggregators/cpaas, buy/manage numbers, choose carriers, set up domains, add TLS certs, et al. Let us know if you think that would be something you would be interested in. 

If you have any questions or comments or want your own SBC for Direct Routing, get in touch via or give us a call 1.877.897.1952

Main Menu - Mobile App, microsoft teams, privacy, Snapsonic

Microsoft Teams Phone System, Direct Routing, and SBCs, a journey. (pt.3)

In the last post we did some preliminary investigation on Direct Routing and what part the SBC plays in Direct Routing. Today we will take a deeper dive into TLS and SIP Options.

TLS and SIP Options

In order for this connection to work, Microsoft expects TLS+SIP Options to signal their servers that your SBC is alive and vice-versa. For the purposes of this demonstration you can think of TLS as SSL for VoIP. I would need to install certificates per domain that were going to be signaling to Microsoft and then I would need to leverage the dispatcher module in Kamailio to send the SIP Options to the Microsoft SIP servers.

Installing TLS correctly would take some forethought. Working through the Microsoft multi-tenant scenario, was a bit of a beast. In order to serve multiple tenants (thinking ahead a bit here) with the same domain and certs we would need a wildcard certificate. The problem is, double wildcard certificates are not supported, for various security reasons. So, we would have to set up a workflow that used a “*” type of structure. We are going to use let’s encrypt certs for the test, just to see if this works. Initially I just created a cert for a single domain. Once that was up, I would return to the multi-tenant requirements. For now, running a single customer on one Digital Ocean droplet was not a huge concern, we can optimize as a next phase.

Tech Tip: Adding a certificate to a debian linux VM is widely documented, that said, using let’s encrypt’s certbot module makes it dead easy.

Kamailio Dispatcher Module

Once I had the machine up and resolving on a secure socket, we needed to ensure that the dispatcher in Kamailio was sending out the SIP Options. First we need to ensure the dispatcher module was loaded add then add entries to the dispatcher list. Nick has a great article on getting started with Kamailio dispatcher, so check that out if you want to learn more about it.

Once we had our Microsoft SIP Server records in Dispatcher, we could reload Kamailio and see what’s what!

sbc:~# kamcmd dispatcher.list | egrep “URI|FLAGS” allows us to see state Flags which means our system is Actively Probing and our config is correct. 




If you are seeing IP or another FLAG, your configuration is likely incorrect. See below for the flag states.

  • AP — Active Probing — Destination is responding to option pings & looks to be up.
  • IP — Inactive Probing — Destination is not responding to pings and might be unreachable. This could also mean the destination isn’t liking what you’re sending it and therefore is not responding. In many cases this is due to the improper configuration of TLS on your server.
  • DX — Destination is disabled (administratively down)
  • AX — Coming up, but has not yet satisfied the minimums to be considered up (ds_inactive_threshold)
  • TX — Looks like or is, down. Has stopped responding to pings but has not yet satisfied downstate failed ping count (ds_probing_threshold)

Now let’s take a look at the SBC in our Teams configuration…

Hey that looks positive! Much better than the inactive state that is was in before. It would be nice if Microsoft were to rate these as a percentage of usage versus efficiency.

Next week in our final post in this series, “Microsoft Teams Phone System, Direct Routing, and SBCs, a journey (pt.4)” – we will try some outbound calls and set up our systems for inbound calls.

We hope you found this article interesting, please leave a comment or text the number below and tell us what you think!

If you have any questions or comments or want your own SBC for Direct Routing, get in touch via or give us a call at 1.877.897.1952 (also textable).

Main Menu - Mobile App, microsoft teams, Misc, News, privacy, WebRTC, Websites

Microsoft Teams Phone System, Direct Routing, and SBCs, a journey. (pt.2)

In the last post, we talked about Microsoft’s Business Voice offer and why it’s not always a practical solution. Today we get a bit more in-depth on the Direct Routing components and what’s required for external Teams telephony and the associated SBCs.

Direct Routing and Session Border Controllers

Direct Routing is Microsoft’s way of saying, external SIP connectivity. It allows admins of Teams to create interconnectivity with the outside VoIP and PSTN world without using Microsoft’s calling plans. From the Microsoft website…

Direct Routing lets you connect a supported Session Border Controller (SBC) to Microsoft Phone System to enable voice calling features. You can view information about SBCs and online voice routes; add, edit, or delete an SBC; add, edit, and specify priority of online voice routes; and manage online PSTN usage records.

So, here we know that in order for us to connect our own VOIP phone system, I needed an SBC in the middle. Here’s a quick reminder of what an SBC does in a VoIP network…

SBCs, or Session Border Controllers, are network elements that help protect VoIP networks from malicious attacks. They also serve as a point of NAT traversal and media transcoding, to aid in the connection of VoIP endpoints.

Well, it’s not the end of the world. My favorite CPaaS has plenty of SBCs in-network so that shouldn’t be an issue. Not so fast. This particular SBC needs to be set up with some specific configuration including TLS + SIP Options, specific Contact Headers & audio codecs, and few more fiddly bits. Time to dust off my SIP tools and get started. Let’s start by seeing what happens when we try and point Direct Routing to my CPaaS SBCs…

Nope, no go. Now what’s this about the domain not being setup? O365 admin says my DNS configuration is fine, so what gives?

After spending some time with Microsoft Support, the fellow I was speaking to said he copied my setup and his config wasn’t working until he enabled Exchange and Outlook MX records in his DNS. Hmm, that didn’t sound right. I didn’t want to point all my MX records to Outlook for this test, I only want Voice and Teams chat to work. Then I noticed there is a “Skype For Business / Voice” only option when verifying your domain.

I added the DNS records and it gave me the all green as you can see above, but it still wasn’t allowing me to add the SBC.

Tech Tip: I had to actually assign a user to that domain before it would recognize that domain as being active. After doing that I was able to add my SBC domain.

Down the SBC rabbit hole

The SBC in my chosen CPaaS was not directing calls to the proper Microsoft SIP signaling servers, looks like I will definitely need an SBC in between my CPaaS and Microsoft’s SIP servers. 

I had no choice, if I was going to get this working I would have to use one of the certified Teams SBCs, or build my own. The certified SBCs were relatively expensive and required licensing based on per channel usage or per minute metering if you used one of their cloud images eg. Azure, Amazon. That would not fly for my friend’s business, he is very cost-conscious, not unlike most business owners.

Down the rabbit hole we go, I bit the bullet and began building up a server. The first objective was getting outbound calls to the PSTN/outside world from Teams users. From past experience, it’s always easier to start with outbound calling first, when you get that working move on to inbound. The reason being is that NAT firewalls and SIP don’t mix well, especially if they are blocking certain traffic. Sending traffic out of a NAT was always easier than getting past the firewall inbound.

I set to work on building my SBC also known as a B2BUA (Back to back user Agent). This is not brain surgery but it does take some VoIP network know-how and a good understanding of Linux.

My first stop was A great open-source SIP server project that is used in countless commercial deployments. I found some recent articles on their mail-list talking about how to setup up Kamailio with Teams, which was a great start. Before we can proceed we must address the elephant in the room, TLS.

More on that in the next “Microsoft Teams Phone System, Direct Routing, and SBCs, a journey. (pt.3)”, to be published next week!

I hope you found this article interesting.

If you have any questions or comments or want your own SBC for Direct Routing, get in touch via or give us a call 1.877.897.1952

Main Menu - Mobile App, microsoft teams, News, privacy, Snapsonic

The lines between UCaaS, CPaaS and Cloud Communications are blurry

The various teams in your organization have similar and at the same time very different needs. Sales teams generally request integration with Salesforce and revenue operations tooling. Marketing, integration into toolsets like Hubspot and Marketo. Product teams need a feedback loop that will provide insights into usability and trends for customer use cases identifying gaps and popular (and unpopular) features. Customer Support needs integration into ticketing and help systems. Customer Success needs tight integration with success platforms tied to customer experiences and outcomes. All of these teams need reporting that delivers clarity on progress with established KPI/OKR targets in mind.

The implication here is that managing all of these well is a tall order for any growing business, but your communication strategy can’t take a back seat, it needs to be a first-class citizen. After all, it’s the first thing your customers will interact with to communicate with you!

Your cloud communications strategy will tie into all of your organizational disciplines, and there needs to be enough flexibility for your teams to grow. So how will you decide which providers or platforms suit your company’s needs best?

One would think it could be relatively simple. This process might start with one question; “Do you need deep feature integration and do you have developers in your command?” If the answer is no, your decision just became a whole lot simpler, meaning you should look at a turn-key offering. In reality, it’s not that simple. The lines between UCaaS, CPaaS, and Cloud Communications are becoming blurred.

Cloud Communications Platforms or CPaaS (Communications Platform as a Service) providers enable APIs, or Application Programming Interfaces for developers. Simply put, APIs equate to a toolset for developers that can be used to integrate features and functionality into web and mobile applications. In the comms space, this might be represented as SMS, Voice, Video, AI, Data Analytics, Fax (yes, fax still exists), etc. Some of these platforms also have professional services teams that can be retained for development projects. For some larger customers, platforms offer the best solution as it generally offers more flexibility and allows for a more tailored approach. The approach also requires more planning and coordination as services /features need to be built before they can be used. At the very least, a good customer success group is likely a requirement.

UCaaS / Cloud Communications Service Providers provide various services that are ready to consume by their business customers, there is no development required. Not to say that these companies do not offer APIs as well, many do, but it’s not what drives their business.

These services are generally less flexible. The providers that do provide APIs generally limit it to the features available in the existing offering. These cloud offerings generally take the place of several disparate systems, some of which used to be maintained onsite at the customer location(s). These services are the product of constant innovation in business phone systems. Early in the 21st century, we had analog phone systems that were circuit-switched and were bound by wires. Those systems either died or evolved into VoIP systems that were packets switched with layers of translation for interoperability with the systems of old. Now we have multi-modal and feature-rich cloud services that encapsulate Voice (desk phone, mobile, desktop), Video (single, multiparty, mobile and desktop), Text (ott + translation for SMS) and some form of Artificial Intelligence offering.

Even with all of these features, many larger enterprise companies require white-glove treatment with well-managed onboarding as their workflows and use cases can be complex. This means a CPaaS offering might be more applicable for their use cases, as long as the features are there to support all their use cases.

SMB (Small Medium Business) to SME (Small Medium Enterprise) seem to gravitate towards readymade offerings enabled by cloud communications service providers.

There are many great vendors to choose from on both sides of the fence and many times they are used in combination to serve customer’s needs.

As a demonstration, we can take a look at any larger enterprise customer that might have a need for a business communications system. It must accommodate administrative, sales, support, and customer success. They all will likely need Voice, Video, and Chat supplemented by some smart AI to help them reduce manual laborious tasks or augmenting their workflow. Many organizations have made a considerable investment into their customer workflow, including call center systems and networks and with that in mind, the customer is not interested in hearing about ripping and replacing equipment and networks. In this scenario, you might select a CPaaS for the call center component and potentially leverage a Cloud UCaaS (Unified Communications as a Service) offering for the business comms requirements.

Regardless of your needs, now could be a good time to be considering improving efficiency, optimizing and upgrading systems, and adding some feature enhancements. There are plenty of options and providers to choose from, all of which are competing fiercely for your business.

What tools do you use today and how are they working for you? How often do you use AI or video/web conferencing as part of your daily routine? If you prefer sharing your comments or questions privately, feel free to shoot me a text message or call anytime: (877) 897–1952 (Note: All calls will be recorded).

Privacy Settings
We use cookies to enhance your experience while using our website. If you are using our Services via a browser you can restrict, block or remove cookies through your web browser settings. We also use content and scripts from third parties that may use tracking technologies. You can selectively provide your consent below to allow such third party embeds. For complete information about the cookies we use, data we collect and how we process them, please check our Privacy Policy
Consent to display content from Youtube
Consent to display content from Vimeo
Google Maps
Consent to display content from Google
Consent to display content from Spotify
Sound Cloud
Consent to display content from Sound