Connecting Asterisk to 2talk

Registering using the SIP Protocol

Asterisk is a very popular open source PBX which will work well with our platforms. Other variants/forks of Asterisk include FreePBX, Trixbox and Callweaver. You can connect to our service using either the SIP or IAX2 protocol. The way you configure your Asterisk server is up to you, but the following provides a good template to start making calls through 2talk.

Since examples are always the best way to illustrate configuration guides, here is an example configuration where obviously you should replace the 'yournumber' with your actual 2talk number (e.g. 61280111801) and 'yourpassword' with your 2talk password.

sip.conf

[general]

registerattempts=0
registertimeout=20

; Register line should be somewhere inside your general section

register => yournumber:[email protected]/yournumber

[2talk]

type=friend
username=yournumber
fromuser=yournumber
secret=yourpassword
host=phone.2talk.com.au
context=default ; or your own selected context if desired
dtmfmode=rfc2833
disallow=all
allow=alaw
allow=ulaw
;allow=g729 ; only if you have licenses to use it
nat=yes
canreinvite=no
insecure=invite,port ; use very in later versions of Asterisk such as v1.4

extensions.conf

[default]

;receive incoming calls to a connected phone

exten => s,1,Dial(SIP/yournumber)

; outbound calls (outside of your own PBX)

exten => _X.*,1,Dial(SIP/${EXTEN}@2talk)


If you are still having problems connecting to our service then please log a support ticket at https://www.2talk.com.au/support.html for assistance.

Registering using the IAX2 Protocol

2talk also support the IAX2 Protocol aimed at customers with an Asterisk based IP-PBX system including Asterisk, Trixbox, FreePBX, Callweaver and others.

If your IP-PBX, gateway or phone supports the IAX2 protocol then it should be compatible with our IAX2 service. IAX2 has a number of advantages over the SIP protocol including:
For more benefits of IAX2 over SIP visit:
http://www.voip-info.org/wiki/view/IAX+versus+SIP

Below is a basic example configuration in the Asterisk 'iax.conf' file where the customer phone number is 61280111801 and password is 'yourpassword'. Obviously you replace these with your own phone number and password.

[general]

bandwidth=low
disallow=all
allow=gsm
allow=alaw
allow=ulaw
allow=ilbc
trunkfreq=20
trunktimestamps=yes
tos=ef

register => 61280111801:[email protected]

[61280111801]
type=friend
username=61280111801
trunk=yes
context=from-trunk (* See below note on context)
host=phone.2talk.com.au
secret=yourpassword
auth=md5
disallow=all
allow=gsm
allow=alaw
allow=ulaw (specify your own codec preferences in the allow's here)

* If your context for incoming calls is not 'from-trunk' then you will need to login to the 2talk Portal and change your 'IAX2 context' under the 'Preferences' area and then the 'Voice Quality & Networking' section. Here you can specify your own context string used for incoming IAX2 calls. By default Trixbox/FreePBX servers tend to use 'from-trunk' which is why we have made this the default context setting for IAX2 trunks.

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 independantly.

Trixbox Settings

Trixbox configuration is done slightly differently than standard Asterisk configurations. Below is an example IAX2 configuration for Trixbox. Obviously you will need to change the phone number 61280111801 and password 'yourpassword' to be your own phone number and password. The example also assume g729 is used as the codec. If you do not have a license for this codec then substitute this for gsm, alaw or ulaw etc.:

[Peer Details]
username=61280111801
type=friend
secret=yourpassword
nat=route
insecure=port,invite ; or use 'very' here for older versions of Asterisk
host=phone.2talk.com.au
fromuser=61280111801
disallow=all
trunk=yes
context=from-trunk
canreinvite=no
bandwidth=low
allow=g729 ; Replace the codec with gsm or alaw if you do not have the g729 codec supported
requirecalltoken=no ; Required for Asterisk 1.6+ compatibility

[User Details]
username=61280111801
type=friend
secret=yourpassword
nat=route
insecure=port,invite ; or use 'very' here for older versions of Asterisk
host=phone.2talk.com.au
context=from-pstn

[Registration]
61280111801:[email protected]

Also a couple of other points to note:

You then need to update your dial plan and replace the 'Dial' command(s) to use IAX2 instead of SIP. For example:

exten => _X.,1,Dial(IAX2/61280111801/${EXTEN})

© 2013 2talk Pty, Australia