Criar tronco SIP
curl --request POST \
--url https://suasofia.online/api/user/phone-numbers/sip-trunks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sip_trunk_type": "<string>",
"phone_number": "<string>",
"nickname": "<string>",
"sip_username": "<string>",
"sip_password": "<string>",
"sip_address": "<string>",
"sip_calling_format": "<string>",
"inbound_authorization_type": "<string>",
"allowed_inbound_ips": [
{}
],
"country_code": "<string>",
"outbound_proxy": true
}
'import requests
url = "https://suasofia.online/api/user/phone-numbers/sip-trunks"
payload = {
"sip_trunk_type": "<string>",
"phone_number": "<string>",
"nickname": "<string>",
"sip_username": "<string>",
"sip_password": "<string>",
"sip_address": "<string>",
"sip_calling_format": "<string>",
"inbound_authorization_type": "<string>",
"allowed_inbound_ips": [{}],
"country_code": "<string>",
"outbound_proxy": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sip_trunk_type: '<string>',
phone_number: '<string>',
nickname: '<string>',
sip_username: '<string>',
sip_password: '<string>',
sip_address: '<string>',
sip_calling_format: '<string>',
inbound_authorization_type: '<string>',
allowed_inbound_ips: [{}],
country_code: '<string>',
outbound_proxy: true
})
};
fetch('https://suasofia.online/api/user/phone-numbers/sip-trunks', 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://suasofia.online/api/user/phone-numbers/sip-trunks",
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([
'sip_trunk_type' => '<string>',
'phone_number' => '<string>',
'nickname' => '<string>',
'sip_username' => '<string>',
'sip_password' => '<string>',
'sip_address' => '<string>',
'sip_calling_format' => '<string>',
'inbound_authorization_type' => '<string>',
'allowed_inbound_ips' => [
[
]
],
'country_code' => '<string>',
'outbound_proxy' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://suasofia.online/api/user/phone-numbers/sip-trunks"
payload := strings.NewReader("{\n \"sip_trunk_type\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"nickname\": \"<string>\",\n \"sip_username\": \"<string>\",\n \"sip_password\": \"<string>\",\n \"sip_address\": \"<string>\",\n \"sip_calling_format\": \"<string>\",\n \"inbound_authorization_type\": \"<string>\",\n \"allowed_inbound_ips\": [\n {}\n ],\n \"country_code\": \"<string>\",\n \"outbound_proxy\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://suasofia.online/api/user/phone-numbers/sip-trunks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sip_trunk_type\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"nickname\": \"<string>\",\n \"sip_username\": \"<string>\",\n \"sip_password\": \"<string>\",\n \"sip_address\": \"<string>\",\n \"sip_calling_format\": \"<string>\",\n \"inbound_authorization_type\": \"<string>\",\n \"allowed_inbound_ips\": [\n {}\n ],\n \"country_code\": \"<string>\",\n \"outbound_proxy\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://suasofia.online/api/user/phone-numbers/sip-trunks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sip_trunk_type\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"nickname\": \"<string>\",\n \"sip_username\": \"<string>\",\n \"sip_password\": \"<string>\",\n \"sip_address\": \"<string>\",\n \"sip_calling_format\": \"<string>\",\n \"inbound_authorization_type\": \"<string>\",\n \"allowed_inbound_ips\": [\n {}\n ],\n \"country_code\": \"<string>\",\n \"outbound_proxy\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "Tronco SIP criado com sucesso.",
"data": {
"id": 42,
"phone_number": "1000",
"nickname": "Provedor X — Principal",
"sip_username": "myuser",
"sip_address": "sip.provider.com",
"sip_calling_format": "+e164",
"inbound_authorization_type": "auth",
"allowed_inbound_ips": null,
"outbound_proxy": false,
"country_code": "US",
"inbound_trunk_id": "ST_xxxxxxxxxxxx",
"outbound_trunk_id": "ST_yyyyyyyyyyyy",
"created_at": "2026-03-31T10:00:00.000000Z",
"updated_at": "2026-03-31T10:00:00.000000Z"
}
}
{
"message": "Tronco SIP criado com sucesso.",
"data": {
"id": 43,
"phone_number": "+14155551234",
"nickname": null,
"sip_username": "trunk_user",
"sip_address": "sip.provider.com",
"sip_calling_format": "e164",
"inbound_authorization_type": "ip",
"allowed_inbound_ips": ["203.0.113.10", "198.51.100.20"],
"outbound_proxy": true,
"country_code": "US",
"inbound_trunk_id": "ST_xxxxxxxxxxxx",
"outbound_trunk_id": "ST_yyyyyyyyyyyy",
"created_at": "2026-03-31T10:00:00.000000Z",
"updated_at": "2026-03-31T10:00:00.000000Z"
}
}
{
"error": "Um tronco SIP com o mesmo número de telefone, nome de usuário e endereço já existe."
}
{
"message": "Os dados fornecidos são inválidos.",
"errors": {
"sip_address": ["O endereço do servidor SIP é obrigatório."],
"sip_calling_format": ["O formato de chamada SIP deve ser um dos seguintes: +e164, e164, national."]
}
}
{
"error": "Falha ao criar tronco SIP. Por favor, tente novamente ou entre em contato com o suporte."
}
SIP Trunks
Criar tronco SIP
Crie um novo tronco SIP com credenciais, endereço e configurações de proxy
POST
/
user
/
phone-numbers
/
sip-trunks
Criar tronco SIP
curl --request POST \
--url https://suasofia.online/api/user/phone-numbers/sip-trunks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sip_trunk_type": "<string>",
"phone_number": "<string>",
"nickname": "<string>",
"sip_username": "<string>",
"sip_password": "<string>",
"sip_address": "<string>",
"sip_calling_format": "<string>",
"inbound_authorization_type": "<string>",
"allowed_inbound_ips": [
{}
],
"country_code": "<string>",
"outbound_proxy": true
}
'import requests
url = "https://suasofia.online/api/user/phone-numbers/sip-trunks"
payload = {
"sip_trunk_type": "<string>",
"phone_number": "<string>",
"nickname": "<string>",
"sip_username": "<string>",
"sip_password": "<string>",
"sip_address": "<string>",
"sip_calling_format": "<string>",
"inbound_authorization_type": "<string>",
"allowed_inbound_ips": [{}],
"country_code": "<string>",
"outbound_proxy": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sip_trunk_type: '<string>',
phone_number: '<string>',
nickname: '<string>',
sip_username: '<string>',
sip_password: '<string>',
sip_address: '<string>',
sip_calling_format: '<string>',
inbound_authorization_type: '<string>',
allowed_inbound_ips: [{}],
country_code: '<string>',
outbound_proxy: true
})
};
fetch('https://suasofia.online/api/user/phone-numbers/sip-trunks', 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://suasofia.online/api/user/phone-numbers/sip-trunks",
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([
'sip_trunk_type' => '<string>',
'phone_number' => '<string>',
'nickname' => '<string>',
'sip_username' => '<string>',
'sip_password' => '<string>',
'sip_address' => '<string>',
'sip_calling_format' => '<string>',
'inbound_authorization_type' => '<string>',
'allowed_inbound_ips' => [
[
]
],
'country_code' => '<string>',
'outbound_proxy' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://suasofia.online/api/user/phone-numbers/sip-trunks"
payload := strings.NewReader("{\n \"sip_trunk_type\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"nickname\": \"<string>\",\n \"sip_username\": \"<string>\",\n \"sip_password\": \"<string>\",\n \"sip_address\": \"<string>\",\n \"sip_calling_format\": \"<string>\",\n \"inbound_authorization_type\": \"<string>\",\n \"allowed_inbound_ips\": [\n {}\n ],\n \"country_code\": \"<string>\",\n \"outbound_proxy\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://suasofia.online/api/user/phone-numbers/sip-trunks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sip_trunk_type\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"nickname\": \"<string>\",\n \"sip_username\": \"<string>\",\n \"sip_password\": \"<string>\",\n \"sip_address\": \"<string>\",\n \"sip_calling_format\": \"<string>\",\n \"inbound_authorization_type\": \"<string>\",\n \"allowed_inbound_ips\": [\n {}\n ],\n \"country_code\": \"<string>\",\n \"outbound_proxy\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://suasofia.online/api/user/phone-numbers/sip-trunks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sip_trunk_type\": \"<string>\",\n \"phone_number\": \"<string>\",\n \"nickname\": \"<string>\",\n \"sip_username\": \"<string>\",\n \"sip_password\": \"<string>\",\n \"sip_address\": \"<string>\",\n \"sip_calling_format\": \"<string>\",\n \"inbound_authorization_type\": \"<string>\",\n \"allowed_inbound_ips\": [\n {}\n ],\n \"country_code\": \"<string>\",\n \"outbound_proxy\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "Tronco SIP criado com sucesso.",
"data": {
"id": 42,
"phone_number": "1000",
"nickname": "Provedor X — Principal",
"sip_username": "myuser",
"sip_address": "sip.provider.com",
"sip_calling_format": "+e164",
"inbound_authorization_type": "auth",
"allowed_inbound_ips": null,
"outbound_proxy": false,
"country_code": "US",
"inbound_trunk_id": "ST_xxxxxxxxxxxx",
"outbound_trunk_id": "ST_yyyyyyyyyyyy",
"created_at": "2026-03-31T10:00:00.000000Z",
"updated_at": "2026-03-31T10:00:00.000000Z"
}
}
{
"message": "Tronco SIP criado com sucesso.",
"data": {
"id": 43,
"phone_number": "+14155551234",
"nickname": null,
"sip_username": "trunk_user",
"sip_address": "sip.provider.com",
"sip_calling_format": "e164",
"inbound_authorization_type": "ip",
"allowed_inbound_ips": ["203.0.113.10", "198.51.100.20"],
"outbound_proxy": true,
"country_code": "US",
"inbound_trunk_id": "ST_xxxxxxxxxxxx",
"outbound_trunk_id": "ST_yyyyyyyyyyyy",
"created_at": "2026-03-31T10:00:00.000000Z",
"updated_at": "2026-03-31T10:00:00.000000Z"
}
}
{
"error": "Um tronco SIP com o mesmo número de telefone, nome de usuário e endereço já existe."
}
{
"message": "Os dados fornecidos são inválidos.",
"errors": {
"sip_address": ["O endereço do servidor SIP é obrigatório."],
"sip_calling_format": ["O formato de chamada SIP deve ser um dos seguintes: +e164, e164, national."]
}
}
{
"error": "Falha ao criar tronco SIP. Por favor, tente novamente ou entre em contato com o suporte."
}
Este endpoint cria um novo tronco SIP. A plataforma provisiona automaticamente troncos de entrada e saída na infraestrutura de voz usando as credenciais fornecidas.
Parâmetros do Corpo
string
required
O tipo de tronco SIP:
extension para uma extensão SIP, ou number para um número de telefone (DID). Isso determina o formato esperado do campo phone_number.string
required
A extensão SIP (1-15 caracteres, por exemplo,
1000) quando sip_trunk_type é extension, ou um número de telefone no formato E.164 (por exemplo, +14155551234) quando sip_trunk_type é number.string
Um rótulo curto e amigável para o tronco (por exemplo, “Provedor X — Principal”). Máximo de 50 caracteres.
string
required
Nome de usuário para autenticação SIP (3-128 caracteres)
string
required
Senha para autenticação SIP (mínimo de 3 caracteres)
string
required
O endereço do servidor SIP sem porta (por exemplo,
sip.provider.com)string
required
O formato do número de chamada de saída:
+e164— Internacional com prefixo+(por exemplo,+12025550123)e164— Internacional sem prefixo+(por exemplo,12025550123)national— Formato nacional sem código do país (por exemplo,0741926265)
string
required
Como as chamadas de entrada são autenticadas:
auth— Usa o mesmo nome de usuário e senha SIP configurados para saídaip— Lista branca de endereços IP específicos (requerallowed_inbound_ips)
array
Array de endereços IP permitidos para enviar chamadas de entrada. Obrigatório quando
inbound_authorization_type é ip. Deve conter pelo menos um endereço IP válido.string
required
Código do país ISO 3166-2 onde o tronco SIP está localizado (por exemplo,
US, GB, DE). Quando sip_trunk_type é number, o país é detectado automaticamente a partir do número de telefone, se possível.boolean
Roteie chamadas de saída através de um endereço IP fixo. Padrão:
false. Ative isso apenas se seu provedor SIP exigir autenticação baseada em IP para tráfego de saída.Resposta
string
Mensagem de sucesso
object
O objeto do tronco SIP criado (mesmos campos que Obter tronco SIP)
{
"message": "Tronco SIP criado com sucesso.",
"data": {
"id": 42,
"phone_number": "1000",
"nickname": "Provedor X — Principal",
"sip_username": "myuser",
"sip_address": "sip.provider.com",
"sip_calling_format": "+e164",
"inbound_authorization_type": "auth",
"allowed_inbound_ips": null,
"outbound_proxy": false,
"country_code": "US",
"inbound_trunk_id": "ST_xxxxxxxxxxxx",
"outbound_trunk_id": "ST_yyyyyyyyyyyy",
"created_at": "2026-03-31T10:00:00.000000Z",
"updated_at": "2026-03-31T10:00:00.000000Z"
}
}
{
"message": "Tronco SIP criado com sucesso.",
"data": {
"id": 43,
"phone_number": "+14155551234",
"nickname": null,
"sip_username": "trunk_user",
"sip_address": "sip.provider.com",
"sip_calling_format": "e164",
"inbound_authorization_type": "ip",
"allowed_inbound_ips": ["203.0.113.10", "198.51.100.20"],
"outbound_proxy": true,
"country_code": "US",
"inbound_trunk_id": "ST_xxxxxxxxxxxx",
"outbound_trunk_id": "ST_yyyyyyyyyyyy",
"created_at": "2026-03-31T10:00:00.000000Z",
"updated_at": "2026-03-31T10:00:00.000000Z"
}
}
{
"error": "Um tronco SIP com o mesmo número de telefone, nome de usuário e endereço já existe."
}
{
"message": "Os dados fornecidos são inválidos.",
"errors": {
"sip_address": ["O endereço do servidor SIP é obrigatório."],
"sip_calling_format": ["O formato de chamada SIP deve ser um dos seguintes: +e164, e164, national."]
}
}
{
"error": "Falha ao criar tronco SIP. Por favor, tente novamente ou entre em contato com o suporte."
}
O que acontece após a criação
Quando você cria um tronco SIP, a plataforma automaticamente:- Provisiona um tronco de entrada na infraestrutura de voz — usando autenticação por nome de usuário/senha ou baseada em IP, dependendo da configuração do seu
inbound_authorization_type - Provisiona um tronco de saída — usando o endereço SIP e as credenciais que você forneceu, opcionalmente através do proxy de saída
500 é retornado.
Próximos passos
Após criar um tronco SIP, atribua-o a um assistente de IA:- Criar Assistente — Use o parâmetro
phone_number_id - Atualizar Assistente — Altere o número de telefone em um assistente existente

