Notes:
Option | Value |
---|---|
TRUNK NAME | testing |
Call Recording | No |
Secure Trunking | Disabled |
Option | Value |
---|---|
Termination URI | testing.pstn.twilio.com (Choose whatever you want) |
IP Access Control Lists | Choose what IP will be granted to communicate with your trunk. In this tutorial I will use my public IP address: 123.123.123.123 |
Creditentiel Lists | Create a username and password that will be used to connect to our trunk later. In this tutorial I will use: Username: MY_USERNAME123 Password: MY_PASSWORD123 |
Option | Value |
---|---|
Origination SIP URI | sip:123.123.123.123 |
Priority | 10 |
Weight | 10 |
For now, we will need to create 1 truck for outgoing calls.
Let’s begin by creating a SIP trunk of type chan_sip.
Option | Value |
---|---|
Trunk Name | twilio0 |
Hide CallerID | No |
Outbound CallerID | +15791231234 (Twilio number in E.164 format) |
CID Options | Allow Any CID (if your are using Twilio Trial, use Force Trunk CID) |
Asterisk Trunk Dial Options | T |
Preprend | Prefix | Match pattern |
---|---|---|
+1579xxxxxxx (I will only accept calls to local numbers starting with +1579 and followed by 7 other numbers) |
Option | Value |
---|---|
Trunk Name | twilio0 |
PEER Details | host=testing.pstn.twilio.com username=MY_USERNAME123 secret=MY_PASSWORD123 type=peer dtmfmode=rfc2833 canreinvite=no disallow=all allow=ulaw insecure=port,invite context=from-trunk nat=yes |
Leave empty
Option | Value |
---|---|
Route Name | PBX to Twilio Trunk (whatever you want it to be called) |
Route Password | Set this only if you want this route to be password protected, so only a few users could use it. |
Trunk Sequence for Matched Routes | twilio0 |
Preprend | Prefix | Match pattern | CallerID |
---|---|---|---|
+1579xxxxxxx | |||
+ | 1579xxxxxxx | ||
+1 | 579xxxxxxx |
That’s it! You should now be able to place outbound calls! We can now begin we the configuration of incoming calls.
For now, we will need to create 4 trucks for incoming calls.
Why do we need to create 4 trunks?
Because we have to create one for each Twilio’s IP addresses.
I used NORTH AMERICA VIRGINIA Twilio’s IP addresses:
54.172.60.0, 54.172.60.1, 54.172.60.2 and 54.172.60.3
https://www.twilio.com/console/sip-trunking/your-network
Let’s begin by creating an SIP trunk of type chan_sip and you will have to do the same for all other Twilio’s IP addresses.
Option | Value |
---|---|
Trunk Name | twilio1 |
Hide CallerID | No |
Outbound CallerID | |
CID Options | Allow Any CID |
Asterisk Trunk Dial Options | T |
Option | Value |
---|---|
Trunk Name | twilio1 |
PEER Details |
Option | Value |
---|---|
USER Context | twilioin1 |
USER Details | host=54.172.60.0 (first Twilio’s IP) type=peer insecure=port,invite canreinivite=no |
Follow the routine for the next three IP addresses.
Option | Value |
---|---|
Description | Twilio Trunk to PBX |
Set Destination | Choose where you want inbound calls to be routed in your PBX server. You could route them to a group of extensions (All Desks) or one extension (Office Desk). |
You should now be able to receive calls!
Remote extension can’t register:
- Verify that your ports are opened (5060, 10000-10500) on the server.
- Verify that your client have opened port 5060.
- Try to change the remote extension “nat option” to yes in the Extension module from Applications menu.
Requirements For now, AWHSPanel only supports Debian 8 but its architecture allows easy new implementations.…
ionCube installation What is ionCube: ionCube helps you to protect your PHP code from being…
RewriteEngine on RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
Files Structure: /srv /mydomain.com /.socks /www /cgi-bin /logs /public_html /ssl /tmp /blog /cgi-bin /logs /public_html…
Prerequisites: - 1 database (mysql) - 1 user associated with the database - Follow this…
1. Virtual Host If you need to create a Virtual Host on Apache2 I recommend…
View Comments
Do I have to open the ports 5060 and 10000-20000 on my router as well?
Yes! Do not hesitate if you have any other questions.
If you have problem with match patterns, put everything in lowercase.
I am having a one-way audio issue. I can hear incoming audio, but not outgoing sound. Any suggestions?
Hi, try to change the remote extension “nat option” to yes in the Extension module from Applications menu.
Hi Chris,
For your implementation as described above -
My setup is behind a router.
The private (internal) IP address of my FreePBX server is 192.168.10.160.
FreePBX by default uses port 5160 for chan_sip but I changed it to 5060.
FreePBX by default uses ports from 10000 to 20000 for RTP but I changed them from 10000 to 10500.
The public (external) IP address is 123.123.123.123.
Did you have to forward External IP (123.123.123.123) call on ports 5060, 10000 and 10500 to Internal IP (192.168.10.60) ports 5060, 10000 and 10500 ?
Hey Surfer Boy, you are absolutely right. You probably found the solution by the time I saw your comment :D, sorry...
thanks for this! finally got inbound calls to ring but still working to get bi-directional audio.
i have freepbx 14 asterisk 13 and i created the twilio trunk as you did but i got this warning chan_sip.c: Section 'TwilioVirginia-54.172.60.0-out' lacks type . what does this mean ?