Blockchain and Peer to Peer VOIP communication over WebRTC

altanai
8 min readNov 29, 2018

This is the age of peer to peer networks, which have a definite upper hand on performance and security than the traditional centralised ones. However, the advent of ad-hoc, p2p or mesh-based system has brought one challenge to light. That is, maintaining call history, privacy and accountability. This has become even more difficult in OTT( Over the top Provider) based call applications since they operate without a central authority or call monitoring application server.

telecommunication landscape

To address the problem of tracking calls and media streams, not in terms of data that was shared, but to log the call session attributes such as source, destination, timestamp, network and media characteristics etc and to guarantee the security of call record from alteration as well as to authenticate the callers and receivers, a blockchain-based decentralised implementation on the WebRTC and SIP communication landscape is proposed.

The Big Idea: De-centralize VoIP records using Blockchain and Smart contracts

What are we doing? We are storing smart contracts within a distributed ledger for VOIP platform’s transactions (Eg:- user registration, calls, messages etc)

Call Detail Record Woes / Conflict / Mistrust

The current system of VoIP platform is hosted centre or distributed cloud computing. There are ad-hoc peer-to-peer networks overtaking the market too . The following problems with existing architecture are:

  1. Hacking prone
  2. High maintenance
  3. No proof — easily modifiable

Existing methods of CDR ( Call Detail Records ) management are subjected to mismanagement, ransomware attacks, data breaches and provide no transparency or authentication.

To overcome these we are decentralising few components of VoIP platform and cloud communications such as registrar & CDR using smart contracts and delegated proof of stake. Part of blockchain algorithms. Boosting security and credibility in VOIP ecosystem by leveraging the power of blockchain algorithms for CDR ( Call Detail Records )

Advantages

The use of blockchain is an architectural choice, which affects the non-functional qualities of a system (cost, transparency, authenticity, protection against loss or tampering) . Integrating VoIP with Blockchain is an idea implemented for better execution for keeping up with the cutting edge technology, maintaining security and credibility.

Current Limitations in VoIP -

Centralised VoIP CDR storage

A traditional SIP-based call flow routes the call via a SIP signaller which performs the handshake and enables the communicating parties to connect and share multimedia. The meta-data stored in SIP headers is recorded in a database or CDR system at the central server for auditing or record keeping. Furthermore, SDP ( session description) is exchanged between the parties before an encrypted RTP media stream starts to flow. The method is more or less similar to WebSocket based communication as well. The transactions are often stored on a file system as logs or PCAP traces which are archived for any later reference. However, such a setup is susceptible to hijacking, spoofing or just negligent mismanagement.

A better alternative using blockchain algorithms -

CDR in smart contract-based Blockchain

If a call is broadcasted to every node in the network, verified and a copy is maintained by peers, the call records are as secure as a monetary transaction made over a bitcoins. This is because they are added to ledger encrypted with digital security code, with the assurance of being unalterable and permanent.

Use-case 1: On a call, the source is validated in blockchain and CDR is added to the blockchain as well

A simple use case of a user Jack wanting to do a video call with Jill is described below -

  1. As Jack makes a call to Jill’s sip URI, the call is validated independently by peers on a public network.
  2. The call information is synchronised with the existing chain maintained by the network peers called miners, who are also registered to this blockchain communication ecosystem. The new block becomes indelible.
  3. Jill validates Jack’s communication request and answers the incoming call.
  4. SIP server proxies the invite and acks with the call logic from application server which may include call forwarding, rerouting to a voicemail box , playing IVR tones or any other custom call flow.
  5. Post the handshake and SDP exchange, the signaller drops out of the picture. Thus being lightweight and stateless.
  6. Jack and Jill exchange peer to peer data and media streams such as chats, pictures, audio, video, doodles etc over the secured end to end encrypted line. They may drop out of the call anytime and at that point, the peer to peer channel is closed.
  7. Any node of the network can anytime look up the call history or stats ( analogous to the transaction in cryptocurrency network ) from any block of call data. This is done over the trusted, transparent, publicly available and verified blockchain network.
