average-match-48905
06/05/2025, 5:10 PMctx: JobContext in the entrypoint function, i know there is ctx.room_name but what moretall-airline-16756
06/05/2025, 5:10 PMtall-airline-16756
06/05/2025, 5:10 PMctx: JobContext in the entrypoint function:
• ctx.connect() - Method to connect to the room.
• ctx.room - Access to the room object, which includes:
◦ ctx.room.name - The name of the room.
• ctx.log_context_fields - Fields to include in log entries.
• ctx.add_participant_entrypoint() - Method to add participant entrypoint functions.
• ctx.proc.userdata - Access to process userdata (for accessing data set in the prewarm function).
These fields and methods allow you to interact with the LiveKit room, manage connections, handle participants, and access shared data within your agent application. Let me know if you need further clarification!
Sources: Worker options | LiveKit Docs | Tree View: | dse-workbenchaverage-match-48905
06/05/2025, 5:13 PMroom name which i can access through JobContext?tall-airline-16756
06/05/2025, 5:14 PM# Add this import to the top of your file
from livekit import rtc
# In your entrypoint function, after connecting:
participant = await ctx.wait_for_participant()
# Check if the participant is a SIP participant
if participant.kind == rtc.ParticipantKind.PARTICIPANT_KIND_SIP:
# Extract the caller's phone number from SIP attributes
caller_phone_number = participant.attributes['sip.phoneNumber']
<http://logger.info|logger.info>(f"Caller phone number is {caller_phone_number}")
# Add other logic here based on the caller's phone number
The sip.phoneNumber attribute contains the user's phone number for inbound calls, which is the phone number the call originates from. Please note that this attribute won't be available if HidePhoneNumber is set in the dispatch rule.
Let me know if you need further assistance!
Sources: SIP participant | LiveKit Docs