Choose:
Configure an Asterisk PBX Trunk
Introduction to Asterisk
Asterisk is an open source framework for building communications applications. Asterisk turns an ordinary computer into a communications server. Asterisk powers IP PBX systems, VoIP gateways, conference servers and other custom solutions. It is used by small businesses, large businesses, call centers, carriers and government agencies, worldwide.
You'll need to have created a credentials based connection on your Telnyx Mission Control Portal account, assigned this connection to a DID and outbound profile in order to make and receive calls. Our Mission Control Portal was designed with ease of use in mind, but if you need a little help check out our demo for setting up a SIP connection in a couple of minutes.
Asterisk PBX Prerequisites
- Download - Asterisk Version 16 is available to download from here.
- Installation - You can view the installation guide here.
- Configure Your Telnyx Mission Control Portal
Once you've configured your Telnyx account, you can now proceed to setup Asterisk following the guide below.
Asterisk PBX Setup Guide
Telnyx SIP Trunk Setup For Asterisk
Open up /etc/asterisk/pjsip_wizard.conf
with your preferred editor, and add the rows as below, where username and password are custom for your installation:
trunk_defaults
type = wizard
telnyx
endpoint/transport=0.0.0.0-udp
endpoint/allow = !all,ulaw,alaw,G729,G722
endpoint/rewrite_contact=yes
endpoint/dtmf_mode=rfc4733
endpoint/context = from-pstn
endpoint/force_rport = yes
aor/qualify_frequency = 60
sends_auth = yes
sends_registrations = yes
remote_hosts = sip.telnyx.com:5060
outbound_auth/username = username
outbound_auth/password = password
registration/expiration = 600
Note: For this configuration to work, the module
res_pjsip_config_wizard.so
must be installed and loaded, available from Asterisk 13.2.0.
Configure to Make and Accept Calls
Modify /etc/asterisk/pjsip_wizard.conf
in order to add the global configurations for the extensions, and specific ones for the sample. Here we are setting up extension 1001 to make and accept calls. Parameters in the below section that reference 1001
and password
can be customized for your requirements.
user_defaults
type = wizard
accepts_registrations = yes
sends_registrations = no
accepts_auth = yes
sends_auth = no
endpoint/context = from-internal
endpoint/allow = !all,ulaw,alaw,G729,G722
endpoint/dtmf_mode = rfc4733
endpoint/rewrite_contact = yes
endpoint/force_rport = yes
aor/max_contacts = 1
aor/remove_existing = yes
aor/minimum_expiration = 30
1001
endpoint/callerid = Test User <1001>
inbound_auth/username = 1001
inbound_auth/password = [email protected]$
Completing the basic PJSIP configuration
Even though pjsip_wizard.conf
is a great facilitator in setting up PJSIP endpoints, global configurations, or anything else that might be needed can still be added in /etc/asterisk/pjsip.conf
.
In the scope of our basic setup, add the lines below to pjsip.conf
for installations behind NAT.
[global]
type=global
[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0:5060
local_net=X.X.X.X/24
external_media_address=X.X.X.X
external_signaling_address=X.X.X.X
allow_reload=no
- In case the PBX is not in a NATed network, you can safely remove the parameters external_media_address and external_signaling_address.
- With the above configurations added to the respective files, your PBX should be now registered to Telnyx, and the extension 1001 in your IP phone/softphone should be registered to your PBX, but there is one last step needed in order to make calls flow.
Setting Up The Dialplan
Asterisk makes use of the dialplans saved in /etc/asterisk/extensions.conf
in order to route calls between endpoints, among other tasks.
To allow our extension 1001 to call the world through Telnyx, as well as send to it any calls that arrive to the Telnyx DID assigned to the respective trunk, you need to open up extension.conf and add the following lines of code:
[from-pstn]
exten => _+1NXXXXXXXXX,1,Dial(PJSIP/1001)
exten => _NXXXXXXXXX,1,Dial(PJSIP/1001)
[from-internal]
exten = _NXXNXXXXXX,1,Dial(PJSIP/+1${EXTEN}@telnyx)
same = n,Hangup()
exten = _X.,1,Dial(PJSIP/+${EXTEN}@telnyx)
same = n,Hangup()
[from-pstn]
is the context that captures inbound calls to the PBX coming from Telnyx, and sends them to the extension 1001. With the above lines, it will capture every call towards CLDs in US national (10 digit) or +E164 and send it to the extension 1001.[from-internal]
serves to route calls towards the world through Telnyx. In the example above, it will capture calls towards US national numbers, convert to +E164 or towards any other number, prepend “+”, and send the call to Telnyx.
That's it, you've now completed the configuration of Asterisk and can now make and receive calls by using Telnyx as your SIP provider!
Additional Resources
Review our getting started guide to make sure your Telnyx Mission Control Portal account is setup correctly!
Checkout Asterisk's help section for extra support!
Can't find what you're looking for? Click the Live Chat icon at your lower right hand corner and start a chat.
Configure an Asterisk PBX Trunk
How to configure a Asterisk IP Based Trunk with Telnyx
Introduction
Asterisk is an open source framework for building communications applications. Asterisk turns an ordinary computer into a communications server. Asterisk powers IP PBX systems, VoIP gateways, conference servers and other custom solutions. It is used by small businesses, large businesses, call centers, carriers and government agencies, worldwide.
You'll need to have created an IP based connection on your Telnyx Mission Control Portal account, assigned this connection to a DID and outbound profile in order to make and receive calls.
Instructions
Download
Asterisk Version 16 is available to download from here.
Installation
You can view the installation guide here.
Video Walkthrough
Coming soon! This walkthrough will demonstrate setting up an IP based connection with Asterisk. We'll also show you how to assign this connection to a newly purchased DID which will allow you to receive inbound calls. Then we'll walk you through how to assign the connection to an outbound profile such that you can make outbound calls!
Configuring Your Telnyx Mission Control Portal
For step by step instructions on each of the requirements on the Telnyx Mission Control Portal, please follow this guide.
Once you've configured your Telnyx account, you can now proceed to setup Asterisk following the guide below.
Asterisk Setup Guide
Telnyx SIP Trunk Setup
Open up /etc/asterisk/pjsip_wizard.conf
with your preferred editor, and add the rows as below, where username and password are custom for your installation:
[trunk_defaults]
type = wizard
[telnyx]
endpoint/transport=0.0.0.0-udp
endpoint/allow = !all,ulaw,alaw,G729,G722
endpoint/rewrite_contact=yes
endpoint/dtmf_mode=rfc4733
endpoint/context = from-pstn
endpoint/force_rport = yes
aor/qualify_frequency = 60
sends_auth = no
sends_registrations = no
remote_hosts = sip.telnyx.com:5060
Note: For this configuration to work, the module res_pjsip_config_wizard.so must be installed and loaded, available from Asterisk 13.2.0.
Configure to Make and Accept Calls
Modify /etc/asterisk/pjsip_wizard.conf
in order to add the global configurations for the extensions, and specific ones for the sample. Here we are setting up extension 1001 to make and accept calls. Parameters in the below section that reference 1001
and password
can be customized for your requirements.
[user_defaults](!)
type = wizard
accepts_registrations = yes
sends_registrations = no
accepts_auth = yes
sends_auth = no
endpoint/context = from-internal
endpoint/allow = !all,ulaw,alaw,G729,G722
endpoint/dtmf_mode = rfc4733
endpoint/rewrite_contact = yes
endpoint/force_rport = yes
aor/max_contacts = 1
aor/remove_existing = yes
aor/minimum_expiration = 30
[1001](user_defaults)
endpoint/callerid = Test User <1001>
inbound_auth/username = 1001
inbound_auth/password = [email protected]$
Completing the basic PJSIP Configuration
Even though pjsip_wizard.conf
is a great facilitator in setting up PJSIP endpoints, global configurations, or anything else that might be needed can still be added in /etc/asterisk/pjsip.conf
.
In the scope of our basic setup, add the lines below to pjsip.conf
for installations behind NAT.
[global]
type=global
[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0:5060
local_net=X.X.X.X/24
external_media_address=X.X.X.X
external_signaling_address=X.X.X.X
allow_reload=no
- In case the PBX is not in a NATed network, you can safely remove the parameters external_media_address and external_signaling_address.
- With the above configurations added to the respective files, your PBX should be now registered to Telnyx, and the extension 1001 in your IP phone/softphone should be registered to your PBX, but there is one last step needed in order to make calls flow.
Setting Up The Dialplan
Asterisk makes use of the dialplans saved in /etc/asterisk/extensions.conf
in order to route calls between endpoints, among other tasks.
To allow our extension 1001 to call the world through Telnyx, as well as send to it any calls that arrive to the Telnyx DID assigned to the respective trunk, you need to open up extension.conf and add the following lines of code:
[from-pstn]
exten => _+1NXXXXXXXXX,1,Dial(PJSIP/1001)
exten => _NXXXXXXXXX,1,Dial(PJSIP/1001)
[from-internal]
exten = _NXXNXXXXXX,1,Dial(PJSIP/+1${EXTEN}@telnyx)
same = n,Hangup()
exten = _X.,1,Dial(PJSIP/+${EXTEN}@telnyx)
same = n,Hangup()
[from-pstn]
is the context that captures inbound calls to the PBX coming from Telnyx, and sends them to the extension 1001. With the above lines, it will capture every call towards CLDs in US national (10 digit) or +E164 and send it to the extension 1001.[from-internal]
serves to route calls towards the world through Telnyx.
In the example above, it will capture calls towards US national numbers, convert to +E164 or towards any other number, prepend “+”, and send the call to Telnyx.
If your IP based connection uses a tech prefix to authenticate, please make sure that this is also reflected in the dialplan.
For example, if you have set the tech prefix “9999” in Telnyx, your from-internal context should look like:
[from-internal]
exten = _NXXNXXXXXX,1,Dial(PJSIP/9999+1${EXTEN}@telnyx)
same = n,Hangup()
exten = _X.,1,Dial(PJSIP/9999+${EXTEN}@telnyx)
same = n,Hangup()
That's it, you've now completed the configuration of Asterisk and can now make and receive calls by using Telnyx as your SIP provider!
Additional Resources
Review our getting started guide to make sure your Telnyx Mission Control Portal account is setup correctly!
Checkout Asterisk's help section for extra support!
Can't find what you're looking for?
Our knowledge base is currently undergoing a makeover which will include more up to date videos to match our ever growing platform.
Can't find what you're looking for? Click the Live Chat icon at your lower right hand corner and start a chat.