GitHubContribute in GitHub: Edit online

copyright: years: 2017, 2023 lastupdated: "2023-01-05"


Setting up a Twilio SIP trunk for self-service agents

For self-service agents, SIP trunks provide one option for connecting a caller to IBM® Voice Gateway. Integrating directly with a SIP trunk is typically used to set up Voice Gateway outside of an enterprise network. Alternatively, you can configure a session border controller (SBC) to forward calls to Voice Gateway using a SIP INVITE request.

This article describes how to configure a Twilio® SIP trunk to use Voice Gateway running in a cloud-based container service, such as IBM Cloud Kubernetes Service. In typical on-premises deployments in an enterprise network, there is a session border controller between the voice gateway and the SIP trunk. In this setup, the SBC must be configured to route calls to Voice Gateway.

Twilio Elastic SIP Trunking

One common setup is to deploy Voice Gateway to a cloud-based container service, such as IBM Cloud Kubernetes Service, and then use a Twilio SIP trunk to access Voice Gateway. Twilio is a cloud-based communications company that provides a simple way to provision a telephone number that can be connected to a SIP-based service, such as Voice Gateway.

For more information about setting up Twilio Elastic SIP Trunking, see the Twilio documentation.

Not using Twilio?

IBM Voice Gateway can be used with any SIP trunk provider, such as Tata Communications.

Setting up a Twilio SIP trunk to work with Voice Gateway

  1. Create a Twilio account.

    Note: Creating an account requires a credit card, which will be periodically charged based on your usage of the SIP trunk that you configure.

  2. Create a SIP trunk by going to the SIP dashboard and clicking on the + icon. In the resulting dialog box, enter a name for your SIP trunk, and click Create.

  3. Configure the Origination address, which is the public SIP URI of your Voice Gateway.

    If Voice Gateway is deployed to Kubernetes in IBM Cloud Kubernetes Service, you can run the following command to determine the IP address of the SIP Orchestrator:

    ibmcloud ks workers myClusterName
    

    In the Twilio dashboard, enter the origination address in the following format:

    sip:<address:port>;transport=tcp
    

    Note that you don't need to set the transport protocol to TCP. However, SIP invites that are sent over UDP will not reach your Voice Gateway if they exceed the 1500-byte maximum transmission unit (MTU) of IBM Cloud Kubernetes Service. Exceeding the 1500-byte MTU isn't typically a problem with Twilio SIP trunks, but it's possible.

  4. Create a phone number and assign it to the SIP trunk.

    1. Go to the Number dashboard, and click the + icon. A panel will display where you can provision a new phone number in your region.

    2. Assign the number to the SIP trunk you created by navigating back to the SIP trunk and clicking on the Number icon.

    After the number is associated with your SIP trunk, you can make calls to the self-service agent hosted by your Voice Gateway.

Important: Whitelist calls to your Twilio number. Whitelisting the phone number helps to prevent denial-of-service (DoS) attacks and other unwanted sessions from outside sources, which could incur unnecessary Watson™ service charges and affect Voice Gateway performance. * Multi-tenant JSON configuration: Configure your Twilio number as a tenant in your multi-tenant JSON configuration file. Only calls to configured tenants can go through. * Single-tenant environments: In your Voice Gateway configuration, set the WHITELIST_TO_URI environment variable to your Twilio phone number.

For example, if your Twilio phone number is +1-234-555-6789, set the `WHITELIST_TO_URI` environment variable to a subset of the number, such as the area code and phone number.

```json

{ "name": "WHITELIST_TO_URI", "value": "2345556789" } ``` For more information, see Whitelisting callers and callees.

Monitoring your calls

The main SIP trunking dashboard has a call log that lists calls coming into your trunk. You can also see if any failures occur.