Skip to content
TriedDocs
Phone numbers

Test SIP connection

Send a SIP OPTIONS probe to any termination URI before you import a number.

POSThttps://api.tried.com.au/test-sip-connection

Needs keys Sends one SIP OPTIONS request to a termination URI and reports the first final response. Any SIP response proves the far end is reachable, and 200 means it accepts Tried. Real probes run when LiveKit (LIVEKIT_URL) is configured or SIP_OPTIONS_REAL=1 is set. Otherwise the result is a simulated 200 with "mock": true and no network traffic.

To test the trunk behind a number you already have, use Test phone number connection.

Request#

Field Type Required Description
termination_uri string Yes Host, optional port and optional ;transport= parameter, for example sip.example.com:5060.
transport string No TCP, UDP or TLS. Overrides the URI's transport. With neither, UDP is used.

The port defaults to 5061 for TLS and 5060 otherwise. The probe waits up to 4 seconds.

Example request#

curl -X POST https://api.tried.com.au/test-sip-connection \
  -H "Authorization: Bearer $TRIED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "termination_uri": "sip.example.com", "transport": "TCP" }'
const res = await fetch("https://api.tried.com.au/test-sip-connection", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TRIED_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ termination_uri: "sip.example.com", transport: "TCP" }),
});
const result = await res.json();
import os, requests

res = requests.post(
    "https://api.tried.com.au/test-sip-connection",
    headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
    json={"termination_uri": "sip.example.com", "transport": "TCP"},
)
result = res.json()

Response#

200 OK

{
  "reachable": true,
  "status_code": 200,
  "reason": "OK",
  "latency_ms": 38,
  "transport": "TCP",
  "target": "sip.example.com:5060"
}
Field Type Description
reachable boolean true when any final SIP response came back.
status_code integer or null SIP status code, for example 200, 403 or 404. null when nothing came back.
reason string or null SIP reason phrase. Mock mode returns OK (mock).
latency_ms integer or null Time to the response.
transport string Transport used.
target string host:port probed.
error string Present when the probe failed, for example timeout, a socket error, or invalid termination URI.
mock boolean Present and true for simulated results.

A failed probe still returns 200 OK, with reachable false.

Errors#

Status When
400 Body validation failed, for example termination_uri: Required.
401 Missing or invalid API key.
403 The key's IP allowlist or scopes reject the request. This route needs the admin scope. Members get The member role is read-only.
429 Rate limit exceeded. See Rate limits.

See Errors for the body format.