Make a call to a web browser

How to receive calls into your web app

During this guide you will learn how to:

  • Setup the WebRTC JS SDK into your app.
  • Use the necessary SDK APIs to connect and receive calls into your web application.


Building the app

  1. Add the WebRTC adapter as a script
  1. Add the Telnyx RTC SDK as a script
  1. Initialize the client using your SIP credentials
  var client = new TelnyxWebRTC.TelnyxRTC({
         login: “SIP USER”,
         Password: “SIP USER PASSWORD”,
  1. Attach the event listeners to receive updates from the SDK
       .on('telnyx.ready', () => console.log('ready to call'))
       .on('telnyx.notification', (notification) => {
         console.log('notification:', notification)
  1. Inside the telnyx.notification event you can detect the incoming call and answer it. On this example we are anwering it as soon as we get the incoming call notification
  client.on('telnyx.notification', (notification) => {
      const call =;

      // Check the type of the notification
      if (notification.type === 'callUpdate' && call.state === 'ringing') {
          // Answer the call as soon as the notification is received.
  1. Enable the microphone
  1. Connect the client
  1. Now your application is capable of receiving voice calls.

How to test it

  1. Go to
  2. Login with SIP credentials (caller SIP credentials). At this point you should have created 2 SIP connections one for the caller and another for the callee.


  3. Enter the destination SIP username (callee SIP connection) and press the call button.


  4. The telnyx.notification listener will be fired and the call will automatically be answered.

Test the vanilla example

Was this page helpful?