a
hello
t
Thanks for reaching out, Aditya. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd love to help you out! Could you please share a bit more about your question or the issue you're experiencing? That way, I can make sure to assist you in the best possible way.
a
(livekit_env) C:\Users\adity\Desktop\AI-Livekit-Projects\starter-agent>lk sip participant create participant.json WARNING: config file C:\Users\adity/.livekit/cli-config.yaml should have permissions 600 WARNING: config file C:\Users\adity/.livekit/cli-config.yaml should have permissions 600 Using project [solvox-ai-demo-project] twirp error not_found: twirp error unknown: object cannot be found i am getting this
t
I'm sorry you're encountering the error
twirp error not_found: twirp error unknown: object cannot be found
. This usually happens when the Trunk ID provided doesn’t match a valid SIP trunk. It might mean the trunk doesn’t exist or that you don’t have access to it. To help you get this sorted out, here are a couple of steps you can try: • Make sure the LiveKit SIP trunk actually exists. • Double-check that the Trunk ID you’re using in the request is correct. Also, please verify that the authentication token you’re using has the right SIP permissions. For example, the
CreateSIPParticipant
API needs the
call
permission to work properly. For some additional troubleshooting, you might want to: • Run the CLI commands
lk sip inbound list
or
lk sip outbound list
to see all available SIP trunks and confirm that the trunk you’re targeting shows up with the expected ID. • Check that your API key and secret are set up correctly and linked to a token that includes SIP permissions. If you’ve confirmed the trunk exists, the ID is right, and your token has the right permissions but the problem is still there, it could be related to broader service connectivity or provisioning issues. Please don’t hesitate to reach out if you’d like me to help you dig deeper into this! Sources: pkg/service/sip.go | SIP APIs | LiveKit Docs | livekit-api/src/services/sip.rs | cmd/lk/agent.go | SIP troubleshooting guide | LiveKit Docs
a
(livekit_env) C:\Users\adity\Desktop\AI-Livekit-Projects\starter-agent>lk sip participant create participant.json WARNING: config file C:\Users\adity/.livekit/cli-config.yaml should have permissions 600 WARNING: config file C:\Users\adity/.livekit/cli-config.yaml should have permissions 600 Using project [solvox-ai-demo-project] SIPStatusCode: 403 SIPStatus: Forbidden rpc error: code = PermissionDenied desc = unexpected status from INVITE response: sip status: 403: Forbidden
t
I'm sorry to hear you're encountering the error
rpc error: code = PermissionDenied desc = unexpected status from INVITE response: sip status: 403: Forbidden
. This message means that the SIP INVITE request was declined by your SIP provider with a 403 Forbidden status. Usually, this happens due to authentication or permission challenges, or sometimes because of regional compliance rules. Let's work through some steps to help you resolve this: • Authentication or Permission Issues: Please double-check that the username and password you entered for your SIP trunk exactly match what your SIP provider gave you. It's important these credentials are correctly set up in your LiveKit SIP trunk configuration. • Regional Compliance Issues: In certain areas, calls need to stay within national borders. To handle this, you can use region pinning: ◦ For outbound calls, include the
destination_country
parameter when you create an outbound trunk. ◦ For inbound calls, make sure to use the region-based endpoints offered by LiveKit Cloud. If after checking these details the problem still continues, please verify that your SIP trunk and dispatch rule settings are correct and confirm with your SIP provider that they support the call flow you're trying to use. I'm here to help, so feel free to reach out if you need any more support! Sources: SIP troubleshooting guide | LiveKit Docs | livekit/sip.go
a
◦ For outbound calls, include the
destination_country
parameter when you create an outbound trunk. give me step by step guide to do this
t
I'd love to help you include the
destination_country
parameter when creating an outbound SIP trunk in LiveKit. Here's a simple step-by-step guide to walk you through it: 1. Prepare the JSON Configuration: Start by creating a JSON file (for example,
outbound-trunk.json
) with this structure:
Copy code
{
  "trunk": {
    "name": "My outbound trunk",
    "address": "<http://sip.telnyx.com|sip.telnyx.com>",
    "numbers": [
      "+15105550100"
    ],
    "authUsername": "<username>",
    "authPassword": "<password>",
    "destination_country": "in"
  }
}
2. Run the CLI Command: Next, use the LiveKit CLI to create the trunk using your JSON file:
lk sip outbound create outbound-trunk.json
3. Verify the Trunk: Once created, you can verify the trunk by running: `lk sip outbound list`Make sure the trunk shows up with the correct
destination_country
value. If anything feels unclear or if you run into any issues, please don’t hesitate to reach out—I’m here to help you every step of the way! Sources: packages/livekit-server-sdk/src/SipClient.ts | livekit-protocol/livekit/protocol/sip.pyi | livekit/livekit_sip.pb.go | SIP outbound trunk | LiveKit Docs | SIP APIs | LiveKit Docs
a
it saying destination_country not allowed
t
It looks like you're encountering the error "`destination_country not allowed`", which usually happens when the
destination_country
field is either invalid or not supported. Let’s work through this together to get it sorted out: • First, please make sure that the
destination_country
value is a valid two-letter ISO 3166-1 alpha-2 country code, like
US
,
GB
, or
IN
. • Next, double-check that this country code is for a region supported by LiveKit's SIP service. You can find the list of supported regions in the LiveKit SIP cloud documentation. • If you’re using the CLI, be sure to include the
--destination-country
flag with a valid code. For example:
lk sip outbound create --name "My Trunk" --address "<http://sip.provider.com|sip.provider.com>" --numbers "+1234567890" --destination-country "US"
If you have any questions or need a hand with this, please don’t hesitate to reach out—I’m here to help! Sources: SIP outbound trunk | LiveKit Docs | livekit/livekit_sip.pb.go | SIP troubleshooting guide | LiveKit Docs
a
okay i am getting the call but agent is not getting join to the call.. do i need to add anything in the code .. Also i am using livekit cloud todeploy it
t
To help your agent successfully join the SIP call in LiveKit Cloud, let's go through a few important steps together: 1. Verify SIP Trunk and Dispatch Rule Configuration: Please double-check that the inbound trunk is set up with the right phone number and SIP provider credentials. Also, make sure the dispatch rule is connected to the trunk and that the
agent_name
is accurate. 2. Check for Authentication or Regional Issues: It's important to confirm the SIP trunk username and password are correct. Additionally, using region-specific endpoints for inbound calls or setting the
destination_country
parameter for outbound calls helps ensure everything complies with regional requirements. 3. Validate Agent Service Health: Let's ensure the agent service has proper network connectivity to LiveKit Cloud. Taking a look at the agent service logs can be very helpful to spot any errors during dispatch or when trying to join the room. 4. Monitor Call and Room Events: You can use LiveKit APIs to check the room's state and see if the SIP participant has joined. Watching for
onParticipantConnected
events will give you a clear idea of when the agent connects. If you’re still running into issues after these checks, try enabling debug logging and review both LiveKit and agent logs for any dispatch errors or SIP signaling problems. Please don’t hesitate to reach out if you need more help—I’m here to support you! Sources: SIP troubleshooting guide | LiveKit Docs | Integrating with Telephony | LiveKit Docs | pkg/loadtester/agentloadtester.go | livekit-agents/livekit/agents/job.py | test/integration/sip_test.go
a
i am talking about outbound call.. i am receiving thecall to my personal number from provider but agent is not getting join
t
To help your agent join an outbound SIP call in LiveKit Cloud smoothly, here are some friendly steps to guide you through: 1. Verify Agent Dispatch: Make sure your agent is started with an
agent_name
parameter in the
WorkerOptions
. This helps in assigning the right agent to the right room, giving you better control. 2. Validate Outbound Trunk Configuration: Double-check that your SIP trunk credentials (username and password) perfectly match your SIP provider’s settings. Also, confirm the SIP endpoint address (like
<http://sip.telnyx.com|sip.telnyx.com>
) and that the trunk ID is correct. 3. Start Agent Before Call: It’s best to start the agent session before calling
create_sip_participant
. This way, the agent is all set and ready to handle audio as soon as the call connects. 4. Monitor Call Status: Keep an eye on the
sip.callStatus
attribute to follow the call’s progress. You should see it move from
pending
to
active
when the call successfully connects. 5. Check Room Context: Make sure the
room_name
in the
CreateSIPParticipantRequest
matches the agent’s current room. This helps avoid any mix-ups. 6. Validate Phone Number: Confirm that the destination number is in E.164 format (for example,
+15105550100
) and that it’s reachable. 7. Enable Region Pinning: If you need to comply with regional requirements, don’t forget to specify the
destination_country
parameter in your outbound trunk configuration. If you’re still facing issues, try enabling debug logging and take a look at the LiveKit logs for SIP INVITE transactions and status updates. And of course, feel free to reach out anytime—I’m here to help you get this working perfectly! Sources: Making outbound calls | LiveKit Docs | Making calls using SIP | LiveKit Docs | Agents telephony integration | LiveKit Docs | Making calls using SIP | LiveKit Docs | SIP troubleshooting guide | LiveKit Docs
a
1. Check Room Context: 2. Make sure the
room_name
in the
CreateSIPParticipantRequest
matches the agent’s current room. This helps avoid any mix-ups. means ... see i created participant.json as { "sip_trunk_id": "ST_BR3vFWdGuh5C", "sip_call_to": "+918975012399", "room_name": "open-room", "participant_identity": "sip-test", "participant_name": "Test call participant", "krisp_enabled": true, "wait_until_answered": true } and then executing lk sip participant create participant.json.. in my agent.py code, do ineed to add room name also ?
t
In your
agent.py
code, you actually don’t need to hardcode or explicitly include the room name. Instead, the agent smartly uses the room name provided at runtime through
ctx.room.name
from the
JobContext
. This way, the agent will always join the correct room for the session, making things much smoother! For example, when you’re creating a SIP participant, you can do it like this:
Copy code
await ctx.api.sip.create_sip_participant(api.CreateSIPParticipantRequest(
    room_name=ctx.room.name,  # Dynamically uses the current room
    sip_trunk_id="ST_BR3vFWdGuh5C",
    sip_call_to="+918975012399",
    participant_identity="sip-test",
    participant_name="Test call participant",
    krisp_enabled=True,
    wait_until_answered=True,
))
This approach helps keep the agent and SIP participant perfectly in sync within the same room, without needing any hardcoded room names. If anything isn’t clear or you’d like a hand with this, please don’t hesitate to ask—I’m here to help! Sources: agent.py | Agents telephony integration | LiveKit Docs | Agent dispatch | LiveKit Docs | Job lifecycle | LiveKit Docs | agent.py
a
import asyncio from livekit import api from livekit.protocol.sip import CreateSIPParticipantRequest, SIPParticipantInfo async def main(): livekit_api = api.LiveKitAPI() request = CreateSIPParticipantRequest( _sip_trunk_id_ = "ST_BR3vFWdGuh5C", _sip_call_to_ = "+918975012399", _room_name_ = "my-sip-room", _participant_identity_ = "sip-test", _participant_name_ = "Test Caller", _krisp_enabled_ = True, _wait_until_answered_ = True ) _try_: participant = await livekit_api.sip.create_sip_participant(request) print(f"Successfully created {participant}") except Exception as e: print(f"Error creating SIP participant: {e}") _finally_: await livekit_api.aclose() asyncio.run(main()) make changesa in this code for room and give me updated one
t
Here is the updated code that dynamically uses the room name from the context (
ctx.room.name
) instead of hardcoding it:
Copy code
import asyncio

from livekit import api
from livekit.protocol.sip import CreateSIPParticipantRequest, SIPParticipantInfo

async def main(ctx):
    livekit_api = api.LiveKitAPI()

    request = CreateSIPParticipantRequest(
        sip_trunk_id="ST_BR3vFWdGuh5C",
        sip_call_to="+918975012399",
        room_name=ctx.room.name,  # Dynamically uses the current room name
        participant_identity="sip-test",
        participant_name="Test Caller",
        krisp_enabled=True,
        wait_until_answered=True
    )

    try:
        participant = await livekit_api.sip.create_sip_participant(request)
        print(f"Successfully created {participant}")
    except Exception as e:
        print(f"Error creating SIP participant: {e}")
    finally:
        await livekit_api.aclose()

# Example usage: Pass the context (ctx) when calling main
# asyncio.run(main(ctx))
I've updated the code so that the
room_name
is now set dynamically using
ctx.room.name
. This way, the SIP participant will join the correct room based on your LiveKit context. If you have any questions or need help with anything else, please feel free to ask—I'm here to help!