WebRTC Quickstart

WebRTC Tutorial: How to Build Your First App

In this guide, you’ll learn how to get started with Telnyx WebRTC using the Telnyx Portal and API. Just follow these steps:

  1. Sign up for a Telnyx Account.
  2. Create a Credential Connection to configure how you connect your calls.
  3. Create an Outbound Voice Profile to configure your outbound call settings and assign it to your Credential Connection.
  4. Grab your API key
  5. Create a new on-demand credential and generate a token
  6. Authenticate to the Telnyx WebRTC platform and place a call

Sign Up for a Telnyx Mission Control Portal Account

Head to telnyx.com/sign-up to sign up for your free Telnyx account. It’ll give you access to our Mission Control Portal where you can buy phone numbers, set up and manage Call Control Applications, and more.

Create a Credential Connection for your Calls

A Credential Connection groups configuration for your calls, such as which codecs to use (tip: enable VP8 codec for video).

  1. Navigate to the SIP Connections page of the Mission Control Portal.
  2. Click the "+ Add SIP Connection" button near the top right corner of the page.
  3. Enter the name you wish to have for your SIP Connection.
  4. Select "Credentials" as the "Connection Type".
  5. A username and password will automatically be generated. You can ignore it for now.
  6. Click "Set Credentials".
  7. Click "Done".

    Note - Credential Connections by default have the VP8 codec disabled. Edit the connection "Inbound" settings to enable it.

Credential Connection Settings

Create an Outbound Voice Profile

To be able to place calls, you must first create an Outbound Voice Profile and assign your Credential Connection to it.

Select "Outbound Voice Profiles" on the left-hand navigation menu, click "+Add New Profile" and set up your profile name. Add the Credential Connection you just created above and select your traffic type.

You can also do this programmatically via our RESTful API. Check out our documentation for Outbound Voice Profiles.

Grab your API Key

If you already have a Telnyx V2 API Authentication key, skip to Step 3.

  1. In the Telnyx Mission Control Portal, in the left menu bar navigate to "Auth".
  2. Ensure, API V2 is selected in the horizontal menu bar.
  3. Click "Create API key"
  4. Copy the API key and save it somewhere safe.

Create On-demand Credential

Create the Credential


curl -X POST \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --data '{
    "connection_id": "<your connection ID>"
  }' \

Example Response

  "data": {
    "id": "68f28076-119e-440d-bb69-9a8d359857c2",
    "name": "2020-08-05 13:42:22.991499Z",
    "record_type": "credential",
    "resource_id": "connection:1431843891430033126",
    "sip_password": "570067b6e4d7495db417e150a81380d9",
    "sip_username": "gencredbcXbCt2uEOaD6e2VN2Bs3b2HDlQVW2v3CJFTQ6Xes9",
    "created_at": "2020-08-05T13:42:22.992Z",
    "expires_at": null,
    "updated_at": "2020-08-05T13:42:22.992Z",
    "user_id": "14c31d6d-aa05-4598-bef8-5acd2197f0c1"


  • By default, on-demand credentials will not expire.
  • The randomly generated sip_username will be used to receive SIP using <sip_username>@sip.telnyx.com as destination

Generate a token

curl -X POST \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --data '{}' \

Example Response



  • The response body is a JWT (JSON Web Token) that expires in 24h
  • The token is associated with the Credential, and is rendered invalid if the credential expires or is deleted

Authenticate and place a call

Make a test call

The Telnyx WebRTC test application is built using our Javascript WebRTC SDK, to showcase our WebRTC platform and make it easier to test your setup.

With the token generated above, you can register to WebRTC servers, providing a Caller ID Name and Caller ID Number and Client State.


Client State Tips:

  • If you're wanting to integrate client calls into a third party application, webhooks can be enabled via SIP Connections > Basic Options > Events > Webhook URL
  • The client_state field can then be scraped and processed by any backend application where webhooks are configured to POST to.
  • In the sample application, it will need to be base64 encoded.

When clicking on Connect, a log message will be shown indicating the client has been registered. After this, you can place a test call to any number available in your Outbound Profile settings, or to a SIP destination.


  • If you create two different Credentials, you can open two browser instances and call one from the other
  • If VP8 codec is enabled for both calling and called party a video call can be established


You can change codecs in our portal Sip Connection

WebRTC codecs

Ringback tone

You can enable/disable the ringback tone in outbound calls in our portal Sip Connection

Ringback tone


Check out Telnyx WebRTC SDKs, available for both Javascript and React-Native:

Was this page helpful?