> ## Documentation Index
> Fetch the complete documentation index at: https://docs.callcloser.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Twilio Integration

> A step by step guide to connect to your Twilio account via SIP trunking

## Step 1: Create Elastic SIP Trunking

1. Create the trunk, give it a name, and toggle some general settings
   <Frame>
     <img src="https://mintcdn.com/callcloserai/iaAlrEI0uRGNqTGB/resources/twillio-create-elastic-sip1.jpeg?fit=max&auto=format&n=iaAlrEI0uRGNqTGB&q=85&s=2a83198553b66fc7986f1f31f615d068" alt="Create Elastic SIP Trunking" width="837" height="863" data-path="resources/twillio-create-elastic-sip1.jpeg" />
   </Frame>

2. Setup termination (this is for outbound)

* the termination SIP URI here is important, we would use it in later steps. You might want to use a localized termination uri that’s near your region. You can expand and view your localized uris in the twilio console.
  <Frame>
    <img src="https://mintcdn.com/callcloserai/jcscMEOz3zSYo1nL/resources/twillio-setup-termination1.jpeg?fit=max&auto=format&n=jcscMEOz3zSYo1nL&q=85&s=eb083f816415a0aedeedc46e7734bb7d" alt="Setup Termination" width="859" height="868" data-path="resources/twillio-setup-termination1.jpeg" />
  </Frame>

* For your elastic SIP trunk to accept our outbound request, you need to whitelist IP address or create a auth with username and password.

- Currently CallCloser SIP server does not have a static IP, so if you opt for the IP route, you need to whitelist all the IP addresses in the range like following:

  <Frame>
    <img src="https://mintcdn.com/callcloserai/jcscMEOz3zSYo1nL/resources/twillio-new-access-control.jpeg?fit=max&auto=format&n=jcscMEOz3zSYo1nL&q=85&s=94c0f114bc78243dbe67ff369f6829c2" alt="Twilio New Access Control" width="606" height="452" data-path="resources/twillio-new-access-control.jpeg" />
  </Frame>

  <Frame>
    <img src="https://mintcdn.com/callcloserai/jcscMEOz3zSYo1nL/resources/twillio-new-access-control2.jpeg?fit=max&auto=format&n=jcscMEOz3zSYo1nL&q=85&s=d9dc55e7425f1cecdf623bddfc43dee7" alt="Twilio New Access Control" width="605" height="440" data-path="resources/twillio-new-access-control2.jpeg" />
  </Frame>

3. Setup origination (this is for inbound)

* Here you will specify CallCloser SIP server address as the origination SIP URI: `sip:5wed79aeavr.sip.livekit.cloud `

  <Frame>
    <img src="https://mintcdn.com/callcloserai/jcscMEOz3zSYo1nL/resources/twillio-setup-origination1.jpeg?fit=max&auto=format&n=jcscMEOz3zSYo1nL&q=85&s=25384f3263fb6c5658a96b2ca4643565" alt="Setup Origination" width="1158" height="447" data-path="resources/twillio-setup-origination1.jpeg" />
  </Frame>

## Step 2: Move numbers to Elastic SIP Trunking

You’ve created the elastic SIP trunk, now you would need to purchase numbers / move existing numbers to this trunk.

<Frame>
  <img src="https://mintcdn.com/callcloserai/jcscMEOz3zSYo1nL/resources/twillio-move-numbers1.jpeg?fit=max&auto=format&n=jcscMEOz3zSYo1nL&q=85&s=7270c51d833e743b7cf37a8f2fc40f36" alt="Move numbers to Elastic SIP Trunking" width="2010" height="474" data-path="resources/twillio-move-numbers1.jpeg" />
</Frame>

## Step 3: Import numbers to CallCloser

Now the number is set up with your elastic SIP trunking, you need to import the number to CallCloser so that we will know how to route the call.

1. Go to your CallCloser.ai dashboard
2. Navigate to \*\* Your Phone Numbers\*\*
3. Click “Integrate SIP trunk”

   <Frame>
     <img src="https://mintcdn.com/callcloserai/iaAlrEI0uRGNqTGB/resources/twillio-import-autocalls-sip1.png?fit=max&auto=format&n=iaAlrEI0uRGNqTGB&q=85&s=21a54b417d33391540a36473899ce421" alt="Import numbers to CallCloser" width="1482" height="684" data-path="resources/twillio-import-autocalls-sip1.png" />
   </Frame>
4. Fill in your details based on your integration type

```
Phone number: e.g., +1 555 0123
Username: Your extension username
Password: Your extension password
```

<Frame>
  <img src="https://mintcdn.com/callcloserai/iaAlrEI0uRGNqTGB/resources/twillio-autocalls-auth-integration.png?fit=max&auto=format&n=iaAlrEI0uRGNqTGB&q=85&s=b252721b7b81a4893c8db9cc71dfb5a9" alt="Fill in your details based on your integration type" width="1117" height="402" data-path="resources/twillio-autocalls-auth-integration.png" />
