witty-yak-62929
08/12/2025, 7:22 AMtall-airline-16756
08/12/2025, 7:22 AMtall-airline-16756
08/12/2025, 7:23 AM<twilio-trunk-sid>
with your actual trunk SID:
twilio api trunking v1 trunks update --sid <twilio-trunk-sid> \
--transfer-mode enable-all \
--transfer-caller-id from-transferee
This makes sure the caller ID shows the transferee’s number—pretty handy, right?
Step 2: Configure Origination URL
Next, double-check that your trunk points to LiveKit by running:
twilio api trunking v1 trunks origination-urls create \
--trunk-sid <twilio_trunk_sid> \
--friendly-name "LiveKit SIP URI" \
--sip-url "sip:<your_livekit_sip_endpoint>" \
--weight 1 --priority 1 --enabled
Just replace <your_livekit_sip_endpoint>
with your LiveKit SIP endpoint, and you’re good to go.
Step 3: Associate Phone Number
Now, link your Twilio phone number with the trunk like this:
twilio api trunking v1 trunks phone-numbers create \
--trunk-sid <twilio_trunk_sid> \
--phone-number-sid <twilio_phone_number_sid>
If you need it, you can find the phone number SID in your Twilio console.
Step 4: Transfer Calls Using SIP REFER
To transfer calls, use LiveKit’s TransferSIPParticipant
API. Here’s a quick JavaScript example:
const sipClient = new SipClient(
process.env.LIVEKIT_URL,
process.env.LIVEKIT_API_KEY,
process.env.LIVEKIT_API_SECRET
);
const transferTo = "<sip:+1234567890@your-twilio-trunk.pstn>.twilio.com";
await sipClient.transferSipParticipant(
'storm-room', // Swap this with STORM's actual identifier
participant.identity,
transferTo,
{ playDialtone: true }
);
Just make sure to replace 'storm-room'
with the right STORM identifier and update the transferTo
SIP URI to match your setup.
Step 5: Verify Setup
• Double-check that LiveKit and Twilio SIP credentials line up.
• Give it a test run by making a call and transferring it to STORM.
By the way, if "STORM" is a specific room, endpoint, or system you’re working with, just let me know—I’d be happy to tailor the advice even more for you.
Sources: Transferring calls | LiveKit Docs | Create and configure a Twilio SIP trunk | LiveKit Docs