stale-vase-84095
07/08/2025, 2:10 PMtall-airline-16756
07/08/2025, 2:10 PMtall-airline-16756
07/08/2025, 2:11 PMctx.job.metadata
in your agent code.
• Inbound Calls: The dialed number (caller number) is accessible from the SIP participant's attributes via participant.attributes['sip.phoneNumber']
, but only if the HidePhoneNumber
feature is not enabled in the dispatch rule.
In summary:
• Use ctx.job.metadata
for the dialed number on outbound calls.
• Use participant.attributes['sip.phoneNumber']
for dialed/caller number on inbound calls (if phone number hiding is disabled).
This will allow you to retrieve the dialed number or caller number accordingly from the LiveKit room.
Sources: Agents telephony integration | LiveKit Docs | SipClient | LiveKit JS Server SDK - v2.9.7 | SIP participant | LiveKit Docsstale-vase-84095
07/08/2025, 2:13 PMasync def entrypoint(ctx: JobContext):
await ctx.connect()
room = ctx.room
I am talking about inbound call if possible can you show me how do I get dialed number as well as reciver number both?tall-airline-16756
07/08/2025, 2:13 PMentrypoint
function:
async def entrypoint(ctx: JobContext):
await ctx.connect()
room = ctx.room
# Get the first SIP participant in the room
participant = [p for p in room.remote_participants.values() if p.kind == rtc.ParticipantKind.PARTICIPANT_KIND_SIP][0]
# Get the dialed number (caller number) from participant attributes
dialed_number = participant.attributes.get('sip.phoneNumber')
# Get the receiver number (the number that was dialed) from participant attributes
receiver_number = participant.attributes.get('sip.trunkPhoneNumber')
print(f"Dialed Number: {dialed_number}")
print(f"Receiver Number: {receiver_number}")
Just a quick pro tip: make sure you've got the HidePhoneNumber
feature disabled in your dispatch rule so you can access these values. Easy peasy!
Sources: SIP participant | LiveKit Docs