September 30, 2020

Unifying Our Calling Platform with WebRTC

Written by kevin-c


WebRTC logo

So...what is WebRTC, and how is it used at TextNow?

WebRTC is an open-source framework for real time audio/video communication. You may have heard of WebRTC referred to as “JavaScript APIs” (or something similar) in the context of web applications and streaming audio/video.

And, indeed, streaming audio and video via the web is how you will usually come across the WebRTC library being used. All major browsers today support the WebRTC JavaScript APIs, and if you’ve used any type of video chat online lately (and who hasn’t, given world events?), there’s a good chance you’ve used WebRTC

In fact, if you’ve ever used your browser to make a call through TextNow’s web-calling feature, then surprise! You’ve also used WebRTC. In fact, that’s how we found WebRTC worked so well compared to our previous solutions that we’re now expanding the use of it across all of our applications in our goal to provide our customers with high quality calling for free or as close to free as possible.


(Brief) History of WebRTC

In 2010, Google acquired a company named Global IP Solutions, which had been working on software components needed for video conferencing. Shortly after, this work was released as open source with the goal of integrating it into browsers and promoting this technology for the web. WebRTC was also proposed to the IETF and W3C for standardization in the browser via JavaScript APIs.

Initially WebRTC APIs were available via JavaScript in the browser, and also through the native C++ APIs core to WebRTC. Later, support for integrating WebRTC into other environments — namely Android and iOS — was added along with Java and Objective-C API wrappers.

WebRTC at TextNow

TextNow's browser calling


TextNow got its start with WebRTC in the fall of 2018. We were building a new, in-house calling backend, and for the first time we had the ability to integrate closely with our calling applications across web, iOS, and Android platforms. This gave us the ability to use WebRTC for our browser calling feature, since WebRTC comes for free in modern browsers. That meant it was easily accessible to our web app, and it opened the door for employing WebRTC for calling at TextNow.

We embrace these types of experiments at TextNow. Since we own the full calling stack — from client to backend — we have the freedom to build out and optimize calling to benefit our users in the best ways possible.

Throughout 2018 and 2019 as we built out our new calling platform, we rearchitected our web app to use WebRTC. We ended up using the standard WebRTC JavaScript APIs to set up and manage audio streaming during a phone call, and SIP (Session Initiation Protocol) over Websocket with SSL (another open API for communication in the browser) for call signaling.

Right from the beginning we saw great improvements to call quality. And, almost as good, we ended up with a clean, light calling implementation thanks to the simplicity of the WebRTC APIs.

WebRTC and Websocket logo

Android and iOS

Next, we took a hard look at calling in our iOS and Android apps, and thought about where we wanted to grow our calling experience. We’ve provided calling for a long time now, and while our solutions have worked well for our customers, there were two core areas where we wanted to grow:

  1. Call quality. The bar can never be too high here, and if there’s any way we can improve call quality for our users even more, we’ll take it!

  2. Call reliability and feature development. Our existing calling code, while working well, had grown over the years. Our code consisted of two separate implementations across Android and iOS. This was starting to cause some maintenance issues and impeded our ability to quickly develop new features across both apps in parallel.

We looked at several different options, and again settled on WebRTC for our Android and iOS apps. Our research showed that WebRTC had the quality related features we wanted. Even better, WebRTC builds against Android and iOS out of the box, meaning we could unify our calling code across our Android and iOS apps. We knew this would enable us to move faster in building out calling across all of our apps simultaneously.

Android and iOS smartphones.

As we headed into 2020, Project 20 (we’re in 2020, get it?) was born. But the story doesn't end there….

Stay tuned for Part 2 where we discuss Project 20, how we’re already using WebRTC to improve your calling experience in our apps, and where we want to take calling in the future.

[To hear more hot C++ talk from Dave Hegedorn, put this episode of the CppCast, the internet’s premier C++ podcast, into your earholes. — Ed.]