WebRTC Made Easy for JavaScript Developers

A simple yet powerful JS library that takes care of WebRTC and SIP signaling for you

  • video + audio video + audio highlight

    video + audio

  • message message highlight

    message

Oops!

Looks like your browser can't run this demo.

To get the full experience, download the latest version of Chrome or Firefox

In-browser Video Chat is Now a Breeze

Here's a demo. Start a video chat between Alice and Bob.

Alice's View

Demo user one

Bob's View

Demo user two

Real-Time Messaging with a Dozen Lines of Code

Check it out. Instant message between Alice and Bob.

Bob: No messages yet

Alice's View

Demo user one

Alice: No messages yet

Bob's View

Demo user two

See How It's Done

The code displayed on the right is what powers the selected demo from Alice’s end, although Bob’s code would be very similar. SIP.js allows you to utilize WebRTC’s APIs using just JavaScript. To check out the full code for all three demos, click the button below.

SIP.js makes it easy to utilize WebRTC's APIs and set up SIP communication sessions. In no time at all, you can have two separate users talking to one another. To learn more about the SIP.js API, click the button below.

const domain = 'sipjs.onsip.com';
const aliceURI      = 'alice.' + window.token + '@' + domain;
const aliceName     = 'Alice';

const bobURI        = 'bob.' + window.token + '@' + domain;
const bobName       = 'Bob';

const remoteVideoElement = document.getElementById(remoteVideo);
const button = document.getElementById(buttonId);

let onCall = false;

const configuration = {
    aor: aliceURI,
    delegate: {
        onCallCreated: () => {
            onCall = true;
        },
        onCallAnswered: () => {
            onCall = true;
        },
        onCallHangup: () => {
            onCall = false;
        }
    }
    media: {
        remote: {
            video: remoteVideoElement,
            // Need audio to be not null to do audio & video instead of just video
            audio: remoteVideoElement
        }
    },
    userAgentOptions: {
        displayName
    },
};
const simpleUser = new SimpleUser('wss://edge.sip.onsip.com', configuration);
simpleUser.connect();

button.addEventListener('click', function() {
    // No current call up
    if (!onCall) {
        simpleUser.call(bobURI);
    } else {
        simple.hangup();
    }
});
const domain = 'sipjs.onsip.com';
const aliceURI      = 'alice' + '@' + domain;
const aliceName     = 'Alice';

const bobURI        = 'bob' + '@' + domain;
const bobName       = 'Bob';

const configuration = {
    aor: aliceURI,
    delegate: {
        onMessage: (msg) => {
            alert(msg.body);
        }
    }
};

const aliceSimple = new SimpleUser('wss://edge.sip.onsip.com', configuration);

aliceSimple.message(bobURI, 'Check out this palindrome: "Now sir, a war is never even. Sir, a war is won."');
See Full Demo Code  Check out the full API 

Don't Want to Bother with the Back End?

If you’d like to identify and locate your user addresses on the Internet so they can participate in RTC sessions, you’ll need SIP servers. You can build your own using open source FreeSWITCH or Asterisk, or you can try out OnSIP - no system setup, modifications, maintenance, or upfront capital required. Sign up for an OnSIP free trial 

Sign up for an OnSIP free trial 

Learn

New to SIP.js? Our guides and docs will have you up and running in a snap.

Connect

Get answers, stay up to date, and become part of the SIP.js community.

Features

  • Register SIP User Agents using the SIP over WebSocket transport
  • Create Audio and Video sessions
  • Send Instant Messages and view Presence
  • Share your screen or desktop
  • Utilize advanced call features such as early media, call hold and resume, and transfers
  • Send DTMF with SIP INFO
  • 100% open source, 100% JavaScript
  • All major browsers supported

Trusted By

Trusted by OnSIP
Trusted by FireRTC
Trusted by RingCentral
Trusted by Twilio
Trusted by Spacivox
Trusted by Spacivox