if i change from using livekit cloud to running se...
# ask-ai
f
if i change from using livekit cloud to running server and agent locally where can i get the LiveKit SIP endpoint into the FQDN field for telnyx connection like this one in livekit cloud vjnxecm0tjk.sip.livekit.cloud
t
Thanks for reaching out, Huy. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Let's walk through how to configure the LiveKit SIP endpoint for Telnyx when you're running the server and agent locally. I’ll guide you step-by-step: 1. Set Up the Self-Hosted LiveKit SIP Server: Start by using Docker Compose to launch both the LiveKit server and SIP service together. You can do this by running: `wget https://raw.githubusercontent.com/livekit/sip/main/docker-compose.yaml docker compose up`This will help set up smooth communication between the SIP service, LiveKit server, and Redis. 2. Expose Your SIP Server: Make sure your server’s public IP is accessible and that ports
5060
(for SIP signaling) and
10000-20000
(for RTP media) are open. 3. Configure Telnyx SIP Trunk: In the Telnyx portal, create an FQDN connection using your public IP and port (for example,
your-public-ip:5060
). Then, assign your purchased phone number to this trunk. 4. Register the Inbound SIP Trunk in LiveKit: Use the LiveKit CLI or SDK to set up an inbound SIP trunk and link it to your Telnyx number. 5. Create a SIP Dispatch Rule: Define a rule that routes incoming calls to specific rooms within LiveKit. Once you've completed these steps, your Telnyx number will be ready to route calls directly to your local LiveKit instance. If you’d like, I’m here to help with any of these steps or provide more details—just let me know!
f
does doing
wget <https://raw.githubusercontent.com/livekit/sip/main/docker-compose.yaml>
will launch both the server and sip? I already launch livekit server using https://github.com/livekit/livekit
t
To get started, you can use
wget <https://raw.githubusercontent.com/livekit/sip/main/docker-compose.yaml>
followed by
docker compose up
. This will launch both the LiveKit server and the SIP service together. The Docker Compose file conveniently includes the LiveKit server, a Redis instance, and the SIP server, all set up to work seamlessly. Since you already have the LiveKit server running separately, you have the option to tweak the Docker Compose file to exclude the LiveKit server and just start the SIP service and Redis. If you'd like, I’m here to help you with adjusting the configuration—just let me know! Sources: Self-hosted SIP server | LiveKit Docs | Docs::Home | test/integration/sip_test.go
f
so when i ran it what will be the sip endpoint
t
When you run the LiveKit SIP service locally using Docker Compose, the SIP endpoint will be based on your machine's public IP address and the default SIP port, which is
5060
. For example:
<your-public-ip>:5060
To make sure everything runs smoothly, please check that port
5060
(for SIP signaling) and the RTP port range
10000-20000
are open and accessible from the internet. If you'd like, I’m here to help you verify or set this up—just let me know! Sources: Docs::Home | Docs::Home | SIP trunk setup | LiveKit Docs | Ports and firewall | LiveKit Docs | pkg/sip/service.go
f
how about if i use fqdn
t
Thanks for reaching out! Just to make sure I understand you correctly, are you asking about how to set up an FQDN for your local SIP server, or are you looking to use an FQDN with Telnyx for routing your calls? Once I know this, I’ll be happy to guide you through the best steps.
f
i already set up livekit sip and server using docker , how would i get the configuration for fqdn connection in telnyx
t
Let's walk through how to set up an FQDN connection in Telnyx for your locally running LiveKit SIP server together. Here’s what you need to do: 1. Set Up a Domain Name: First, make sure you have a domain name (FQDN) that points to the public IP address of the machine where your SIP server is running. You can easily use DNS services to link your domain to your public IP. 2. Configure Telnyx: ◦ Log in to the Telnyx portal (
<TELNYX_PORTAL_URL>
). ◦ Navigate to Voice » SIP Trunking and create a new connection. ◦ Choose FQDN as your connection type. ◦ Enter your FQDN (for example,
<http://sip.yourdomain.com|sip.yourdomain.com>
) and specify the SIP port, which is usually
5060
. ◦ Select the transport protocol that fits your setup—either TCP or UDP. 1. Update DNS Records: Double-check that your DNS records (like A or CNAME) correctly point to your public IP address. This step ensures Telnyx can find your SIP server through the FQDN. 2. Test Connectivity: Finally, test to confirm Telnyx can reach your SIP server using the FQDN and port
5060
. Also, make sure the necessary ports (5060 for SIP and 10000-20000 for RTP) are open and accessible. If you run into any questions or need a hand with any of these steps, please don’t hesitate to reach out—I’m here to help!
f
how about using ip adress
t
To set up your Telnyx SIP trunk with your LiveKit SIP server, it’s important to use an FQDN (Fully Qualified Domain Name) instead of a raw IP address. LiveKit works best with an FQDN for SIP endpoints, like
<project>.sip.livekit.cloud
, to make sure everything routes and functions smoothly. If you’d prefer to use an IP address, no worries! You’d just need to create a DNS record (like an A or CNAME record) that links your public IP to a domain name. Then, you can use that domain name as the FQDN in Telnyx. Please feel free to reach out if you’d like a hand setting up the DNS record or configuring the FQDN in Telnyx—I’m here to help! Sources: SIP outbound trunk | LiveKit Docs | Create and configure Telnyx SIP trunk | LiveKit Docs
f
how about instead of using ip and fqdn i use credentials for livekit
t
I'm happy to guide you through configuring a Telnyx SIP trunk using your LiveKit SIP server credentials. Here’s a simple step-by-step approach: 1. Set Up the Telnyx SIP Trunk: ◦ First, log in to the Telnyx portal and head over to Voice > SIP Trunking. ◦ Create a new connection and choose Credentials Authentication. ◦ Then, enter a username and password for your SIP trunk—this will keep things secure. ◦ Don’t forget to associate your purchased phone number with this connection. 1. Register the Trunk in LiveKit: ◦ Next, use the LiveKit API or SDK to create an inbound trunk with your Telnyx phone number and credentials. ◦ Here’s an example using the Node.js SDK:
Copy code
const trunk = await sipClient.createSipInboundTrunk(
  "telnyx-inbound-trunk",
  ["+15105550100"],
  {
    auth_username: "your_telnyx_sip_username",
    auth_password: "your_telnyx_sip_password"
  }
);
1. Optional: Configure Outbound Trunk: ◦ If you’d like, you can also set up an outbound trunk in LiveKit using Telnyx’s SIP domain (like
<http://sip.trunk.telnyx.com|sip.trunk.telnyx.com>
) along with your credentials. ◦ Here’s an example:
Copy code
{
  "trunk": {
    "name": "My Telnyx outbound trunk",
    "address": "<http://sip.trunk.telnyx.com|sip.trunk.telnyx.com>",
    "numbers": [
      "+15105550100"
    ],
    "auth_username": "your_telnyx_username",
    "auth_password": "your_telnyx_password"
  }
}
If you have any questions or need a hand with any of these steps, please don’t hesitate to reach out—I’m here to help! Sources: Create and configure Telnyx SIP trunk | LiveKit Docs | packages/sip--um-actually/src/setup-livekit.ts | protobufs/livekit_sip.proto | SIP APIs | LiveKit Docs | Making calls using SIP | LiveKit Docs
f
i have a domain name https://te-dev.kaopiz.com/ that port to port 5060 that i currently running livekit sip on .What is the sip uri
t
Thanks for sharing that you’re running the LiveKit SIP service on your custom domain
<te-dev.kaopiz.com>
, which points to port 5060. In this case, your SIP URI would be:
sip:<http://te-dev.kaopiz.com:5060|te-dev.kaopiz.com:5060>
Just a quick reminder to make sure port 5060 is open and accessible from the internet so everything works smoothly. If you have any questions or need a hand with anything else, I’m here to help!
f
how to create a sip trunk using lk
t
I'm here to help you create a SIP trunk in LiveKit! Let's walk through the steps together, whether you're setting up an inbound or outbound trunk: Inbound SIP Trunk This is perfect when you want to accept incoming calls:
Copy code
await sipClient.createSipInboundTrunk(
  "inbound-trunk",
  ["+1234567890"],
  {
    auth_username: "your-username",
    auth_password: "your-password"
  }
);
Just give your trunk a name, add the phone numbers, and include any authentication details if needed. Once that's done, you can create a SIP Dispatch Rule to direct incoming calls to the right rooms. Outbound SIP Trunk If you're looking to make outgoing calls, this is the way to go:
Copy code
await sipClient.createSipOutboundTrunk(
  "outbound-trunk",
  "<http://sip.example.com|sip.example.com>",
  ["+1234567890"],
  {
    auth_username: "your-username",
    auth_password: "your-password",
    transport: SIPTransport.SIP_TRANSPORT_TCP
  }
);
Here, you'll set up the trunk with a name, the SIP server address, phone numbers, and any authentication info you might have. After that, the
CreateSIPParticipant
API is your friend for initiating calls. If anything feels unclear or you want a hand with these steps, just let me know—I’m happy to guide you through it! Sources: pkg/service/sip.go | packages/livekit-server-sdk/src/SipClient.ts | lib/livekit/proto/livekit_sip_pb.rb | Create and configure a Twilio SIP trunk | LiveKit Docs | livekit-api/livekit/api/sip_service.py
f
i want to using the cli command lk and a json file
t
I'd be happy to guide you through creating a SIP trunk in LiveKit using the CLI and a JSON file. Let's take it step by step: Inbound SIP Trunk 1. First, create a JSON file (for example,
inbound-trunk.json
) with this content:
Copy code
{
  "trunk": {
    "name": "My inbound trunk",
    "numbers": [
      "+15105550100"
    ]
  }
}
Just be sure to replace
+15105550100
with your actual phone number. 1. Next, run this command to create the inbound trunk:
Copy code
lk sip inbound create inbound-trunk.json
Outbound SIP Trunk 1. Similarly, create a JSON file (like
outbound-trunk.json
) with the following:
Copy code
{
  "trunk": {
    "name": "My outbound trunk",
    "address": "<my-trunk>.<http://pstn.twilio.com|pstn.twilio.com>",
    "numbers": [
      "+15105550100"
    ],
    "authUsername": "<username>",
    "authPassword": "<password>"
  }
}
Make sure to replace those placeholders with your SIP provider’s actual details. 1. Then, run this command to create the outbound trunk:
Copy code
lk sip outbound create outbound-trunk.json
If you have any questions along the way or want some help setting up additional features like dispatch rules, just let me know—I’m here to help! Sources: Accepting incoming calls | LiveKit Docs | SIP outbound trunk | LiveKit Docs
f
how about create a dispatch rule
t
Hi there! To help you create a SIP dispatch rule in LiveKit using the CLI and a JSON file, here’s a simple step-by-step guide: 1. Create a JSON file: For instance, you can make a file called
dispatch-rule.json
with this content for a direct dispatch rule:
Copy code
{
  "dispatch_rule": {
    "rule": {
      "dispatchRuleDirect": {
        "roomName": "open-room",
        "pin": "12345"
      }
    },
    "trunk_ids": [
      "trunk-123",
      "trunk-456"
    ],
    "name": "My dispatch rule",
    "metadata": "{\"is_internal\": true}",
    "attributes": {
      "department": "support",
      "priority": "high"
    },
    "hide_phone_number": true,
    "roomConfig": {
      "agents": [
        {
          "agentName": "inbound-agent",
          "metadata": "job dispatch metadata"
        }
      ]
    }
  }
}
This setup will place all callers into the
open-room
, require a PIN for access, apply the rule to specific trunks, hide phone numbers for privacy, and assign an agent to handle the calls. 1. Run the CLI command: Simply use this command to create your dispatch rule:
Copy code
lk sip dispatch create dispatch-rule.json
If you’d like help with other types of rules or want to explore additional configurations, just let me know—I’m here to help! Sources: Accepting incoming calls | LiveKit Docs | SIP dispatch rule | LiveKit Docs | SIP APIs | LiveKit Docs | Agents telephony integration | LiveKit Docs