clever-doctor-15083
02/15/2025, 4:15 PMuser_speech_committed
can we end conversation?gray-monkey-83525
02/15/2025, 4:15 PMuser_speech_committed
event to trigger the end of a conversation. According to LiveKit documentation, this event is emitted when the user's speech is committed to the chat context. You can listen for this event and implement logic to end the session when certain conditions are met, such as specific keywords indicating the user wants to end the conversation.
Would you like more details on how to implement this?
Sources:
- https://docs.livekit.io/python/livekit/agents/stt/stt.html#livekit.agents.stt.stt.SpeechEventType
- https://livekit-users.slack.com/archives/C07FY8WHGPM/p1732026501.742139 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.clever-doctor-15083
02/15/2025, 4:16 PMgray-monkey-83525
02/15/2025, 4:16 PMuser_speech_committed
event by listening for this event and then checking for specific keywords or conditions to trigger the session termination. Here's a basic example of how you might set this up:
from livekit.agents.voice_assistant import VoiceAssistant
# Assuming 'assistant' is an instance of VoiceAssistant
@assistant.on("user_speech_committed")
async def handle_user_speech_committed(message):
# Check if the message contains a keyword to end the session
if "goodbye" in message.text.lower() or "end session" in message.text.lower():
print("Ending session based on user request.")
await assistant.ctx.shutdown(reason="User requested to end the session.")
In this example, the handle_user_speech_committed
function listens for the user_speech_committed
event. When this event is triggered, it checks if the user's message contains keywords like "goodbye" or "end session". If such keywords are found, it calls the shutdown
method to end the session.
Would you like more detailed guidance on this implementation?
Sources:
- https://livekit-users.slack.com/archives/C07FY8WHGPM/p1729703478.700519
- https://livekit-users.slack.com/archives/C07FY8WHGPM/p1729611355.127999 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.clever-doctor-15083
02/15/2025, 4:22 PMgray-monkey-83525
02/15/2025, 4:22 PMdisconnect
method on the room object associated with the agent. Here's a basic example of how you might implement this:
from livekit import rtc
# Assuming 'room' is an instance of rtc.Room
async def leave_room():
if room.isconnected():
await room.disconnect()
print("Agent has left the room.")
This code checks if the agent is connected to the room and then calls the disconnect
method to leave the room. Make sure that the room
object is properly initialized and connected before calling this function.
Would you like more detailed guidance on this implementation?
Sources:
- https://docs.livekit.io/python/livekit/rtc/room.html#parameters 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.clever-doctor-15083
02/16/2025, 12:51 PMgray-monkey-83525
02/16/2025, 12:51 PMCreateSIPParticipant
API. This involves setting up a SIP trunk and then creating a SIP participant to make the call. Here's a basic outline of the steps:
1. Set up your SIP trunk: Ensure you have a SIP trunk configured with a provider like Twilio or Telnyx. This setup is necessary to route calls through LiveKit.
2. Create a SIP participant: Use the CreateSIPParticipant
API to initiate the call. You'll need to provide details such as the SIP trunk ID, the phone number to call, and the room name.
Here's a Python example using the LiveKit API:
from livekit import api
# Initialize the LiveKit API client
livekit_api = api.LiveKitAPI(
livekit_url='your_livekit_url',
api_key='your_api_key',
api_secret='your_api_secret'
)
# Create a SIP participant to make an outbound call
await livekit_api.sip.create_sip_participant(
api.CreateSIPParticipantRequest(
sip_trunk_id='your_sip_trunk_id',
sip_call_to='+1234567890', # The phone number to call
room_name='your_room_name',
participant_identity='sip_test',
participant_name='Test Caller'
)
)
Would you like more detailed guidance on setting up the SIP trunk or using the API?
Sources:
- Making calls using SIP
- Outbound Calls via SIP 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.clever-doctor-15083
02/16/2025, 12:53 PMgray-monkey-83525
02/16/2025, 12:53 PMpip install livekit
2. Write the Script:
- Create a new Python file, for example, make_call.py
.
- Copy the provided code into this file. Make sure to replace placeholders like 'your_livekit_url'
, 'your_api_key'
, 'your_api_secret'
, and 'your_sip_trunk_id'
with your actual LiveKit project details and SIP trunk information.
3. Run the Script:
- Open a terminal or command prompt.
- Navigate to the directory where your make_call.py
file is located.
- Run the script using Python:
python make_call.py
This setup will allow you to execute the script and initiate an outbound call using LiveKit. If you encounter any issues, ensure that your environment variables and API credentials are correctly set.
Would you like more detailed guidance on any of these steps?
Sources:
- Outbound Calls via SIP 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.clever-doctor-15083
02/16/2025, 1:18 PMlivekit.agents._exceptions.APIStatusError: Error code: 403 - {'error': {'message': 'Project `proj_a9JuOKERREfCdYbFufN8K7M3` does not have access to model `tts-1`', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}
@millions-hair-24956gray-monkey-83525
02/16/2025, 1:18 PMtts-1
. This can happen if the model is not available in your current plan or if there are restrictions on the models you can use.
Here are a few steps you can take to resolve this issue:
1. Check Model Availability: Verify that the model tts-1
is available for your project. You may need to upgrade your plan or request access to specific models.
2. Verify Project Configuration: Ensure that your project is correctly configured to use the desired model. This includes checking your API keys and project settings.
3. Contact Support: If you're unable to resolve the issue, consider reaching out to LiveKit support for assistance. They can provide more detailed information about your project's access rights and help troubleshoot the issue.
Would you like more detailed guidance on any of these steps?
Sources:
- https://livekit-users.slack.com/archives/C07FY8WHGPM/p1732699668.482419
- https://livekit-users.slack.com/archives/C07FRP66XGE/p1730288245.597009
Note: I wasn’t able to find highly relevant data sources, but above are a few potentially relevant links. 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.