I need to configure the telephony with Twilio, i h...
# ask-ai
w
I need to configure the telephony with Twilio, i have to transfer the call to STORM
t
Thanks for reaching out, Chiranjeevi. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Let's walk through how to set up telephony with Twilio and transfer calls to STORM in LiveKit—I've got you covered with these simple steps: Step 1: Configure Twilio SIP Trunk 1. Enable Call Transfers: You'll want to tweak your Twilio SIP trunk to allow call transfers. Just run this command, swapping out
<twilio-trunk-sid>
with your actual trunk SID:
Copy code
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:
Copy code
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:
Copy code
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:
Copy code
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