</Frame>

5. Here you will supply the termination SIP URI you set up in Step 1.

```
Server address: e.g., xxx.pstn.twillio.com
```

<Frame>
  <img src="https://mintcdn.com/callcloserai/jcscMEOz3zSYo1nL/resources/twillio-outbound-settings.PNG?fit=max&auto=format&n=jcscMEOz3zSYo1nL&q=85&s=c5ff9ca985611679667744556e4e61ed" alt="Twillio Connect Number via SIP" width="1109" height="344" data-path="resources/twillio-outbound-settings.PNG" />
</Frame>

6. Here select Authorization type as you opted in step 2.

* If IP type is the option you have selected, add the IPs

```
54.244.51.0
  54.244.51.1  
  54.244.51.2
  54.244.51.3
54.172.60.0
  54.172.60.1
  54.172.60.2
  54.172.60.3
```

<Frame>
  <img src="https://mintcdn.com/callcloserai/iaAlrEI0uRGNqTGB/resources/twillio-autocalls-credentials-ip-type1.png?fit=max&auto=format&n=iaAlrEI0uRGNqTGB&q=85&s=a3ea12d2dd6fe3c91d705dae1cfd0a3a" alt="Twillio CallCloser Credentials IP Type" width="1104" height="466" data-path="resources/twillio-autocalls-credentials-ip-type1.png" />
</Frame>

7. Select the country of where your SIP trunk is located.

   <Frame>
     <img src="https://mintcdn.com/callcloserai/iaAlrEI0uRGNqTGB/resources/twillio-autocalls-sip-country.png?fit=max&auto=format&n=iaAlrEI0uRGNqTGB&q=85&s=aa2a1d822606837ab4cf69067d1af2b9" alt="Twillio CallCloser SIP Country" width="1108" height="98" data-path="resources/twillio-autocalls-sip-country.png" />
   </Frame>

### Step 4: Verify Setup

After configuration:

1. Make a test call to your number/extension
2. Check that the AI assistant answers
3. Use the test call feature to verify outbound calling

## Security Requirements

Your SIP credentials need to be secure:

* **Username**: Your extension number or provider-supplied username
* **Password must have**:
  * 12 or more characters
  * Numbers
  * Upper and lowercase letters
  * Special characters recommended

## Common Issues

<AccordionGroup>
  <Accordion title="After connecting, inbound works but outbound does not work?">
    * Check your Termination SIP URI If there’s a space in it, please remove. Also you should use a localized termination uri that’s near your region. Check out this [doc](https://www.twilio.com/docs/global-infrastructure/localized-uris/termination) to select one.
    * Check your user name and credentials Please make sure you entered the right user name and credentials which shows in this dialog. Please note the user name is not the friendly name that shows in the credential list. The friendly is different to user name, you need to double check if you happen to give a different name.

    <Frame>
      <img src="https://mintcdn.com/callcloserai/jcscMEOz3zSYo1nL/resources/twillio-outbound-not-work.png?fit=max&auto=format&n=jcscMEOz3zSYo1nL&q=85&s=857ed160c3cf4b68beaf858b96268dd0" alt="Twillio outbound not work" width="2692" height="1166" data-path="resources/twillio-outbound-not-work.png" />
    </Frame>
  </Accordion>

  {" "}

  <Accordion title="How do I set up dialing to international countries?">
    * Search “geo” to find the “Voice Geographic Permissions” setting.
          <Frame>
            <img src="https://mintcdn.com/callcloserai/jcscMEOz3zSYo1nL/resources/twillio-setup-dialing-international.png?fit=max&auto=format&n=jcscMEOz3zSYo1nL&q=85&s=e48f02cbea76b853ad4b700e8facbf01" alt="Twillio setup dialing international" width="2136" height="1428" data-path="resources/twillio-setup-dialing-international.png" />
          </Frame>
    * Choose “Elastic Sip Trunking” in selector, and select the countries you would like to dial.
          <Frame>
            <img src="https://mintcdn.com/callcloserai/iaAlrEI0uRGNqTGB/resources/twillio-choose-elastic-sip-trunking.png?fit=max&auto=format&n=iaAlrEI0uRGNqTGB&q=85&s=0af7449106f7f6a4d40f36f7caf6f4c6" alt="Twillio setup dialing international" width="3440" height="1614" data-path="resources/twillio-choose-elastic-sip-trunking.png" />
          </Frame>
  </Accordion>

  {" "}
</AccordionGroup>

***

<Note>
  Need help setting up? Our support team specializes in helping customers
  integrate their phone systems. We'll guide you through the entire process,
  ensuring a smooth setup with your specific phone system configuration.
</Note>
