astonishing-action-92265
12/19/2025, 10:15 AMtall-airline-16756
12/19/2025, 10:16 AMtall-airline-16756
12/19/2025, 10:16 AMastonishing-action-92265
12/19/2025, 10:18 AMtall-airline-16756
12/19/2025, 10:18 AMST_VZFTBC5KUU4b in project p_3bohsz3zre5.
Quick clarification so I give exact commands:
1. Do you want call-level logs (call history: timestamps, status, duration, errors) or raw SIP signaling (INVITE/200/ACK)?
◦ Call-level logs are accessible via Telephony/Call Logs, API, or webhooks.
◦ Raw SIP signaling is not user-accessible and requires escalation.
1. Time range: what start + end times (or preset like last 24h / 7d)?
2. Retrieval method: prefer CLI (lk) or HTTP API (curl)?
3. JSON format detail: single JSON array, newline-delimited JSON (NDJSON), or JSON per call?
Answer those and I’ll provide the exact CLI or curl commands and the steps to download the JSON. If you need raw SIP signaling, confirm and I’ll escalate.
Sources: Webhooks | LiveKit docs | Secure trunking | LiveKit docs | SIP outbound trunk | LiveKit docs | SIP APIs | LiveKit docsastonishing-action-92265
12/19/2025, 10:20 AMtall-airline-16756
12/19/2025, 10:21 AMlk CLI is installed and authenticated (LIVEKIT_URL + API credentials).
• Run and filter, then slurp into one JSON array:
lk agent logs --log-type=deploy --project=p_3bohsz3zre5 --json \
| jq -s 'map(select((.message // "") | contains("ST_VZFTBC5KUU4b")))'
• Output: a single JSON array of log objects that reference your trunk ID. Save to file:
lk agent logs --log-type=deploy --project=p_3bohsz3zre5 --json \
| jq -s 'map(select((.message // "") | contains("ST_VZFTBC5KUU4b")))' > trunk-ST_VZFTBC5KUU4b-logs.json
2) HTTP API (stream + post-process)
• Use the AgentService StreamAgentLog endpoint with a Bearer token that has agent privileges.
Example curl (replace <TOKEN> and domain):
curl -N -X POST \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"project":"p_3bohsz3zre5","logTypes":["AGENT_LOG_TYPE_DEPLOY"]}' \
<https://cloud-api.livekit.io/twirp/livekit.AgentService/StreamAgentLog> \
| jq -s 'map(select((.message // "") | contains("ST_VZFTBC5KUU4b")))' \
> trunk-ST_VZFTBC5KUU4b-logs.json
Notes and tips
• These methods return call-level events present in agent/deploy logs (call initiated/ended, statuses, errors). If some call events are not present, widen the time range by running longer or re-running the stream.
• The filtering looks for the trunk ID inside the message field; if your logs use a structured attribute (e.g., attributes["sip.trunkID"]), I can provide a tighter jq filter—tell me which field appears in your logs sample.
• The output file will be a single JSON array ready for processing or ingestion.
Would you like me to:
• Provide a jq filter that matches a structured field instead of message, or
• Give a short script to paginate/stream and keep only events within a specific time range? Sources: SIP participant | LiveKit docs | Rooms, participants, and tracks | LiveKit docs | Server-side | livekit/livekit_composite | DeepWikiastonishing-action-92265
12/19/2025, 10:41 AMtall-airline-16756
12/19/2025, 10:42 AMmessage (for example attributes["sip.trunkID"] or level / error fields), tell me a sample log line and I’ll tighten the filter.
1) CLI (recommended)
• Command streams agent/deploy logs, filters for your trunk, outbound calls, and error text, then outputs a single JSON array:
lk agent logs --log-type=deploy --project=p_3bohsz3zre5 --json \
| jq -s 'map(select(
((.message // "") | contains("ST_VZFTBC5KUU4b")) and
((.message // "") | test("outbound|OUTBOUND|direction=OUTBOUND"; "i")) and
((.message // "") | test("error|failed|failure|hangup_code|status: [45][0-9]{2}"; "i"))
))'
• Save to file:
lk agent logs --log-type=deploy --project=p_3bohsz3zre5 --json \
| jq -s 'map(select(
((.message // "") | contains("ST_VZFTBC5KUU4b")) and
((.message // "") | test("outbound|direction=OUTBOUND"; "i")) and
((.message // "") | test("error|failed|failure|hangup_code|status: [45][0-9]{2}"; "i"))
))' > outbound-errors-ST_VZFTBC5KUU4b.json
2) HTTP API (stream + post-process)
• Stream agent logs and post-process into one JSON array:
curl -N -X POST \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"project":"p_3bohsz3zre5","logTypes":["AGENT_LOG_TYPE_DEPLOY"]}' \
<https://cloud-api.livekit.io/twirp/livekit.AgentService/StreamAgentLog> \
| jq -s 'map(select(
((.message // "") | contains("ST_VZFTBC5KUU4b")) and
((.message // "") | test("outbound|direction=OUTBOUND"; "i")) and
((.message // "") | test("error|failed|failure|hangup_code|status: [45][0-9]{2}"; "i"))
))' \
> outbound-errors-ST_VZFTBC5KUU4b.json
What these filters look for
• Trunk ID present in the log text.
• Indicators of outbound direction (case-insensitive).
• Error indicators: words like error/failed/failure, hangup codes, or 4xx/5xx SIP status patterns.
If your logs are structured with fields (example: attributes["sip.trunkID"], level, error), use this tighter jq filter instead — replace field names to match your logs:
jq -s 'map(select(
(.attributes["sip.trunkID"] == "ST_VZFTBC5KUU4b") and
(.attributes.direction == "OUTBOUND") and
(.level == "error" or (.error? | length > 0) or (.attributes.hangup_code? // 0 > 0))
))'
Next step
• If you want, paste a single sample log line (one JSON object) and I’ll give the exact jq filter to match your log structure and ensure no false positives.astonishing-action-92265
12/19/2025, 10:43 AMtall-airline-16756
12/19/2025, 10:44 AMjq and --json not supported). I’ll give a corrected, minimal set of steps and exact commands to get outbound call logs with errors for trunk ST_VZFTBC5KUU4b in project p_3bohsz3zre5, output as a single JSON array.
1) Install jq (if not installed)
• macOS (Homebrew):
brew install jq
2) Use the SIP logs CLI (no --json flag)
• Recommended command — streams SIP call events, filters for your trunk, outbound direction, and error entries, then slurps into one JSON array and saves to file:
lk sip logs --project=p_3bohsz3zre5 \
| jq -s 'map(select((.trunk_id == "ST_VZFTBC5KUU4b") and (.direction == "OUTBOUND") and (.error or (.sip_status_code|tostring|test("^[45]")))))' \
> outbound-errors-ST_VZFTBC5KUU4b.json
3) Alternate: HTTP API stream (if you prefer curl)
• Replace <TOKEN> with a valid Bearer token:
curl -N -X POST \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"project":"p_3bohsz3zre5","logTypes":["AGENT_LOG_TYPE_DEPLOY"]}' \
<https://cloud-api.livekit.io/twirp/livekit.AgentService/StreamAgentLog> \
| jq -s 'map(select((.trunk_id == "ST_VZFTBC5KUU4b" or (.message//"" | contains("ST_VZFTBC5KUU4b"))) and ((.direction=="OUTBOUND") or (.message//"" | test("outbound";"i"))) and (.error or (.sip_status_code|tostring|test("^[45]")))))' \
> outbound-errors-ST_VZFTBC5KUU4b.json
Notes
• The CLI lk sip logs typically emits structured JSON with fields like trunk_id, direction, sip_status_code, and error. The jq filter above prefers structured fields but will fall back to message-text checks in the API stream command.
• If the saved file is empty, run a small sample to inspect structure:
lk sip logs --project=p_3bohsz3zre5 --limit=5
Paste one sample JSON log here and I’ll refine the jq filter to match your exact field names and avoid false positives.
Would you like me to provide a short script to stream over a specific time range or continuously tail new logs?astonishing-action-92265
12/19/2025, 10:46 AMtall-airline-16756
12/19/2025, 10:46 AMlk version doesn't have sip logs and some flags differ. Here's the minimal, corrected steps to get outbound call logs with errors for trunk ST_VZFTBC5KUU4b in project p_3bohsz3zre5 and save them as a single JSON array.
1) Install jq (if missing)
brew install jq
2) Preferred CLI command (uses telephony logs)
lk telephony logs --project=p_3bohsz3zre5 --limit=100 \
| jq -s 'map(select((.trunk_id == "ST_VZFTBC5KUU4b") and (.direction == "OUTBOUND") and (.error or (.sip_status_code|tostring|test("^[45]")))))' \
> outbound-errors-ST_VZFTBC5KUU4b.json
• Increase --limit as needed.
• The filter looks for structured trunk_id, direction, error, or 4xx/5xx SIP codes.
3) If lk telephony logs is not available Use the API endpoint:
curl -N -X POST \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"project":"p_3bohsz3zre5","logTypes":["AGENT_LOG_TYPE_DEPLOY"]}' \
<https://cloud-api.livekit.io/twirp/livekit.AgentService/StreamAgentLog> \
| jq -s 'map(select((.trunk_id == "ST_VZFTBC5KUU4b" or (.message//"" | contains("ST_VZFTBC5KUU4b"))) and ((.direction=="OUTBOUND") or (.message//""|test("outbound";"i"))) and (.error or (.sip_status_code|tostring|test("^[45]")))))' \
> outbound-errors-ST_VZFTBC5KUU4b.json
• Replace <TOKEN> with a valid Bearer token.
If the output file is empty or you get different field names, paste one sample JSON log line here and I’ll give the exact jq filter to match your logs.
Sources: LiveKit CLI Setup | LiveKit Docs | SIP APIs | LiveKit docs | Say hello to improved Cloud analyticsastonishing-action-92265
12/19/2025, 10:47 AMtall-airline-16756
12/19/2025, 10:47 AMlk token create --api-key <API_KEY> --api-secret <API_SECRET> \
--grant '{"sip":{"admin":true}}'
• The command prints a JWT you can use as Authorization: Bearer <token>.
2) Generate in code (example Node.js)
const { createJwt } = require('livekit-server-sdk'); // or use your JWT library
const apiKey = process.env.LIVEKIT_API_KEY;
const apiSecret = process.env.LIVEKIT_API_SECRET;
const grants = {
sip: { admin: true } // or agent grant if using AgentService
};
const token = createJwt({ apiKey, apiSecret, grants, exp: Math.floor(Date.now()/1000) + 300 });
console.log(token);
Notes
• Use the API key/secret from your LiveKit Cloud project settings. Keep them secret.
• For streaming AgentService logs you may need the agent grant instead of sip. If a command/API returns permission errors, regenerate with sip.admin=true and/or an agent grant.
• Set a short expiry for tokens used in scripts (e.g., 5–15 minutes).
If you want, tell me which method you prefer (CLI or Node/Python), and I’ll give the exact command or code snippet with your project details.astonishing-action-92265
12/19/2025, 10:48 AMastonishing-action-92265
12/19/2025, 10:48 AMtall-airline-16756
12/19/2025, 10:48 AMlk token create --api-key <API_KEY> --api-secret <API_SECRET> --grant '{"sip":{"admin":true}}' --exp 300
For AgentService logs (if you get permission errors):
lk token create --api-key <API_KEY> --api-secret <API_SECRET> --grant '{"agent":{}}' --exp 300
Both print the token — use it as: Authorization: Bearer <token>
If you want, paste your API key name (not the secret) and I can show the exact command with your project id.astonishing-action-92265
12/19/2025, 10:49 AMtall-airline-16756
12/19/2025, 10:49 AMbrew install jq
2) Create a short-lived Bearer token (SIP admin):
lk token create --api-key <API_KEY> --api-secret <API_SECRET> --grant '{"sip":{"admin":true}}' --exp 300
Copy the printed token.
3) Fetch outbound call logs with errors and save as one JSON array:
lk telephony logs --project=p_3bohsz3zre5 --limit=200 \
| jq -s 'map(select((.trunk_id=="ST_VZFTBC5KUU4b") and (.direction=="OUTBOUND") and (.error or (.sip_status_code|tostring|test("^[45]")))))' \
> outbound-errors-ST_VZFTBC5KUU4b.json
If lk telephony logs isn’t available in your CLI, use this API fallback (replace <TOKEN>):
curl -N -X POST \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"project":"p_3bohsz3zre5","logTypes":["AGENT_LOG_TYPE_DEPLOY"]}' \
<https://cloud-api.livekit.io/twirp/livekit.AgentService/StreamAgentLog> \
| jq -s 'map(select((.trunk_id=="ST_VZFTBC5KUU4b" or (.message//""|contains("ST_VZFTBC5KUU4b"))) and ((.direction=="OUTBOUND") or (.message//""|test("outbound";"i"))) and (.error or (.sip_status_code|tostring|test("^[45]")))))' \
> outbound-errors-ST_VZFTBC5KUU4b.json
If the output file is empty, run a small sample to inspect structure:
lk telephony logs --project=p_3bohsz3zre5 --limit=5
Paste one sample JSON log here and I’ll tighten the jq filter to match exact field names.astonishing-action-92265
12/19/2025, 11:00 AMtall-airline-16756
12/19/2025, 11:00 AMlk is already installed and authenticated?
If yes, run this exact sequence (installs jq if missing, creates a short token, then fetches outbound-error events for trunk ST_VZFTBC5KUU4b and saves a single JSON array):
1) Install jq (if needed)
brew install jq
2) Create a short-lived SIP admin token (replace <API_KEY> and <API_SECRET>)
TOKEN=$(lk token create --api-key <API_KEY> --api-secret <API_SECRET> --grant '{"sip":{"admin":true}}' --exp 300)
3) Fetch outbound call events with errors and save as one JSON array
lk telephony logs --project=p_3bohsz3zre5 --limit=500 \
| jq -s 'map(select((.trunk_id=="ST_VZFTBC5KUU4b") and (.direction=="OUTBOUND") and (.error or (.sip_status_code|tostring|test("^[45]")))))' \
> outbound-errors-ST_VZFTBC5KUU4b.json
If lk telephony logs is not available in your lk version, run this API fallback (replace <TOKEN> with the token from step 2 — if you used the TOKEN variable above, use "$TOKEN"):
curl -N -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"project":"p_3bohsz3zre5","logTypes":["AGENT_LOG_TYPE_DEPLOY"]}' \
<https://cloud-api.livekit.io/twirp/livekit.AgentService/StreamAgentLog> \
| jq -s 'map(select((.trunk_id=="ST_VZFTBC5KUU4b" or (.message//""|contains("ST_VZFTBC5KUU4b"))) and ((.direction=="OUTBOUND") or (.message//""|test("outbound";"i"))) and (.error or (.sip_status_code|tostring|test("^[45]")))))' \
> outbound-errors-ST_VZFTBC5KUU4b.json
If the resulting file is empty, paste a single sample log line here and I’ll refine the jq filter to match your log fields.
Sources: Webhooks | LiveKit docs | server-sdk-js | livekit/livekit_composite | DeepWiki | SIP APIs | LiveKit docs | SIP outbound trunk | LiveKit docs | Create and configure a Plivo SIP trunk | LiveKit docsastonishing-action-92265
12/19/2025, 11:35 AMtall-airline-16756
12/19/2025, 11:35 AMbrew install jq
2) Create a short-lived SIP admin token (optional for API fallback)
lk token create --api-key <API_KEY> --api-secret <API_SECRET> --grant '{"sip":{"admin":true}}' --exp 300
3) Stream and filter CLI telephony logs (no --limit)
lk telephony logs --project p_3bohsz3zre5 \
| jq -s 'map(select((.trunk_id=="ST_VZFTBC5KUU4b") and (.direction=="OUTBOUND") and (.error or (.sip_status_code|tostring|test("^[45]")))))' \
> outbound-errors-ST_VZFTBC5KUU4b.json
If lk telephony logs is unavailable in your lk version, use the API fallback (replace <TOKEN> with the token from step 2 or your existing token):
curl -N -X POST \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-d '{"project":"p_3bohsz3zre5","logTypes":["AGENT_LOG_TYPE_DEPLOY"]}' \
<https://cloud-api.livekit.io/twirp/livekit.AgentService/StreamAgentLog> \
| jq -s 'map(select((.trunk_id=="ST_VZFTBC5KUU4b" or (.message//""|contains("ST_VZFTBC5KUU4b"))) and ((.direction=="OUTBOUND") or (.message//""|test("outbound";"i"))) and (.error or (.sip_status_code|tostring|test("^[45]")))))' \
> outbound-errors-ST_VZFTBC5KUU4b.json
If the output file is empty or you get no matches, paste one raw JSON log line here and I’ll give the exact jq filter that matches your log structure.