How to: Configure Tel2 SIP trunk with Asterisk using IAX2
Matthew Atkinson
Last Update 10 months ago
As a big supporter of open source projects, Tel2 supports connectivity to Asterisk using either the SIP or IAX2 protocol.
This guide is a sample configuration for connecting to Asterisk using IAX2 (iax.conf). For sample configurations for PJSIP or CHAN_SIP, please see our configuration guides:
- PJSIP Configuration Guide
- IAX2 Configuration Guide
NOTE: To use the IAX2 Registration method, you first need to configure the connection type of your Tel2 phone number in the web portal. Please see this guide for to find out how to do this.
Asterisk Configuration
In the below sample configs, replace '{{yournumber}}' with your actual Tel2 number (e.g. 442034567890) and '{{yourpassword}}' with your Tel2 password.
iax.conf
[general]
bandwidth=low
disallow=all
allow=gsm
allow=alaw
allow=ulaw
allow=ilbc
trunkfreq=20
trunktimestamps=yes
tos=ef
register => {{yournumber}}:{{yourpassword}}@phone.tel2.co.uk
[{{yournumber}}]
type=friend
username={{yournumber}}
trunk=yes
context=from-trunk (*** See below note on context)
host=phone.tel2.co.uk
secret={{yourpassword}}
auth=md5
disallow=all
allow=gsm
allow=alaw
allow=ulaw (specify your own codec preferences in the allow's here)
extensions.conf
exten => _X.,1,Dial(IAX2/{{yournumber}}/${EXTEN})
*** Tel2 use from-trunk as the default dialplan context. This can be changed in the Tel2 web portal.
NOTE: If you wish to have multiple numbers presented over IAX2 then you need to create a 'register' and 'peer' entry for each number in your IAX configuration file since each line on your account acts independently.
Additional Notes
- If you have previously enabled 'SIP trunking/peering' on your account then you first need to disable this to use the IAX2 trunking service since SIP trunking takes precedence over the IAX2 routing.
- You MUST name your IAX trunk the same as your username. So if your login name is 442034567890 then you should also name your trunk this as well. Using a separate name for your trunk/peer definition will cause problems with calls.
You should also put an explicit 'context=xxxx' line (where xxxx is your preferred context) in your peer definition.