Overview

In this guide, we will show how to integrate Retell agents with your telephony providers and use your numbers. Please note that this is independent of the agent type you are using.

We will provide two ways to integrate with your telephony provider:

  1. Elastic SIP trunking: This is the recommended way to integrate with your telephony provider that supports elastic SIP trunking. You will need to set up a SIP trunking and configure your number to point to it, and then import that number to Retell.
  2. Dial to SIP Endpoint: If your telephony provider does not support elastic SIP trunking, or you have more complicated telephony setup that cannot use elastic SIP trunking, you can dial the call to a specific SIP endpoint.
  • Retell SIP server uri: sip:5t4n6j0wnrl.sip.livekit.cloud
  • If inbound does not work (might be due to initial SDP being dropped), specify to use TCP as the transport protocol: sip:5t4n6j0wnrl.sip.livekit.cloud;transport=tcp

We currently do not provide a static IP address for the SIP server, as it’s deployed globally across different cloud.

Elastic SIP Trunking is a service offered by cloud communications platforms that enables organizations to connect their existing PBX (Private Branch Exchange) or VoIP (Voice over IP) infrastructure to the Public Switched Telephone Network (PSTN) over the internet using the SIP (Session Initiation Protocol).

In this context, the elastic SIP trunking is used to connect Retell’s VoIP with PSTN so that your agents can make and receive calls. When using this method, all the telephony functionalities that are supported by Retell numbers will also be supported here, assuming that your telephony provider supports it.

SIP trunking is a popular service offered by many telephony providers, so most likely your telephony provider would be able to support this.

Here’re detailed guides for some telephony providers:

Getting help

If you are using a telephony provider that requires static IP address, or you are having trouble setting up, you can check out our partner Jambonz, where you can connect to Jambonz’s system that already connects with Retell (which supports static IP address) and use their SIP trunking service. Dedicated slack support channel is available for Retell users.

FAQ

Method 2: Dial to SIP Endpoint

If your telephony provider does not support elastic SIP trunking, or you have more complicated telephony setup that cannot use elastic SIP trunking, you can use this method.

When using this method, Retell does not directly make or receive calls, but instead relies on your system to dial the call to the respective SIP endpoint. This would require you to have some codes to handle integration with your telephony provider. All traffic looks like inbound to Retell in this case, so it’s up to you to specify the call direction.

When using this method, you will not be able to utilize Retell’s transfer call feature, as we do not have information about the underlying telephony provider and number.

Here we assume you already have your call handling setup. For Retell to know what agent to use to handle the call, and for you to obtain SIP endpoint to use for this call, you would call the Register Phone Call API. You will get a call_id back from this API, and you would use it to piece together the SIP endpoint.

SIP endpoint: sip:{call_id}@5t4n6j0wnrl.sip.livekit.cloud

Example Code

Here’s an overly simplified example code to handle the inbound call webhook from Twilio and dialing the call to the SIP endpoint.

Node
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
});

server.app.post(
  "/voice-webhook",
  async (req: Request, res: Response) => {
    // Register the phone call to get call id
    const phoneCallResponse = await client.call.registerPhoneCall({
      agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
      from_number: "+12137771234", // optional
      to_number: "+12137771235", // optional
      direction: "inbound", // optional
    });

    // Start phone call websocket
    const voiceResponse = new VoiceResponse();
    const dial = voiceResponse.dial();
    dial.sip(
      `sip:${phoneCallResponse.call_id}@5t4n6j0wnrl.sip.livekit.cloud`,
    );
    res.set("Content-Type", "text/xml");
    res.send(voiceResponse.toString());
  },
);

FAQ

###🎦 Video Tutorial Use connecting to custom twilio as an example.