Do I still need to set up outbound trunk if using ...
# ask-ai
m
Do I still need to set up outbound trunk if using a phone number purchased through Livekit?
t
Thanks for reaching out, Fancy. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Short answer: No — you do not need to set up an outbound trunk to receive calls on a phone number purchased through LiveKit. Important detail: LiveKit-purchased numbers support inbound calling only. If you want to make outbound calls, you must configure an outbound trunk with a third‑party SIP provider (e.g., Plivo, Twilio, Telnyx) and add that trunk to LiveKit. Sources: LiveKit Phone Numbers | LiveKit docs | Create and configure a Plivo SIP trunk | LiveKit docs | Making outbound calls | LiveKit docs
m
If I use a Twilio number that is trunking to Livekit for inbound calls, can the same number be used for outbound calls?
t
You're asking whether a Twilio number already trunked to LiveKit for inbound calls can also be used for outbound calls — yes. What you need to do: • Configure outbound (termination) on the Twilio SIP trunk (create a Credential List and associate credentials). • Create an outbound trunk in LiveKit using Twilio’s SIP domain (e.g.,
<http://my-trunk.pstn.twilio.com|my-trunk.pstn.twilio.com>
) and provide the `authUsername`/`authPassword`. • In the LiveKit outbound trunk, include the Twilio number(s) you want to use as caller ID (or use
["*"]
and set the number per call via
sip_number
). Once those steps are done, you can place outbound calls from LiveKit using the same Twilio number that receives inbound calls. Would you like the exact LiveKit request fields or an example
CreateSIPParticipant
call to set the caller ID? Sources: Create and configure a Twilio SIP trunk | LiveKit docs | SIP outbound trunk | LiveKit docs | Making outbound calls | LiveKit docs | Using Wavix to accept and make calls | LiveKit docs
m
what should I choose for Transport and Media Encryption when setting the Livekit outbound trunk up?
t
You're asking what to choose for Transport and Media Encryption when creating a LiveKit outbound trunk. Recommended settings: • Transport: SIP_TRANSPORT_TLS — use TLS to encrypt SIP signaling. Use TCP/UDP only if your provider doesn't support TLS (not recommended for production). • Media Encryption: SIP_MEDIA_ENCRYPT_REQUIRE (or SIP_MEDIA_ENCRYPT_ALLOW if you need fallbacks) — require SRTP for encrypted media; set to ALLOW if you want SRTP when available. Media encryption must also be enabled on your SIP provider. Example JSON snippet:
Copy code
{
  "transport": "SIP_TRANSPORT_TLS",
  "mediaEncryption": "SIP_MEDIA_ENCRYPT_REQUIRE"
}
Would you like the exact LiveKit API fields for creating the trunk or provider-specific notes (e.g., Twilio/Telnyx) for enabling SRTP? Sources: Secure trunking | LiveKit docs | SIP APIs | LiveKit docs
m
Is there a way I can test if a number is correctly set up for outbound trunking with livekit
t
You're asking how to test whether a number is correctly set up for outbound trunking with LiveKit. The simplest, direct test is to place an outbound call through your configured outbound trunk using the CreateSIPParticipant API — if the call connects, the trunk and number are working. Steps to test: 1. Confirm an outbound trunk exists (has
address
, auth creds, and the phone number listed). You can list trunks with
lk sip outbound list
. 2. Create a SIP participant that places an outbound call. Example JSON:
Copy code
{
  "sip_trunk_id": "<your-outbound-trunk-id>",
  "sip_call_to": "<test-phone-number>",
  "room_name": "test-room",
  "participant_identity": "test-participant",
  "participant_name": "Test Caller",
  "wait_until_answered": true
}
1. Run the request (CLI:
lk sip participant create sip-participant.json
or call the CreateSIPParticipant API). 2. Verify the call connects — the participant will join the LiveKit room and
sip.callStatus
becomes
active
. 3. If it fails, check the error returned by the CreateSIPParticipant request, LiveKit call logs, and your SIP provider logs for SIP response codes (authentication, routing, SRTP issues, etc.). Optional tests: • Use
["*"]
wildcard trunk and set
sip_number
per call to test different caller IDs. • Dispatch a voice agent that uses CreateSIPParticipant to automate repeatable tests. Would you like an exact API request example for your environment (curl or SDK) or help interpreting any specific error codes you see? Sources: Make outbound calls | LiveKit docs | SIP troubleshooting guide | LiveKit docs | Agents telephony integration | LiveKit docs
m
I'm getting this error from transferring the call. How to fix?
Copy code
[TRANSFER] Error transferring call: TwirpError(code=permission_denied, message=twirp error unknown: sip status 403: Forbidden, status=403, metadata={'error_details': 'CAcSGXNpcCBzdGF0dXMgNDAzOiBGb3JiaWRkZW4aNwoldHlwZS5nb29nbGVhcGlzLmNvbS9saXZla2l0LlNJUFN0YXR1cxIOCJMDEglGb3JiaWRkZW4=', 'sip_status': 'Forbidden', 'sip_status_code': '403'})
t
You're hitting a SIP-level permission issue: the 403 Forbidden on transfer means the SIP provider rejected the REFER request LiveKit sent. To fix it, check the following: 1. Enable call transfer (SIP REFER) on your SIP trunk provider • Twilio: enable Call Transfer / PSTN Transfer for the trunk (or set transfer-mode). • Telnyx/others: enable SIP REFER/transfer in the connection settings. 1. Ensure PSTN transfer is allowed if transferring to phone numbers • Some providers distinguish SIP-to-SIP vs PSTN transfers; enable PSTN transfer explicitly. 1. Verify the transfer destination format • Use a valid tel or SIP URI, e.g.
tel:+15105550100
or
<sip:+15105550100@sip.provid>er.com
. • If using a domain, ensure it’s resolvable and allowed by your provider. 1. Confirm outbound trunk credentials & endpoint • Check `authUsername`/`authPassword` and
address
in your LiveKit outbound trunk match the provider’s SIP trunk credentials and domain. 1. Check region / regulatory restrictions • Some regions block transfers across borders. If needed, set
destination_country
or use region-pinned trunks that match the destination. 1. Ensure secure trunking settings if required • If provider requires TLS/SRTP, set
transport: SIP_TRANSPORT_TLS
and
mediaEncryption: SIP_MEDIA_ENCRYPT_REQUIRE
and enable SRTP on the provider side. 1. Inspect logs for provider error details • Check LiveKit telephony call logs and your SIP provider logs for the exact SIP response and reason phrases (provider logs often show why REFER was rejected). If you want, share: • Your SIP provider (Twilio/Telnyx/other), • The sanitized
TransferSIPParticipant
request (no secrets), • Any provider-side log lines or SIP response details, and I’ll help interpret them and suggest the exact config change. Sources: SIP troubleshooting guide | LiveKit docs | Secure trunking | LiveKit docs | SIP APIs | LiveKit docs | SIP outbound trunk | LiveKit docs
m
When you said PSTN, should I configure the number with outbound trunk or with inbound trunk?
t
PSTN (calling phone numbers) for transfers must be enabled on the outbound trunk. • Inbound trunks handle receiving calls to your number. • Outbound trunks handle placing/terminating calls to PSTN numbers and must allow PSTN transfer / SIP REFER for transfers to phone numbers. So enable PSTN transfer (and SIP REFER) in your SIP provider and ensure your LiveKit outbound trunk is configured to use that provider (correct
address
, credentials, and
numbers
).