Contact Sales

All fields are required

Voice and Video Calls in a Web Browser with RELAY | SignalWire
Product

Voice and Video Calls in a Web Browser with RELAY

The SignalWire RELAY WebRTC JavaScript library is here!

SignalWire

The SignalWire RELAY Browser SDK turns a web browser into a real-time voice and video endpoint using Web Real-Time Communication (WebRTC). This post explains what RELAY is, how the RELAY Browser SDK V2 and V3 and V4 differ, and when to choose each version. It also walks through making browser-based voice and video calls, including calling to the Public Switched Telephone Network (PSTN) and Session Initiation Protocol (SIP) endpoints with V2, and points to a demo app, JSON Web Token (JWT) authentication docs, and code examples for initializing a client and placing calls.

What is SignalWire RELAY?

The SignalWire Client-side SDKs transform your browser into a real-time media engine, enabling developers to directly make audio and video calls to phone numbers, SIP endpoints, and other browsers. With a few lines of code, you can even set up a full-fledged video conferencing system. Using the client-side SDKs you can add immersive, scalable communications — from video conferences and softphones to click-to-call and chat functionality — to your own web pages and applications.

There are two versions of RELAY Browser SDK:

RELAY Browser SDK V2 enables voice and video calls between endpoints on the SignalWire network and the PSTN (Public Switched Telephone Network) as well as enterprise SIP (Session Initiation Protocol) networks.

RELAY Browser SDK V3 is ideal for conferencing or streaming applications using audio or video, as well as chat with customizable payloads. As of now, RELAY Browser SDK V3 does not yet support dialing out to the PSTN or SIP endpoints, so if this is a requirement, you should use RELAY Browser SDK V2 instead.

RELAY Realtime SDK V4 is a major upgrade focused on making real-time apps easier to build and maintain. It introduces a unified client architecture so developers can consolidate voice, messaging, and video in a single project instead of splitting functionality across separate namespaces or apps, which reduces code redundancy and improves visibility when debugging. RELAY v4 also expands event handling, including more granular listeners for things like playback, detection, and recording, and it adds more flexible promise resolution with methods like .onStarted() and .onEnded() so developers can control when asynchronous operations resolve and get better error tracking across workflows.

In this post, we will be using the RELAY Browser SDK V2 and making an outbound call from your browser to either a SIP or PSTN number.

Building a simple browser application with RELAY Browser SDK V2

Our Web Browser library allows developers to take full advantage of the SignalWire network and the endpoints that it contains. Making a call to another Web Browser endpoint has never been easier. Making and receiving calls from a Web Browser to the legacy phone network just works. Calling SIP endpoints are supported out of the box.

In the first iteration of this SDK, 1:1 voice and video calls are supported with more advanced functionality including Messaging, simple Video Conferencing, and advanced Web Conferencing with screen share features.

Check out the demo video below:

Use our demo application to test your configuration from your project. The SignalWire Call Demo can be found here. To get started, we need to grab our Project Key from our SignalWire dashboard:

Paste it in the SignalWire Call Demo under Project. We also need to obtain a JSON Web Token (JWT). To learn more about generating and using JWT, including all of the options that are available to you, see our Authentication for JavaScript SDK Documentation.

Once you have generated a JWT, copy and paste it into the demo application under Token.

After you have entered both values, connect the client by clicking Connect:

Now you can create and receive voice and video calls to and from other browsers, SIP endpoints, and the PSTN (Public Switched Telephone Network). For outbound calls, simply enter the resource or number to dial in the Call To section and click Call!

Code examples

Connect with RELAY by creating a client and attaching all the necessary event handlers. All the available events that you can attach a listener to can be found here.

Initialize and attach listeners:


Make a new call:


Come and build something great on SignalWire! If you have any questions while getting started with RELAY, stop by our Community Discord to connect with our team.

Frequently asked questions

What is the SignalWire RELAY Browser SDK?

The SignalWire RELAY Browser SDK is a JavaScript SDK that enables real-time voice and video calling directly in a web browser using WebRTC, including calls to other browsers on the SignalWire network.

What is the difference between RELAY Browser SDK V2 and V3?

RELAY Browser SDK V2 supports voice and video calls between SignalWire network endpoints and the PSTN, plus enterprise SIP networks. RELAY Browser SDK V3 is aimed at conferencing or streaming applications with audio or video, plus chat with customizable payloads, and it does not support dialing out to the PSTN or SIP endpoints.

Can a web browser call phone numbers and SIP endpoints with RELAY?

Yes. RELAY Browser SDK V2 supports outbound calling from the browser to the PSTN and to SIP endpoints.

What is needed to authenticate a RELAY Browser SDK client?

A typical setup uses your SignalWire project key and a JSON Web Token (JWT) to authenticate the browser client before placing or receiving calls.

What types of applications can be built with the RELAY Browser SDK?

Browser-based use cases such as click-to-call, softphones, video conferencing, web conferencing, and chat experiences embedded into web pages or web applications.

Related Articles