Blockchain WebRTc VoiIP POC screenshot 1
Blockchain WebRTc VoiIP POC screenshot

Usecase 2 : Multiparty bridge for broadcasting

Multiparty media broadcasting network where a user Bob wants to broadcast his video stream live to many people around the world. The process over the p2p blockchain communication platform is described below :

  1. Bob publishes the SIP request to connect to a media server to stream his video or stream from his own browser in a torrent like a chain.
  2. The connect request is validated by the peers and added to the blockchain, in turn becoming immutable.
  3. A SIP notify is sent to all the subscribers for Bob.
  4. Any user willing to connect to the channel and view Bob’s stream can validate his data on the blockchain network and send a SIP request connection.
  5. Media Server will accept and stream the data to the viewer.

At any point in time, any viewer can validate the data of the call session of broadcast stream and decide to join in. Even long after the session has ended, one can look up Bob’s broadcast history.

Similar use cases are under development for using smart contracts to establish call appointments and online conferences. Not only does this paradigm validate the host but also guarantees the delivery and confirmation of the recipient which is unalterable.

Real-World Implications :

Advantages of this approach are manyfold. For the telephony architecture, no logging takes place at the central server as it only places the role of proxying the connection and exchanging SIP request/response based on SIP URI. Hence the backend servers no longer need to maintain resource-intensive Database operations or AAA ( authentication- authorization- accounting ). New call requests are propagated and advertised to other peer nodes. Peer nodes called miners accept the block, compute proof of work and broadcast back to other nodes. The rest of the nodes append the information to their blockchain using the previously accepted hash. The call receiver receives the confirmation and can now accept or reject the call.

For the headless browser-based clients, the users maintain their call information in a distributed fashion and own the mutual responsibility to share, hash, sign and validate the records. There is no single point of failure. The cryptographic hashes and digital signatures on the chain structure of Merkel tree ensure that the Data layer, where the actual data structure and physical storage is made, is secured, while the p2p broadcast and local validation on network side ensure that all nodes approve of the incoming call setup. The consensus is obtained by proof of work and smart contracts are used for binding the call arrangement.

Project Implementation :

The above-mentioned project is at a development state. The users would install a browser extension and sign in with their SIP accounts to register with the SIP server and parallelly on the ethereum blockchain network. The Javascript client in the extension uses WebRTC to stream media on nodejs signalling plane.

Challenges include syncing data within a few seconds instead of minutes to remove latency from call connect, compressing the data in blockchain to support easy storage at nodes. Efforts are made to also be serverless as the webpages can be directly hosted on the extension without an external https server. The webrtc headless operations are integrable with the approach mentioned above as the algorithm stabilises and we move towards a more decentralised web.

The world is fast moving towards the open and decentralised economy and it is but obvious that telephony needs to catch-up and be at par with the emerging trends with plenty of re-engineering and design changes. Creating a peer to peer secured network for VoIP communication will ensure trust and security between callers and prevent spammers or fraudulent call behaviour. Also once a call is made, the call history is permanently stored and protected against revision.

Demo video

Project SourceCode:

Written by Altanai . She is an Open source software enthusiast and VOIP technologist. She has authored the book “Integrator’s Guide to WebRTC” which describes how webrtc can be coupled with existing or new communication platforms and use cases to its full potential. She has to her credit multiple UCC platforms which included e-learning, IoT communication, surveillance, media streaming and broadcasting etc. She has filed 2 patents and published many white papers on the subject of IP communications and media streaming system which is widely cited. She continues to advocate for open source free uncensored VoIP system both as a speaker and on her site because being able to communicate is what makes us humans :)

--

--

altanai

VOIP , WebRTC , SIP, ML , media streaming , Algorithms, R&D , Quantum Computing https://telecom.altanai.com/