SIP Trunks
Parse SIP Destination
Parse and validate a raw SIP destination string into its host, port, user, and transport before attaching it to a trunk.
POST
/
v1
/
sip
/
parse-destination
Parse SIP Destination
curl --request POST \
--url https://api.bland.ai/v1/sip/parse-destination \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"input": "<string>"
}
'import requests
url = "https://api.bland.ai/v1/sip/parse-destination"
payload = { "input": "<string>" }
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: '<string>'})
};
fetch('https://api.bland.ai/v1/sip/parse-destination', 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.bland.ai/v1/sip/parse-destination",
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([
'input' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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.bland.ai/v1/sip/parse-destination"
payload := strings.NewReader("{\n \"input\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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.bland.ai/v1/sip/parse-destination")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/sip/parse-destination")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"valid": true,
"parsed": {
"host": "your.provider.com",
"port": 5061,
"transport": "tls",
"is_private_ip": false,
"normalized": "sip:your.provider.com:5061;transport=tls"
}
},
"errors": null
}
Headers
string
required
Your API key for authentication.
Body
string
required
The SIP destination to parse. Accepts flexible formats — a hostname or IP (
sip.provider.com, 203.0.113.10), a full SIP URI (sip:user@host:5061;transport=tls), or shorthand (tls://host, host:5061).Response
boolean
Whether the input could be parsed into a usable SIP destination.
object
The parsed destination when
valid is true, otherwise null.Show parsed
Show parsed
string
The resolved host or IP address.
number
The port, when present in the input.
string
The user part of the SIP URI, when present.
string
The transport:
"udp", "tcp", or "tls", when present.boolean
true if the host is a private/non-routable IP address.string
The normalized SIP destination string.
host, port, and transport to populate the sip_endpoint and options of a trunk or a POST /v1/sip/attach request.
Example Request
curl -X POST https://api.bland.ai/v1/sip/parse-destination \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"input": "sip:your.provider.com:5061;transport=tls"
}'
{
"data": {
"valid": true,
"parsed": {
"host": "your.provider.com",
"port": 5061,
"transport": "tls",
"is_private_ip": false,
"normalized": "sip:your.provider.com:5061;transport=tls"
}
},
"errors": null
}
Docs for agents: llms.txt
Was this page helpful?
⌘I
Parse SIP Destination
curl --request POST \
--url https://api.bland.ai/v1/sip/parse-destination \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"input": "<string>"
}
'import requests
url = "https://api.bland.ai/v1/sip/parse-destination"
payload = { "input": "<string>" }
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: '<string>'})
};
fetch('https://api.bland.ai/v1/sip/parse-destination', 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.bland.ai/v1/sip/parse-destination",
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([
'input' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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.bland.ai/v1/sip/parse-destination"
payload := strings.NewReader("{\n \"input\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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.bland.ai/v1/sip/parse-destination")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/sip/parse-destination")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"valid": true,
"parsed": {
"host": "your.provider.com",
"port": 5061,
"transport": "tls",
"is_private_ip": false,
"normalized": "sip:your.provider.com:5061;transport=tls"
}
},
"errors": null
}