https://retellai.com/?utm_source=discord&utm_medium=seo logo
How should I make the link for BYO Sip inbound
# ❓・ai-evy-support
b
@AI Evy How should I make the link for BYO Sip inbound?
a
Thanks for tagging me @bmj4330. I'll look through relevant sources and get back to you shortly.
​ To learn more, see the sources I considered: [[1] Custom Telephony Overview](https://docs.retellai.com/deploy/custom-telephony) [[2] Receive calls](https://docs.retellai.com/deploy/inbound-call) [[3] Inbound SIP Call to Retell Agent Rejected with “486 Busy Here”](https://discord.com/channels/1186424376300679209/1417691065363857470) ​
### Answer For BYO (Bring Your Own) SIP inbound calls with Retell AI, there are two main approaches depending on your setup [(1) ]() : ## Method 1: Elastic SIP Trunking (Recommended) For elastic SIP trunking, configure your SIP trunk's origination settings to point to Retell's SIP server : SIP Server URI:
sip:sip.retellai.com
You can specify the transport method by appending it to the URL : - UDP:
sip:sip.retellai.com;transport=udp
- TCP:
sip:sip.retellai.com;transport=tcp
- TLS:
sip:5t4n6j0wnrl.sip.livekit.cloud;transport=tls
After configuring your SIP trunk with your telephony provider, import the number into Retell AI and bind an inbound agent to it [(2) ]() . ## Method 2: Dial to SIP URI If your provider doesn't support elastic SIP trunking, you'll need to use the Register Phone Call API to generate a call ID, then dial to [(3) ]() : SIP URI:
sip:{call_id}@sip.retellai.com
[(1) ]() Here's an example using a Twilio Function [(3) ]() :
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Copy code
javascript
const axios = require('axios') ;

exports.handler = async function(context, event, callback) {
    const VoiceResponse = require('twilio') .twiml.VoiceResponse;
    try {
        const retellResp = await axios.post('<https://api.retellai.com/v2/register-phone-call',> {
            agent_id: context.RETELL_AGENT_ID,
            from_number: event.From,
            to_number: event.To,
            direction: 'inbound'
        }, {
            headers: { 'Authorization': `Bearer ${context.RETELL_API_KEY}` }
        }) ;
        const callId = retellResp.data.call_id;
        const twiml = new VoiceResponse() ;
        twiml.dial() .sip(`sip:${callId}@xxxxx.sip.livekit.cloud`) ;
        return callback(null, twiml.toString() ) ;
    } catch (err) {
        console.log("Retell API error:", err.message, err.response?.data) ;
    }
}
The elastic SIP trunking method is recommended as it's simpler and supports all Retell telephony features [(1) ]() . **