Wednesday 27 September 2017

Telnyx SIP trunk and number configuration with Asterisk


Telnyx SIP trunk and number configuration

This article shows you how to configure Telnyx SIP trunk to Asterisk server and how to receive incoming call and make outgoing call. For this it is assumed that you have telnyx account and working Asterisk server with internet connection. I have done this on Asterisk box on cloud with live IP.

First login to telnyx portal with your email and password from link, https://portal.telnyx.com
Here now we need to create connection and add outbound profile.

Creating connection:
Once you logged into the portal you can see below dasboard, now click on connections as shown below.




Now, click on Add Connection and fill out form, the details should look like below, here we selected IP authentication.




Create outbound profile:
Likewise, click on outbound as shown below, then ckick on Add Outbound Profile. Your outbound profile should like as shown below




Now we have created connection (origination) and outbound profile (termination).

Configuring SIP trunk in Asterisk
First edit sip.conf file in Asterisk server, usually it is found under /etc/asterisk directory.
nano /etc/asterisk/sip.conf, and add below content in it, save it.

[TELNYX]
type=friend
context=telnyxincoming
host=sip.telnyx.com
disallow=all
allow=ulaw
allow=alaw
dtmfmode=rfc2833
insecure=port,invite

Now edit extensions.conf file to receive and make calls
nano /etc/asterisk/extensions.conf, and add below content in it, save it.
;context for receiving incoming call
[telnyxincoming]
exten => 13122700000,1,Dial(SIP/1001)

;your internal SIP phone context
[internallocal]
exten => _1XXXXXXXXXX,1,Dial(SIP/${EXTEN}@TELNYX)
same => n,Hangup()

After this just reload asterisk to take changes into effect.

asterisk -rvvvv
core reload

Now you can buy number from portal, just search numbers which you wish and add to cart and checkout as shown below






Once you bought number assign connection to that numbers to make it working, below is shown how to assign connection to number