Integrating with Twilio’s Telephony System


Introduction


SIP, or Session Initiation Protocol, is a signaling protocol, used to set up, connect, and disconnect communication sessions, typically voice or video calls, in real-time using an IP (Internet Protocol) Network. 

Identifying phone numbers

To set up your phone integration, you must identify a Main Call Queue Number. If RedRoute is unable to automate a call, it routes the call to the Main Call Queue Number, where an operator or call center representative will handle it.  

Choose a lightly-used phone number (which you input as Public Phone Numbers in the phone integration) to serve as the Main Call Queue Number rather than a highly-used, public-facing number.

If you have an existing IVR system, we also strongly recommend that you identify a Legacy IVR Number to receive a portion of calls while RedRoute ramps up during the launch process. Ensure that this too is a lightly-used phone number.

To identify lightly-used phone numbers, look at the call logs. You can do this one of two ways.

  1. Export call logs via API. 

  2. Download a CSV file from the Twilio Console as follows:

    1. Within the Twilio Console, click Dock to open additional options.

    2. In Communications Cloud, click Programmable Voice.

  1. From the Calls drop-down list, select Call Logs.

  1. Export the calls as a CSV file to analyze the call volume per number.

Identify the 2 most infrequently used phone numbers from the list. It is important that these numbers receive very little volume as we will set them as the Main Call Queue Number (the number with the lowest call volume) and Legacy IVR Number

  • Double-check that these numbers aren’t used for any special purpose (VIP number, free phone number, etc).

  • If there are fewer than 2 numbers fitting this criterion, buy any additional numbers from Twilio.

Creating a SIP Trunk

You will need to set up a SIP trunk between Twilio and RedRoute. The following steps will help you:

  1. Within the Twilio Console, click Dock to open up additional options.

  2. In the Super Network pane, click Elastic SIP Trunking.



  1. Select Trunks from the drop-down list. 


  1. On the Elastic SIP Trunks page, click Create new SIP Trunk.


  1. Enter a name for the SIP Trunk (we recommend naming it RedRoute), and click Create.

  2. Within the Elastic SIP Trunking pane of the newly created trunk, select Origination.


  1. In the Origination window, click to create an origination URI:


  1. Open the RedRoute portal.

  2. In the Create a SIP Connection page, copy the FQDN in the RedRoute Domain section.


  1. Return to the Twilio Origination page and paste the FQDN name you copied into the Origination SIP URI, ensuring that the identifier begins with sip.  For example, if the RedRoute portal provides redroute.rraccess.com as the RedRoute domain, enter sip:redroute.rraccess.com into Twilio.

  1. Leave Priority and Weight as the default values and click Add. The Origination window displays.


Your new Origination SIP URI must be the only Origination SIP URI for this trunk.


  1. In the Elastic SIP Trunking pane, select Termination.

  2. In the Termination SIP URI input field, enter a Termination URI. This identifier can be any text. For example, we named our example demo-prod.

  1. Create an IP Access Control List with the signaling IPs for your region, listed here

  2. Return to the RedRoute portal.

  3. In the Sending Domain field, enter pstn.twilio.com.

  4. In Receiving Domain, enter the Termination URI. Ensure that you include the full pstn.twilio.com ending. Click Next.

Sending Calls Through the SIP Trunk

Now that you’ve set up the SIP trunk in Twilio and the RedRoute portal, you can send calls through that SIP Trunk.


Note: Only do this when the RedRoute portal prompts you. If done prematurely, calls could be dropped.

To send calls through the SIP Trunk, complete the following steps:


  1. Click Dock within the Twilio Console. 

  2. Under Super Network, select Phone Numbers.

  1. From the Phone Numbers pane, select Active Numbers.


  1. In the Active Numbers drop-down list, select the phone number that you’d like to use with RedRoute.

  2. Scroll down to Voice & Fax.

  3. In the Configure with field, ensure that SIP Trunk is chosen.

  4. In the SIP Trunk field, select the recently created SIP Trunk and choose Save.

Repeat these steps for all numbers that you use with RedRoute.


Internal Telephony Number


For Twilio phone numbers, the Internal Telephony Number is the same as the Public Phone Number. In the RedRoute portal, these two fields should be the same.