Do I need to create a dispatch rule for outbound c...
# ask-ai
p
Do I need to create a dispatch rule for outbound calls?
t
Thanks for reaching out, GODGIFT. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
No worries, you don’t need to create a dispatch rule for outbound calls. Dispatch rules are really just for managing how inbound SIP calls get routed to LiveKit rooms. For outbound calls, here’s what you’ll want to do: 1. Set up an outbound SIP trunk. 2. Create an agent who can start the call. 3. Use the
lk dispatch create
command or the
CreateSIPParticipant
API to kick off the outbound call directly. Sources: SIP overview | LiveKit Docs | Making calls using SIP | LiveKit Docs | SIP trunk setup | LiveKit Docs
p
What will the json for the outbound sip trunk look like?
t
Here’s a typical JSON configuration for setting up an outbound SIP trunk in LiveKit:
Copy code
{
  "name": "My outbound trunk",
  "address": "<sip-trunking-provider-endpoint>",
  "transport": "SIP_TRANSPORT_TLS",
  "numbers": [
    "*"
  ],
  "authUsername": "<username>",
  "authPassword": "<password>",
  "mediaEncryption": "SIP_MEDIA_ENCRYPT_ALLOW"
}
Here’s a quick rundown of what each field means: • name: Just a friendly name for your trunk to keep things clear. • address: The hostname or IP where your SIP INVITE goes (don’t include the 'sip:' part). • transport: The SIP transport protocol you’re using, like
SIP_TRANSPORT_TLS
. • numbers: A list of phone numbers you want to make calls from. Using
*
means calls from any number are allowed. • authUsername and authPassword: Your SIP server login details (leave blank if you don’t need them). • mediaEncryption: Controls how media is encrypted, for example,
SIP_MEDIA_ENCRYPT_ALLOW
. There are also optional fields like metadata, destination_country, and custom SIP header mappings. If you want me to walk you through those or have any other questions, just let me know! Sources: Secure trunking | LiveKit Docs | protobufs/livekit_sip.proto | SIP outbound trunk | LiveKit Docs
p
When you say I should not include the sip part, if my address is sip.example.com I should just make add example.com
t
Exactly! If your address is
sip.example.com
, go ahead and use just
example.com
in the
address
field of your JSON configuration. Just a heads-up—the
sip:
prefix isn’t needed here.
p
TwirpError(code=canceled, message=twirp error unknown: transaction failed to complete (0 intermediate responses), status=408) This is the error I get
t
Hey there! That error
TwirpError code=canceled, message=twirp error unknown: transaction failed to complete (0 intermediate responses), status=408
basically means there was a 408 Request Timeout during your SIP call. This usually happens when the SIP client transaction gets canceled because it waited too long without hearing back from the other side. Here are some friendly steps to help you troubleshoot: 1. Double-check the SIP URI and Destination: Make sure the SIP URI looks right (like
sip:user@domain.com
) and that the destination is valid and reachable. 2. Review your SIP Trunk Configuration: Confirm that the SIP trunk has the right permissions enabled, such as SIP REFER if you’re doing call transfers. 3. Look into Regional Compliance: Check if you need to use parameters like
destination_country
to meet any region-specific rules. 4. Verify your SIP Provider Endpoint: Make sure the SIP endpoint in your trunk setup matches what your provider expects. If you want, I’m here to help you walk through any of these steps—just let me know! Sources: pkg/siptest/client.go | livekit/livekit_sip.twirp.go | SIP troubleshooting guide | LiveKit Docs