loud-furniture-10936
10/28/2025, 3:41 PMtall-airline-16756
10/28/2025, 3:41 PMtall-airline-16756
10/28/2025, 3:44 PMsip.trunkPhoneNumber attribute to identify which number the caller dialed.
• Configure dispatch rules or custom SIP participant attributes to create different behaviors or workflows depending on the inbound number.
• Decide whether you want to set up a single trunk with multiple numbers or multiple trunks with unique configurations—whichever fits your needs best.
If you have any specific details about how many Twilio numbers you’re working with or the kinds of data instructions you want to manage, please share them with me. I’d be happy to offer more tailored guidance to help you along the way!
Sources: SIP APIs | LiveKit Docs | SIP inbound trunk | LiveKit Docs | livekit-protocol/livekit/protocol/sip.py | SIP participant | LiveKit Docs | packages/sip--um-actually/README.mdloud-furniture-10936
10/28/2025, 3:45 PMtall-airline-16756
10/28/2025, 3:46 PMsip.trunkPhoneNumber attribute! This attribute is automatically assigned to SIP participants in a LiveKit room and represents the phone number linked to the SIP trunk used for the call. Let me walk you through how you can use it with JavaScript or Node.js:
1. Create an Outbound SIP Trunk:
import { SipClient } from 'livekit-server-sdk';
const sipClient = new SipClient(
process.env.LIVEKIT_URL,
process.env.LIVEKIT_API_KEY,
process.env.LIVEKIT_API_SECRET
);
const trunk = await sipClient.createSipOutboundTrunk(
'my-outbound-trunk',
'sip.twilio.com',
['+1234567890'],
{
authUsername: 'your-twilio-username',
authPassword: 'your-twilio-password'
}
);
2. Initiate a SIP Call:
await sipClient.createSipParticipant({
sipTrunkId: trunk.sipTrunkId,
sipCallTo: '+0987654321',
roomName: 'my-room',
});
3. Access the Attribute in the Room:
Once your SIP participant joins the room, you can easily retrieve their attributes, including sip.trunkPhoneNumber, through room participant events or APIs:
// Example of expected attributes on SIP participant
const expectedAttributes = {
'sip.trunkPhoneNumber': '+1234567890', // Trunk's outbound number
'sip.phoneNumber': '+0987654321', // Callee number
'sip.callStatus': 'active',
'sip.trunkID': trunk.sipTrunkId,
};
These attributes are really helpful for customizing your app’s behavior based on the call context. If you have any questions or need a hand with anything else, please don’t hesitate to reach out—I’m here to support you!
Sources: SIP participant | LiveKit Docs | test/lktest/sip.go