Prerequisites Asterisk Credentials Based

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.

 

Instructions

Download

Asterisk Version 15 is available to download from here.

Installation

You can view the installation guide here.

Video Walkthrough

Coming soon! This walkthrough will demonstrate setting up a Credential 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!

Step by Step Guide

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.

CONFIGURING YOUR ASTERISK

Setting up the trunk with Telnyx using pjsip_wizard.conf*

Open up /etc/asterisk/pjsip_wizard.conf with your preferred editor, and add the rows as below, where the parts in green 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

 

*Please note that for this configuration to work, the module res_pjsip_config_wizard.so must be installed and loaded, available from Asterisk 13.2.0.

Setting up extension 1001 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. As above, and in the rest of this document, parts in green inside code snippets are custom.

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 = strong@pass123$

 

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 with 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 chat bubble at your lower right hand corner and start a chat!

Did this answer your question?