Creating Trunks for Twilio
Each provider may have a customized way of configuring a
trunk
to connect with a PBX
. This section details the procedure for connecting Twilio
trunks
with Issabel PBX
. Creating and Configuring Trunks in Twilio
First, log in to the
Twilio
account where the trunk
will be connected and navigate to Develop
→ Static SIP Trunking
→ Manage
→ Trunks
. Here, a list of available trunks
in Twilio
will be displayed. If no trunks
are available, it is possible to create a new one. Configuring a Trunk
in Twilio
A
trunk
in Twilio
has four configuration sections: General, Termination, Origination, and Numbers. General Configuration of a Trunk
in Twilio
In this section, global parameters of the
trunk
can be configured, including: - Name: Refers to a descriptive name to identify the
trunk
. The Trunk SID is the unique identifier of the trunk and is assigned automatically. - Call Recording: When this option is enabled, all calls (both origination and termination traffic) are recorded on a pay-as-you-go model.
- Secure Trunking: This option can be enabled to protect communications distributed over the public Internet by encrypting signaling with Transport Layer Security (TLS) and encrypting media with Secure Real-Time Transport Protocol (SRTP).
- Call Transfer (SIP REFER): This parameter allows transferring an active call from one terminal to another. A call can be transferred to another SIP terminal or the PSTN.
- Additional Features: Additional parameters can be configured and enabled, such as voice information, CNAM lookup, Geographic Permissions, and emergency calls.
Termination Configuration of a Trunk
in Twilio
This section configures outgoing traffic from the communication infrastructure to the PSTN. To use a
trunk
for termination, it must have a Termination SIP URI and at least one authentication scheme (IP Access Control Lists (IP ACL) or Credential Lists), which will be used to authenticate the INVITE for incoming termination calls to Twilio. The IP address to use will generally correspond to the PBX
to be connected to the trunk
. To create a new IP ACL, the following parameters must be entered:
- Properties:
- Friendly Name: A descriptive name without special characters, spaces, or uppercase letters, up to 64 characters long.
- IP Address Range:
- CIDR Network Address: CIDR stands for Classless Inter-Domain Routing, also known as slash notation. It allows assigning and specifying Internet addresses used in inter-domain routing with greater flexibility than the original Internet Protocol address class system. To add only one IP address to the access control list, simply select the /32 option.
- Friendly Name: A descriptive name without special characters, spaces, or uppercase letters, up to 64 characters long.
To create a new Credential List, the following parameters must be entered:
- Properties:
- Friendly Name: A descriptive name without special characters, spaces, or uppercase letters, up to 64 characters long.
- IP Address Range:
- Username: This parameter will be used to authenticate SIP requests and must be sent in response to Twilio's challenge for the initial invite. It can have up to 32 characters.
- Password: This is the password the user will use to authenticate SIP requests. It must be at least 12 characters long, include at least one digit, and use both uppercase and lowercase letters.
Additional information is available about other possible actions, such as the number of calls per second, header manipulation, and instructions for test calls.
Origination Configuration of a Trunk
in Twilio
This section allows configuring incoming traffic to the communication infrastructure from the
PSTN
. The following parameters can be configured: - Origination URI: Allows configuring the IP address (or FQDN) of the network element's entry point in the communication infrastructure
(PBX)
. Multiple Origination URIs with different priorities and weights can be configured. The Priority field determines the precedence of the URI usage.Twilio
will always use the URI with the lowest priority first and will fall back to other URIs of equal or higher value if the session fails. If a service has multiple Origination URIs with the same priority,Twilio
will use the Weight field to determine which URI to use. The Weight is only relevant in relation to other URIs with the same priority. Generally, at least the IP address or domain of thePBX
to be connected to thetrunk
should be added. - Other parameters can also be configured, such as CNAM lookup, disaster recovery, header manipulation, and test calls.
Number Configuration of a Trunk
in Twilio
This section allows linking a phone number to make and receive the corresponding calls. To do this, it is necessary to have a number purchased or imported into the
Twilio
account. From the list of available numbers, select the one to be assigned to the trunk
and link it to it. Configuring Trunks in Issabel PBX
Once a
trunk
is created and configured in Twilio
, it is necessary to create the corresponding SIP trunks
in the PBX
. For incoming traffic, four trunks
must be created in Issabel PBX
, considering the four IP addresses of Twilio
through which the corresponding traffic can be routed. In each incoming trunk
, descriptive names must be configured in both the General Settings section and the Outgoing Settings section. In the latter, in the Peer Details field, the following must be added: bash
type=peer
host=54.172.60.0
transport=udp
port=5060
insecure=port,invite
allow=ulaw
qualify=yes
context=from-pstn-e164-us
For each incoming traffic
trunk
, an identical configuration must be implemented, except for the host parameter in the Peer Details field, which must point to the four IP addresses of Twilio
: 54.172.60.0, 54.172.60.1, 54.172.60.2, and 54.172.60.3, respectively. It is also necessary to create an outgoing SIP
trunk
in Issabel PBX
and configure the following fields: - General Settings:
- Trunk Name: A descriptive name for the trunk.
- Outbound Caller ID: Caller ID for calls made through this
trunk
. Format: <#######>. The "hidden" format <#######> can also be used to hide the caller ID sent through digital lines if compatible with E1/T1/J1/BRI/SIP/IAX.
- Outgoing Settings:
- Trunk Name: A descriptive name for the trunk. It must be unique.
bash
host=your-sip-uri.pstn.twilio.com
type=peer
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
insecure=port,invite
username=your-username
secret=your-secret
qualify=yes
Where the host parameter refers to the SIP URI configured in the Termination section of the
For the outgoing
Learn more about
trunk
in Twilio
. Additionally, the username and secret parameters must be included if a Credential List has been added in the Termination configuration of the trunk
in Twilio
. If no Credential Lists are configured, the IP of the PBX
must be in the Access Control List (ACL) of the trunk
configuration in Twilio
.For the outgoing
trunk
, an outbound route must also be configured to use it. Similarly, inbound routes can be configured to redirect traffic from the created incoming trunks
. Learn more about configuring trunks and routes.Learn more about
trunk
setup in Twilio
If there is any incorrect or incomplete information, or additional information needs to be generated, please write to isscc@issabel.com