{
"RouteName": "Main SIP Trunk",
"RouteType": "Trunk",
"VoiceUrl": "https://domain.com",
"VoiceUrlMethod": "POST",
"VoiceAuthenticationType": "Basic",
"VoiceUsername": "admin",
"VoicePasswordToken": "passwordORbearerToken",
"CallbackVoiceUrl": "https://apiendpoint.com",
"CallbackVoiceUrlMethod": "POST",
"TrunkIp1": "20.87.87.87",
"TrunkIp2": "20.87.87.86",
"TrunkPort1": "5061",
"TrunkPort2": "5060",
"TrunkTransport1": "UDP",
"TrunkTransport2": "TCP",
"TrunkUri1": "https://pstn.joonto.com",
"TrunkUri2": "https://pstn2.joonto.com",
"TrunkEnabled1": true,
"TrunkEnabled2": false,
"Trunk1Priortiy": 10,
"Trunk1Weight": 10,
"Trunk2Priortiy": 20,
"Trunk2Weight": 20,
"HeaderManipulation": "HMI8802029",
"EnableSipRefer": true,
"TransferCallerId": "Transferee/Transferor",
"SymmetricRtp": true,
"EnableTrpSecureTrunk": true,
"EnablePstnTransfer": true,
"IpWhitelist": [{"IpAddress": "20.20.10.10"}, {"IpAddress": "20.20.10.20"}],
"CnamLookup": true,
"TerminationUriSubdomain": "client",
"EnableCallStreaming": true,
"WssUri": "wss://192.67.88.2",
"IntelligentRouteEnabled": true,
"RouteEnabled": true
}curl -X POST https://api.telegent.com/v1.0/voice/routes \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"RouteName": "Main SIP Trunk",
"RouteType": "Trunk",
"VoiceUrl": "https://domain.com",
"VoiceUrlMethod": "POST",
"TrunkIp1": "20.87.87.87",
"TrunkPort1": "5061",
"TrunkTransport1": "UDP",
"RouteEnabled": true
}'import requests
url = "https://api.telegent.com/v1.0/voice/routes"
payload = {
"RouteName": "Main SIP Trunk",
"RouteType": "Trunk",
"VoiceUrl": "https://domain.com",
"VoiceUrlMethod": "POST",
"VoiceUsername": "admin",
"VoicePasswordToken": "passwordORbearerToken",
"CallbackVoiceUrl": "https://apiendpoint.com",
"CallbackVoiceUrlMethod": "POST",
"TrunkIp1": "20.87.87.87",
"TrunkIp2": "20.87.87.86",
"TrunkPort1": "5061",
"TrunkPort2": "5060",
"TrunkTransport1": "UDP",
"TrunkTransport2": "TCP",
"TrunkUri1": "https://pstn.joonto.com",
"TrunkUri2": "https://pstn2.joonto.com",
"TrunkEnabled1": True,
"TrunkEnabled2": False,
"Trunk1Priortiy": 10,
"Trunk1Weight": 10,
"Trunk2Priortiy": 20,
"Trunk2Weight": 20,
"HeaderManipulation": "HMI8802029",
"EnableSipRefer": True,
"TransferCallerId": "Transferee/Transferor",
"SymmetricRtp": True,
"EnableTrpSecureTrunk": True,
"EnablePstnTransfer": True,
"IpWhitelist": [{ "IpAddress": "20.20.10.10" }],
"CnamLookup": True,
"TerminationUriSubdomain": "client",
"EnableCallStreaming": True,
"WssUri": "wss://192.67.88.2",
"RouteEnabled": True,
"IntelligentRouteEnabled": True,
"AccountId": "DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
RouteName: 'Main SIP Trunk',
RouteType: 'Trunk',
VoiceUrl: 'https://domain.com',
VoiceUrlMethod: 'POST',
VoiceUsername: 'admin',
VoicePasswordToken: 'passwordORbearerToken',
CallbackVoiceUrl: 'https://apiendpoint.com',
CallbackVoiceUrlMethod: 'POST',
TrunkIp1: '20.87.87.87',
TrunkIp2: '20.87.87.86',
TrunkPort1: '5061',
TrunkPort2: '5060',
TrunkTransport1: 'UDP',
TrunkTransport2: 'TCP',
TrunkUri1: 'https://pstn.joonto.com',
TrunkUri2: 'https://pstn2.joonto.com',
TrunkEnabled1: true,
TrunkEnabled2: false,
Trunk1Priortiy: 10,
Trunk1Weight: 10,
Trunk2Priortiy: 20,
Trunk2Weight: 20,
HeaderManipulation: 'HMI8802029',
EnableSipRefer: true,
TransferCallerId: 'Transferee/Transferor',
SymmetricRtp: true,
EnableTrpSecureTrunk: true,
EnablePstnTransfer: true,
IpWhitelist: [{IpAddress: '20.20.10.10'}],
CnamLookup: true,
TerminationUriSubdomain: 'client',
EnableCallStreaming: true,
WssUri: 'wss://192.67.88.2',
RouteEnabled: true,
IntelligentRouteEnabled: true,
AccountId: 'DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j'
})
};
fetch('https://api.telegent.com/v1.0/voice/routes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.telegent.com/v1.0/voice/routes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'RouteName' => 'Main SIP Trunk',
'RouteType' => 'Trunk',
'VoiceUrl' => 'https://domain.com',
'VoiceUrlMethod' => 'POST',
'VoiceUsername' => 'admin',
'VoicePasswordToken' => 'passwordORbearerToken',
'CallbackVoiceUrl' => 'https://apiendpoint.com',
'CallbackVoiceUrlMethod' => 'POST',
'TrunkIp1' => '20.87.87.87',
'TrunkIp2' => '20.87.87.86',
'TrunkPort1' => '5061',
'TrunkPort2' => '5060',
'TrunkTransport1' => 'UDP',
'TrunkTransport2' => 'TCP',
'TrunkUri1' => 'https://pstn.joonto.com',
'TrunkUri2' => 'https://pstn2.joonto.com',
'TrunkEnabled1' => true,
'TrunkEnabled2' => false,
'Trunk1Priortiy' => 10,
'Trunk1Weight' => 10,
'Trunk2Priortiy' => 20,
'Trunk2Weight' => 20,
'HeaderManipulation' => 'HMI8802029',
'EnableSipRefer' => true,
'TransferCallerId' => 'Transferee/Transferor',
'SymmetricRtp' => true,
'EnableTrpSecureTrunk' => true,
'EnablePstnTransfer' => true,
'IpWhitelist' => [
[
'IpAddress' => '20.20.10.10'
]
],
'CnamLookup' => true,
'TerminationUriSubdomain' => 'client',
'EnableCallStreaming' => true,
'WssUri' => 'wss://192.67.88.2',
'RouteEnabled' => true,
'IntelligentRouteEnabled' => true,
'AccountId' => 'DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.telegent.com/v1.0/voice/routes"
payload := strings.NewReader("{\n \"RouteName\": \"Main SIP Trunk\",\n \"RouteType\": \"Trunk\",\n \"VoiceUrl\": \"https://domain.com\",\n \"VoiceUrlMethod\": \"POST\",\n \"VoiceUsername\": \"admin\",\n \"VoicePasswordToken\": \"passwordORbearerToken\",\n \"CallbackVoiceUrl\": \"https://apiendpoint.com\",\n \"CallbackVoiceUrlMethod\": \"POST\",\n \"TrunkIp1\": \"20.87.87.87\",\n \"TrunkIp2\": \"20.87.87.86\",\n \"TrunkPort1\": \"5061\",\n \"TrunkPort2\": \"5060\",\n \"TrunkTransport1\": \"UDP\",\n \"TrunkTransport2\": \"TCP\",\n \"TrunkUri1\": \"https://pstn.joonto.com\",\n \"TrunkUri2\": \"https://pstn2.joonto.com\",\n \"TrunkEnabled1\": true,\n \"TrunkEnabled2\": false,\n \"Trunk1Priortiy\": 10,\n \"Trunk1Weight\": 10,\n \"Trunk2Priortiy\": 20,\n \"Trunk2Weight\": 20,\n \"HeaderManipulation\": \"HMI8802029\",\n \"EnableSipRefer\": true,\n \"TransferCallerId\": \"Transferee/Transferor\",\n \"SymmetricRtp\": true,\n \"EnableTrpSecureTrunk\": true,\n \"EnablePstnTransfer\": true,\n \"IpWhitelist\": [\n {\n \"IpAddress\": \"20.20.10.10\"\n }\n ],\n \"CnamLookup\": true,\n \"TerminationUriSubdomain\": \"client\",\n \"EnableCallStreaming\": true,\n \"WssUri\": \"wss://192.67.88.2\",\n \"RouteEnabled\": true,\n \"IntelligentRouteEnabled\": true,\n \"AccountId\": \"DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.telegent.com/v1.0/voice/routes")
.header("Content-Type", "application/json")
.body("{\n \"RouteName\": \"Main SIP Trunk\",\n \"RouteType\": \"Trunk\",\n \"VoiceUrl\": \"https://domain.com\",\n \"VoiceUrlMethod\": \"POST\",\n \"VoiceUsername\": \"admin\",\n \"VoicePasswordToken\": \"passwordORbearerToken\",\n \"CallbackVoiceUrl\": \"https://apiendpoint.com\",\n \"CallbackVoiceUrlMethod\": \"POST\",\n \"TrunkIp1\": \"20.87.87.87\",\n \"TrunkIp2\": \"20.87.87.86\",\n \"TrunkPort1\": \"5061\",\n \"TrunkPort2\": \"5060\",\n \"TrunkTransport1\": \"UDP\",\n \"TrunkTransport2\": \"TCP\",\n \"TrunkUri1\": \"https://pstn.joonto.com\",\n \"TrunkUri2\": \"https://pstn2.joonto.com\",\n \"TrunkEnabled1\": true,\n \"TrunkEnabled2\": false,\n \"Trunk1Priortiy\": 10,\n \"Trunk1Weight\": 10,\n \"Trunk2Priortiy\": 20,\n \"Trunk2Weight\": 20,\n \"HeaderManipulation\": \"HMI8802029\",\n \"EnableSipRefer\": true,\n \"TransferCallerId\": \"Transferee/Transferor\",\n \"SymmetricRtp\": true,\n \"EnableTrpSecureTrunk\": true,\n \"EnablePstnTransfer\": true,\n \"IpWhitelist\": [\n {\n \"IpAddress\": \"20.20.10.10\"\n }\n ],\n \"CnamLookup\": true,\n \"TerminationUriSubdomain\": \"client\",\n \"EnableCallStreaming\": true,\n \"WssUri\": \"wss://192.67.88.2\",\n \"RouteEnabled\": true,\n \"IntelligentRouteEnabled\": true,\n \"AccountId\": \"DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telegent.com/v1.0/voice/routes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"RouteName\": \"Main SIP Trunk\",\n \"RouteType\": \"Trunk\",\n \"VoiceUrl\": \"https://domain.com\",\n \"VoiceUrlMethod\": \"POST\",\n \"VoiceUsername\": \"admin\",\n \"VoicePasswordToken\": \"passwordORbearerToken\",\n \"CallbackVoiceUrl\": \"https://apiendpoint.com\",\n \"CallbackVoiceUrlMethod\": \"POST\",\n \"TrunkIp1\": \"20.87.87.87\",\n \"TrunkIp2\": \"20.87.87.86\",\n \"TrunkPort1\": \"5061\",\n \"TrunkPort2\": \"5060\",\n \"TrunkTransport1\": \"UDP\",\n \"TrunkTransport2\": \"TCP\",\n \"TrunkUri1\": \"https://pstn.joonto.com\",\n \"TrunkUri2\": \"https://pstn2.joonto.com\",\n \"TrunkEnabled1\": true,\n \"TrunkEnabled2\": false,\n \"Trunk1Priortiy\": 10,\n \"Trunk1Weight\": 10,\n \"Trunk2Priortiy\": 20,\n \"Trunk2Weight\": 20,\n \"HeaderManipulation\": \"HMI8802029\",\n \"EnableSipRefer\": true,\n \"TransferCallerId\": \"Transferee/Transferor\",\n \"SymmetricRtp\": true,\n \"EnableTrpSecureTrunk\": true,\n \"EnablePstnTransfer\": true,\n \"IpWhitelist\": [\n {\n \"IpAddress\": \"20.20.10.10\"\n }\n ],\n \"CnamLookup\": true,\n \"TerminationUriSubdomain\": \"client\",\n \"EnableCallStreaming\": true,\n \"WssUri\": \"wss://192.67.88.2\",\n \"RouteEnabled\": true,\n \"IntelligentRouteEnabled\": true,\n \"AccountId\": \"DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j\"\n}"
response = http.request(request)
puts response.read_body{
"CallRouteId": "CRID-509de94f-79cc-429b-a317-2102654dabbb",
"AccountId": "AID-ab12345-2725-45a1-bd5e-526ed19799xx",
"RouteName": "Main SIP Trunk",
"RouteType": "Trunk",
"VoiceUrl": "https://domain.com",
"VoiceUrlMethod": "POST",
"TrunkIp1": "20.87.87.87",
"TrunkIp2": "20.87.87.86",
"TrunkPort1": "5061",
"TrunkPort2": "5060",
"TrunkTransport1": "UDP",
"TrunkTransport2": "TCP",
"TrunkUri1": "https://pstn.joonto.com",
"TrunkUri2": "https://pstn2.joonto.com",
"TrunkEnabled1": true,
"TrunkEnabled2": false,
"Trunk1Priortiy": 10,
"Trunk1Weight": 10,
"Trunk2Priortiy": 20,
"Trunk2Weight": 20,
"HeaderManipulation": "HMI8802029",
"EnableSipRefer": true,
"TransferCallerId": "Transferee/Transferor",
"SymmetricRtp": true,
"EnableTrpSecureTrunk": true,
"EnablePstnTransfer": true,
"CnamLookup": true,
"TerminationUriSubdomain": "client",
"EnableCallStreaming": true,
"WssUri": "wss://192.67.88.2",
"IntelligentRouteEnabled": true,
"RouteEnabled": true,
"IpWhiteList": []
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}Create Voice Route
Create a new voice route to define how inbound calls are handled for numbers assigned to it. Routes support SIP trunk termination, webhook-based IVR, forwarding, and workgroup distribution. Each route returns a unique CRID (Call Route ID) used when provisioning or updating numbers. Workgroups and Schedules can be attached to a route after creation to enable ring groups and business-hours routing.
What this does: Returns the new route’s CallRouteId (CRID-). Store this ID — it is required when provisioning numbers with voice enabled. Configure SIP trunk IPs, forwarding URLs, or workgroups after creation using the update endpoint.
Next steps:
- Assign the route to a number —
POST /v1.0/numbers/provision - Add a workgroup —
POST /v1.0/workgroups
{
"RouteName": "Main SIP Trunk",
"RouteType": "Trunk",
"VoiceUrl": "https://domain.com",
"VoiceUrlMethod": "POST",
"VoiceAuthenticationType": "Basic",
"VoiceUsername": "admin",
"VoicePasswordToken": "passwordORbearerToken",
"CallbackVoiceUrl": "https://apiendpoint.com",
"CallbackVoiceUrlMethod": "POST",
"TrunkIp1": "20.87.87.87",
"TrunkIp2": "20.87.87.86",
"TrunkPort1": "5061",
"TrunkPort2": "5060",
"TrunkTransport1": "UDP",
"TrunkTransport2": "TCP",
"TrunkUri1": "https://pstn.joonto.com",
"TrunkUri2": "https://pstn2.joonto.com",
"TrunkEnabled1": true,
"TrunkEnabled2": false,
"Trunk1Priortiy": 10,
"Trunk1Weight": 10,
"Trunk2Priortiy": 20,
"Trunk2Weight": 20,
"HeaderManipulation": "HMI8802029",
"EnableSipRefer": true,
"TransferCallerId": "Transferee/Transferor",
"SymmetricRtp": true,
"EnableTrpSecureTrunk": true,
"EnablePstnTransfer": true,
"IpWhitelist": [{"IpAddress": "20.20.10.10"}, {"IpAddress": "20.20.10.20"}],
"CnamLookup": true,
"TerminationUriSubdomain": "client",
"EnableCallStreaming": true,
"WssUri": "wss://192.67.88.2",
"IntelligentRouteEnabled": true,
"RouteEnabled": true
}curl -X POST https://api.telegent.com/v1.0/voice/routes \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"RouteName": "Main SIP Trunk",
"RouteType": "Trunk",
"VoiceUrl": "https://domain.com",
"VoiceUrlMethod": "POST",
"TrunkIp1": "20.87.87.87",
"TrunkPort1": "5061",
"TrunkTransport1": "UDP",
"RouteEnabled": true
}'import requests
url = "https://api.telegent.com/v1.0/voice/routes"
payload = {
"RouteName": "Main SIP Trunk",
"RouteType": "Trunk",
"VoiceUrl": "https://domain.com",
"VoiceUrlMethod": "POST",
"VoiceUsername": "admin",
"VoicePasswordToken": "passwordORbearerToken",
"CallbackVoiceUrl": "https://apiendpoint.com",
"CallbackVoiceUrlMethod": "POST",
"TrunkIp1": "20.87.87.87",
"TrunkIp2": "20.87.87.86",
"TrunkPort1": "5061",
"TrunkPort2": "5060",
"TrunkTransport1": "UDP",
"TrunkTransport2": "TCP",
"TrunkUri1": "https://pstn.joonto.com",
"TrunkUri2": "https://pstn2.joonto.com",
"TrunkEnabled1": True,
"TrunkEnabled2": False,
"Trunk1Priortiy": 10,
"Trunk1Weight": 10,
"Trunk2Priortiy": 20,
"Trunk2Weight": 20,
"HeaderManipulation": "HMI8802029",
"EnableSipRefer": True,
"TransferCallerId": "Transferee/Transferor",
"SymmetricRtp": True,
"EnableTrpSecureTrunk": True,
"EnablePstnTransfer": True,
"IpWhitelist": [{ "IpAddress": "20.20.10.10" }],
"CnamLookup": True,
"TerminationUriSubdomain": "client",
"EnableCallStreaming": True,
"WssUri": "wss://192.67.88.2",
"RouteEnabled": True,
"IntelligentRouteEnabled": True,
"AccountId": "DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
RouteName: 'Main SIP Trunk',
RouteType: 'Trunk',
VoiceUrl: 'https://domain.com',
VoiceUrlMethod: 'POST',
VoiceUsername: 'admin',
VoicePasswordToken: 'passwordORbearerToken',
CallbackVoiceUrl: 'https://apiendpoint.com',
CallbackVoiceUrlMethod: 'POST',
TrunkIp1: '20.87.87.87',
TrunkIp2: '20.87.87.86',
TrunkPort1: '5061',
TrunkPort2: '5060',
TrunkTransport1: 'UDP',
TrunkTransport2: 'TCP',
TrunkUri1: 'https://pstn.joonto.com',
TrunkUri2: 'https://pstn2.joonto.com',
TrunkEnabled1: true,
TrunkEnabled2: false,
Trunk1Priortiy: 10,
Trunk1Weight: 10,
Trunk2Priortiy: 20,
Trunk2Weight: 20,
HeaderManipulation: 'HMI8802029',
EnableSipRefer: true,
TransferCallerId: 'Transferee/Transferor',
SymmetricRtp: true,
EnableTrpSecureTrunk: true,
EnablePstnTransfer: true,
IpWhitelist: [{IpAddress: '20.20.10.10'}],
CnamLookup: true,
TerminationUriSubdomain: 'client',
EnableCallStreaming: true,
WssUri: 'wss://192.67.88.2',
RouteEnabled: true,
IntelligentRouteEnabled: true,
AccountId: 'DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j'
})
};
fetch('https://api.telegent.com/v1.0/voice/routes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.telegent.com/v1.0/voice/routes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'RouteName' => 'Main SIP Trunk',
'RouteType' => 'Trunk',
'VoiceUrl' => 'https://domain.com',
'VoiceUrlMethod' => 'POST',
'VoiceUsername' => 'admin',
'VoicePasswordToken' => 'passwordORbearerToken',
'CallbackVoiceUrl' => 'https://apiendpoint.com',
'CallbackVoiceUrlMethod' => 'POST',
'TrunkIp1' => '20.87.87.87',
'TrunkIp2' => '20.87.87.86',
'TrunkPort1' => '5061',
'TrunkPort2' => '5060',
'TrunkTransport1' => 'UDP',
'TrunkTransport2' => 'TCP',
'TrunkUri1' => 'https://pstn.joonto.com',
'TrunkUri2' => 'https://pstn2.joonto.com',
'TrunkEnabled1' => true,
'TrunkEnabled2' => false,
'Trunk1Priortiy' => 10,
'Trunk1Weight' => 10,
'Trunk2Priortiy' => 20,
'Trunk2Weight' => 20,
'HeaderManipulation' => 'HMI8802029',
'EnableSipRefer' => true,
'TransferCallerId' => 'Transferee/Transferor',
'SymmetricRtp' => true,
'EnableTrpSecureTrunk' => true,
'EnablePstnTransfer' => true,
'IpWhitelist' => [
[
'IpAddress' => '20.20.10.10'
]
],
'CnamLookup' => true,
'TerminationUriSubdomain' => 'client',
'EnableCallStreaming' => true,
'WssUri' => 'wss://192.67.88.2',
'RouteEnabled' => true,
'IntelligentRouteEnabled' => true,
'AccountId' => 'DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.telegent.com/v1.0/voice/routes"
payload := strings.NewReader("{\n \"RouteName\": \"Main SIP Trunk\",\n \"RouteType\": \"Trunk\",\n \"VoiceUrl\": \"https://domain.com\",\n \"VoiceUrlMethod\": \"POST\",\n \"VoiceUsername\": \"admin\",\n \"VoicePasswordToken\": \"passwordORbearerToken\",\n \"CallbackVoiceUrl\": \"https://apiendpoint.com\",\n \"CallbackVoiceUrlMethod\": \"POST\",\n \"TrunkIp1\": \"20.87.87.87\",\n \"TrunkIp2\": \"20.87.87.86\",\n \"TrunkPort1\": \"5061\",\n \"TrunkPort2\": \"5060\",\n \"TrunkTransport1\": \"UDP\",\n \"TrunkTransport2\": \"TCP\",\n \"TrunkUri1\": \"https://pstn.joonto.com\",\n \"TrunkUri2\": \"https://pstn2.joonto.com\",\n \"TrunkEnabled1\": true,\n \"TrunkEnabled2\": false,\n \"Trunk1Priortiy\": 10,\n \"Trunk1Weight\": 10,\n \"Trunk2Priortiy\": 20,\n \"Trunk2Weight\": 20,\n \"HeaderManipulation\": \"HMI8802029\",\n \"EnableSipRefer\": true,\n \"TransferCallerId\": \"Transferee/Transferor\",\n \"SymmetricRtp\": true,\n \"EnableTrpSecureTrunk\": true,\n \"EnablePstnTransfer\": true,\n \"IpWhitelist\": [\n {\n \"IpAddress\": \"20.20.10.10\"\n }\n ],\n \"CnamLookup\": true,\n \"TerminationUriSubdomain\": \"client\",\n \"EnableCallStreaming\": true,\n \"WssUri\": \"wss://192.67.88.2\",\n \"RouteEnabled\": true,\n \"IntelligentRouteEnabled\": true,\n \"AccountId\": \"DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.telegent.com/v1.0/voice/routes")
.header("Content-Type", "application/json")
.body("{\n \"RouteName\": \"Main SIP Trunk\",\n \"RouteType\": \"Trunk\",\n \"VoiceUrl\": \"https://domain.com\",\n \"VoiceUrlMethod\": \"POST\",\n \"VoiceUsername\": \"admin\",\n \"VoicePasswordToken\": \"passwordORbearerToken\",\n \"CallbackVoiceUrl\": \"https://apiendpoint.com\",\n \"CallbackVoiceUrlMethod\": \"POST\",\n \"TrunkIp1\": \"20.87.87.87\",\n \"TrunkIp2\": \"20.87.87.86\",\n \"TrunkPort1\": \"5061\",\n \"TrunkPort2\": \"5060\",\n \"TrunkTransport1\": \"UDP\",\n \"TrunkTransport2\": \"TCP\",\n \"TrunkUri1\": \"https://pstn.joonto.com\",\n \"TrunkUri2\": \"https://pstn2.joonto.com\",\n \"TrunkEnabled1\": true,\n \"TrunkEnabled2\": false,\n \"Trunk1Priortiy\": 10,\n \"Trunk1Weight\": 10,\n \"Trunk2Priortiy\": 20,\n \"Trunk2Weight\": 20,\n \"HeaderManipulation\": \"HMI8802029\",\n \"EnableSipRefer\": true,\n \"TransferCallerId\": \"Transferee/Transferor\",\n \"SymmetricRtp\": true,\n \"EnableTrpSecureTrunk\": true,\n \"EnablePstnTransfer\": true,\n \"IpWhitelist\": [\n {\n \"IpAddress\": \"20.20.10.10\"\n }\n ],\n \"CnamLookup\": true,\n \"TerminationUriSubdomain\": \"client\",\n \"EnableCallStreaming\": true,\n \"WssUri\": \"wss://192.67.88.2\",\n \"RouteEnabled\": true,\n \"IntelligentRouteEnabled\": true,\n \"AccountId\": \"DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telegent.com/v1.0/voice/routes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"RouteName\": \"Main SIP Trunk\",\n \"RouteType\": \"Trunk\",\n \"VoiceUrl\": \"https://domain.com\",\n \"VoiceUrlMethod\": \"POST\",\n \"VoiceUsername\": \"admin\",\n \"VoicePasswordToken\": \"passwordORbearerToken\",\n \"CallbackVoiceUrl\": \"https://apiendpoint.com\",\n \"CallbackVoiceUrlMethod\": \"POST\",\n \"TrunkIp1\": \"20.87.87.87\",\n \"TrunkIp2\": \"20.87.87.86\",\n \"TrunkPort1\": \"5061\",\n \"TrunkPort2\": \"5060\",\n \"TrunkTransport1\": \"UDP\",\n \"TrunkTransport2\": \"TCP\",\n \"TrunkUri1\": \"https://pstn.joonto.com\",\n \"TrunkUri2\": \"https://pstn2.joonto.com\",\n \"TrunkEnabled1\": true,\n \"TrunkEnabled2\": false,\n \"Trunk1Priortiy\": 10,\n \"Trunk1Weight\": 10,\n \"Trunk2Priortiy\": 20,\n \"Trunk2Weight\": 20,\n \"HeaderManipulation\": \"HMI8802029\",\n \"EnableSipRefer\": true,\n \"TransferCallerId\": \"Transferee/Transferor\",\n \"SymmetricRtp\": true,\n \"EnableTrpSecureTrunk\": true,\n \"EnablePstnTransfer\": true,\n \"IpWhitelist\": [\n {\n \"IpAddress\": \"20.20.10.10\"\n }\n ],\n \"CnamLookup\": true,\n \"TerminationUriSubdomain\": \"client\",\n \"EnableCallStreaming\": true,\n \"WssUri\": \"wss://192.67.88.2\",\n \"RouteEnabled\": true,\n \"IntelligentRouteEnabled\": true,\n \"AccountId\": \"DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j\"\n}"
response = http.request(request)
puts response.read_body{
"CallRouteId": "CRID-509de94f-79cc-429b-a317-2102654dabbb",
"AccountId": "AID-ab12345-2725-45a1-bd5e-526ed19799xx",
"RouteName": "Main SIP Trunk",
"RouteType": "Trunk",
"VoiceUrl": "https://domain.com",
"VoiceUrlMethod": "POST",
"TrunkIp1": "20.87.87.87",
"TrunkIp2": "20.87.87.86",
"TrunkPort1": "5061",
"TrunkPort2": "5060",
"TrunkTransport1": "UDP",
"TrunkTransport2": "TCP",
"TrunkUri1": "https://pstn.joonto.com",
"TrunkUri2": "https://pstn2.joonto.com",
"TrunkEnabled1": true,
"TrunkEnabled2": false,
"Trunk1Priortiy": 10,
"Trunk1Weight": 10,
"Trunk2Priortiy": 20,
"Trunk2Weight": 20,
"HeaderManipulation": "HMI8802029",
"EnableSipRefer": true,
"TransferCallerId": "Transferee/Transferor",
"SymmetricRtp": true,
"EnableTrpSecureTrunk": true,
"EnablePstnTransfer": true,
"CnamLookup": true,
"TerminationUriSubdomain": "client",
"EnableCallStreaming": true,
"WssUri": "wss://192.67.88.2",
"IntelligentRouteEnabled": true,
"RouteEnabled": true,
"IpWhiteList": []
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}Body
Friendly name for voice route
"Main SIP Trunk"
Type of voice routing
Trunk, URL, Forward "Trunk"
Webhook URL for voice events
"https://domain.com"
HTTP method for voice URL
GET, POST "POST"
Authentication type
None, Basic, Bearer Username for auth
"admin"
Password or token
"passwordORbearerToken"
Callback URL
"https://apiendpoint.com"
GET, POST "POST"
Primary SIP trunk IP
"20.87.87.87"
Secondary SIP trunk IP
"20.87.87.86"
Primary trunk port
"5061"
Secondary trunk port
"5060"
Primary transport protocol
UDP, TCP, TLS "UDP"
Secondary transport protocol
UDP, TCP, TLS "TCP"
"https://pstn.joonto.com"
"https://pstn2.joonto.com"
Enable primary trunk
true
Enable secondary trunk
false
Priority for trunk 1
10
Weight for trunk 1
10
Priority for trunk 2
20
Weight for trunk 2
20
Header manipulation ID
"HMI8802029"
Enable SIP REFER
true
Caller ID for transfers
"Transferee/Transferor"
Enable symmetric RTP
true
Enable secure trunk
true
Enable PSTN transfer
true
IP whitelist
Show child attributes
Show child attributes
Enable CNAM lookup
true
Termination URI subdomain
"client"
Enable call streaming
true
WebSocket secure URI
"wss://192.67.88.2"
Enable/disable route
true
Enable intelligent routing features for this voice route
true
Account ID to associate with this voice route
"DID-1e8939ab-3f3c-4db1-89d7-956d80fd793j"
Response
Success — returns the newly created Voice Route ID (CRID)
The response is of type object.