Skip to main content
Version: /v2

Add SIP Trunk - API

This API allows you to create a new SIP Trunk by providing SIP credentials, domain, direction, and associated phone numbers. It returns the created SIP trunk object with metadata.

HTTP method and endpoint

POST

|

https://api.videosdk.live/v2/sip-trunk
Headers Parameters

values : YOUR_TOKEN_WITHOUT_ANY_PREFIX

This will be a JWT token generate using VideoSDK ApiKey and Secret.

Note that the token will not include any prefix such as "Basic " or "Bearer ". Just pass a token as value.

You can generate a new token by refering this Guide: Generate Auth token

REQUIRED

values : application/json

This is usefull for json body parameters, so that VideoSDK servers can understand that the incoming body parameter will be a JSON string.

Body Parameters
REQUIRED
  • auth:
    • username: string
    • password: string
REQUIRED
Name of the SIP Trunk. Must be at least 3 characters.
REQUIRED
Valid SIP trunk domain.
REQUIRED
Direction of the trunk. Can be 'inbound' or 'outbound'.
REQUIRED
Array of phone numbers assigned to the trunk.
Response Parameters
Public-facing SIP trunk identifier (used externally).
Authentication object containing username and password.
Name of the SIP Trunk.
Domain of the SIP Trunk.
Trunk direction — either 'inbound' or 'outbound'.
Array of phone numbers assigned to this trunk.
POST
|
https://api.videosdk.live/v2/sip-trunk
import fetch from 'node-fetch';
const options = {
method: "POST",
headers: {
"Authorization": "Bearer $YOUR_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
"auth" : {"username":"username","password":"password"},
"name" : "twilio",
"domain" : "example.pstn.twilio.com",
"direction" : "outbound",
"numbers" : ["+1234567890"]
}),
};
const url= `https://api.videosdk.live/v2/sip-trunk`;
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
RESPONSE
{
"trunkId": "SqlZqn1U1ezvhWGRek6ow",
"auth": {
"username": "naruto",
"password": "password"
},
"name": "twilio",
"domain": "example.pstn.twilio.com",
"direction": "outbound",
"numbers": [
"+12345678"
]
}

Got a Question? Ask us on discord