WebRTC Handover between Wi-Fi and Cellular

I use the Conversations XMPP messenger a lot on my Android phone, not only for text, image and video chat messages, but also for voice and video calling. It’s a joy to use! While in the early days, voice calls dropped when moving between the cellular network and Wi-Fi, the process has become pretty much seamless in the meantime. When I recently jumped between Wi-Fi and cellular a number of times on purpose, I was surprised that I couldn’t hear the switch between the networks in the audio channel at all. So perhaps the call didn’t switch and staid on cellular? I decided to have a closer look.

Due to IPv4 and Network Address Translation (NAT) barriers, I use my own STUN/TURN server in the audio stream, on which I can trace with Wireshark. The screenshot above shows that the handovers I couldn’t hear in the audio path actually did occur. But three is more!

Let’s Have a Closer Look

The graph shows three lines: The green line shows packets the TURN server received from my mobile up to the point where I switched networks. At this point the audio call continues over a new IP address represented by the blue line. Looks like a sharp cut. That makes sense, because only one data path can be active at a time. And finally, the orange line shows the packets sent to the TURN server from the other mobile where no handover occurred. Nice!

That all sounds nice, but that graph does not show all that is going on. When looking a bit deeper into the Wireshark trace, one can see that the WebRTC component on my Android phone is connected to both Cellular and Wi-Fi at the same time after coming in range of a Wi-Fi hotspot. During about two seconds, the speech path still flows over the ‘old’ leg (e.g. cellular), while the WebRTC component already talks over the ‘new’ leg (e.g. Wi-Fi) to the STUN server to prepare the handover of the speech path. Once properly authenticated, it then sends a command to the WebRTC server to switch the IP address of the local end from the old (cellular) to the new (Wi-Fi) IP address. And this is the reason why this is so seamless: Dual cellular / Wi-Fi connectivity to prepare the switch between cellular and handover. Wow, I was really surprised and delighted to see this!

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.