Skip to main content

Twilio (SIP credentials)

Connect your Twilio account with DIDlogic using digest authentication. This tutorial covers setting up Twilio SIP Domains, Access Control Lists (ACLs), and TwiML Bins to handle both inbound and outbound voice traffic.

tip

There are two ways to connect Twilio. This guide is fully self-service, but your SIP password is stored in Twilio in plain text. The recommended option is Twilio (Account SID): your password isn't stored in Twilio, but our support team needs to set up the SIP account for you.

Outbound call routing​

  1. Create a SIP account

  2. In Twilio, go to Develop → Voice → Manage → SIP domains.

  3. On the Programmable SIP Domains page, add a new SIP domain by clicking on the "+" button. A "New SIP Domain" page will open.

  4. Enter the desired name into the "Friendly name" field; it can be anything. Afterwards, enter the desired name into the "SIP URI" field, and ensure it is available.

  5. On the same page, navigate down to "Voice Authentication" and press the "+" button next to the "IP access control lists".

  6. Enter the name for the new ACL, the IP address of your PBX, and the name of your PBX. Then press "Create ACL".

  7. Your "Voice Authentication" should look like this. Press "Save"

  8. In the top left corner, enter "TwiML Bin" in the search bar and select "Create TwiML Bin".

  9. On the newly opened page, enter the name for your TwiML Bin, and enter the following into the "TwiML" field, replacing the username and password with your SIP account credentials:

    <?xml version="1.0" encoding="UTF-8"?>
    <Response>
    <Dial callerId="{{#e164}}{{From}}{{/e164}}">
    <Sip username="YOUR_SIP_ACCOUNT" password="YOUR_SIP_PASSWORD">
    sip:{{#e164}}{{To}}{{/e164}}@sip.nyc.didlogic.net
    </Sip>
    </Dial>
    </Response>

    Warning: Credentials entered into a TwiML Bin are stored in plain text and are visible to anyone with access to your Twilio Console. For security reasons, we strongly recommend:

    • Creating a dedicated SIP account exclusively for this Twilio integration.
    • Setting a strict spending/balance limit on this SIP account to minimize potential exposure.
  10. Replace sip.nyc.didlogic.net with the SIP gateway closest to your location, and hit "Create".

  11. Navigate back to the SIP domain and under Call Control Configuration, set Configure with to TwiML Bin and select the bin you created. Click "Save".

If you wish to use Twilio or any other third party Caller ID to place outbound calls, you will need to have the Caller ID Passthrough feature enabled. Otherwise, calls will use the Caller ID configured in the SIP account. If you wish to enable the Caller ID Passthrough feature, please contact your account manager.

Inbound call routing​

Twilio configuration​

  1. Sign in to the Twilio dashboard and go to Develop → Voice → Manage → IP Access Control Lists.

  2. Click on "Create new Access Control List" and enter the name for the ACL and an IP address of a regional gateway from the list specified in Outbound Calling.

  3. Press "Create new ACL". You will be redirected to a new ACL. Click on "Create new IP Address Range".

  4. In the newly opened window, copy and paste all the IP addresses from the list specified in Outbound Calling, one by one.

  5. After all the didlogic IP addresses are added, navigate to Develop → Voice → Manage → SIP domains.

  6. Create a SIP domain for inbound calls, enter the desired name into the "Friendly name" field; it can be anything. Afterwards, enter the desired name into the "SIP URI" field, and ensure it is available.

  7. On the same page, navigate down to "Voice Authentication" and add the newly created ACL list.

  8. In the top left corner, enter "TwiML Bin" in the search bar and select "Create TwiML Bin".

  9. Enter the name for your TwiML Bin, and then enter the following into the "TwiML" field. Replace YOUR_CLIENT_ID or the entire <Client> section to fit your endpoint, as the configuration may vary. Afterwards, click "Create".

    <?xml version="1.0" encoding="UTF-8"?>
    <Response>
    <Dial callerId="{{#e164}}{{From}}{{/e164}}">
    <Client>YOUR_CLIENT_ID</Client>
    </Dial>
    </Response>
  10. Navigate back to the SIP domain and select the "Call Control Configuration" to be "TwiML Bin", assign the created TwiML Bin. Click "Save".

didlogic configuration​

  1. Navigate to your didlogic account and enter the Purchased section.

  2. Locate the number you want to set up and click "Edit".

  3. In the dropdown menu, select "SIP URI", enter YOUR_PHONE_NUMBER@YOUR_SIP_DOMAIN, and press "Add".

  4. The new destination will appear below.

If you are having issues with "Call Control Configuration", you may put the destination directly into the DID on our portal, avoiding the inbound call routing to Twilio. For more information on inbound setup, please refer to the Inbound Setup.