When using SIP inbound trunks how can I ensure tha...
# ask-ai
a
When using SIP inbound trunks how can I ensure that the number that people call (my number) gets sent to the agent that joins the room as metadata?
t
Thanks for reaching out, Calaunte. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
When using SIP inbound trunks, LiveKit automatically sets several attributes for SIP participants that include phone number information: •
sip.trunkPhoneNumber
– The number associated with your LiveKit SIP Trunk (the called number) •
sip.phoneNumber
– The external caller's number (for inbound calls) These attributes are available on the participant object when the agent joins the room, so your agent can directly access
sip.trunkPhoneNumber
to determine which number was called. If you need to pass additional or custom metadata, you can configure your SIP dispatch rule or inbound trunk to set participant metadata. For example, in your dispatch rule, you can add a
metadata
field that will be inherited by all SIP participants created by that rule. You can also use the
roomConfig.agents
field to pass metadata to agents when dispatching them for SIP calls. In summary, to ensure the called number is available to the agent as metadata: 1. Access the
sip.trunkPhoneNumber
attribute on the participant object when the agent joins the room. 2. Optionally, configure your dispatch rule or trunk to set custom metadata if you need to pass additional context. This approach ensures the agent receives the called number and any other relevant information as soon as they join the room. Sources: Agent dispatch | LiveKit Docs | SIP inbound trunk | LiveKit Docs | protobufs/livekit_sip.proto | SIP dispatch rule | LiveKit Docs