This message was deleted.
# ask-ai
s
This message was deleted.
t
Thanks for reaching out, pritesh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! The
sip_trunk_id
is a unique little tag that gets assigned to each SIP trunk when you create it in the LiveKit SIP integration system. If you’re wondering how to find it, here are some easy ways: • Right after creation: When you create a SIP trunk through the API, the response will include the `sip_trunk_id`—so you’ll have it handy. • Listing trunks: You can call the
ListSIPInboundTrunk
or
ListSIPOutboundTrunk
API methods to get a list of all your trunks, and each one will show its
sip_trunk_id
. • Getting a specific trunk: Just use the
GetSIPInboundTrunk
or
GetSIPOutboundTrunk
API methods with the trunk ID as a parameter, and you’ll get back the details including the
sip_trunk_id
. If you want a hand with any of these steps or have questions about accessing the API, just let me know—I’m here to help! Sources: livekit/livekit_analytics.pb.go | SIP APIs | LiveKit Docs
r
I am looking for during live call in funcyoon callling I need create CreateSIPParticipantRequest for this I need sip_trunk_id
t
To create a
CreateSIPParticipantRequest
during a live call, you’ll need the
sip_trunk_id
. No worries—here’s how you can find it: • Right after creating the trunk: If you just set up the SIP trunk, the API response will have the
sip_trunk_id
you need. • Check your existing trunks: You can use the
ListSIPInboundTrunk
or
ListSIPOutboundTrunk
API methods to see all your trunks along with their `sip_trunk_id`s. • Look up a specific trunk: Use the
GetSIPInboundTrunk
or
GetSIPOutboundTrunk
API methods with the trunk ID to get its details, including the
sip_trunk_id
. Once you’ve got the
sip_trunk_id
, you’re all set to use it in the
CreateSIPParticipantRequest
to add someone to the live call. If you want a hand with any of these steps or need help accessing the API, just let me know—I’m here to help!
r
Can I not find using livekit API ?
t
Absolutely, you can use the LiveKit API to find the
sip_trunk_id
. Here are some handy API methods to help you out: • List trunks: Try the
ListSIPInboundTrunk
or
ListSIPOutboundTrunk
API methods to get a list of all SIP trunks. Each trunk in the list will show its
sip_trunk_id
. • Get specific trunk: You can also use the
GetSIPInboundTrunk
or
GetSIPOutboundTrunk
API methods by providing the trunk ID, and the response will include the
sip_trunk_id
details. These methods make it super easy to pull the
sip_trunk_id
right from the LiveKit system. If you want, I’m here to help you with the API calls or clear up anything else—just let me know!
r
# Create SIP participant request to add human agent to room create_request = api.CreateSIPParticipantRequest( _sip_trunk_id_=sip_trunk_id _sip_call_to_=transfer_to_phone, _room_name_=room_name, _participant_identity_=participant_identity, _krisp_enabled_=True ) logger.debug(f"Warm transfer request: {create_request}") # Add human agent to the room await livekit_api.sip.create_sip_participant(create_request) logger.info(f"Successfully added new agent to room {room_name} ({transfer_type})") Ca you complete the snuppet o get the sip
sip_trunk_id
t
Here’s a friendly little guide to help you grab the
sip_trunk_id
using the LiveKit API and finish up your snippet:
Copy code
import os
from livekit import api

# Initialize LiveKit API
livekit_api = api.LiveKitAPI(
    url=os.getenv("LIVEKIT_URL"),
    api_key=os.getenv("LIVEKIT_API_KEY"),
    api_secret=os.getenv("LIVEKIT_API_SECRET"),
)

# List all SIP trunks
sip_trunks = livekit_api.sip.list_sip_inbound_trunks()

# Retrieve the sip_trunk_id from the first trunk (example)
if sip_trunks and len(sip_trunks) > 0:
    sip_trunk_id = sip_trunks[0].id
    print(f"Retrieved sip_trunk_id: {sip_trunk_id}")
else:
    print("No SIP trunks found.")
This little example shows you how to list all inbound SIP trunks and pick out the
sip_trunk_id
from the first one. Feel free to tweak it to fit what you need, like filtering trunks or going for outbound trunks instead. And hey, if you want a hand with anything else, just give me a shout!
r
Any inbout trunk id will work ?
t
Not every inbound trunk ID will be the perfect fit for what you’re trying to do, and that’s totally okay! It really depends on how the trunk is set up and what it’s meant for. For example: • If the trunk is set up to handle calls for the room or participant you’re working with, it should do the trick. • If the trunk is limited to certain numbers or regions, make sure it matches what you need. • Also, double-check that the trunk is active and properly configured in your LiveKit account. If you’re ever unsure, a good way to find out is to test with a specific trunk ID or take a peek at its setup using the LiveKit API methods like
GetSIPInboundTrunk
. I’m here if you want a hand verifying or picking the right trunk ID—just let me know!