Asterisk Configuration Guide
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 Hero Internet.
Configure Asterisk with Hero Internet using CHAN_SIP
/etc/sip.conf
Replace <yourphonenumber> with your phone number and <yourpassword> with your phone password
registerattempts=0
registertimeout=20
; Register line should be somewhere inside your general section
register => <yourphonenumber>:<yourpassword>@sip.hero.co.nz/<yourphonenumber>
[HeroInternet]
type=friend
username=<yourphonenumber>
fromuser=<yourphonenumber>
secret=<yourpassword>
host=sip.hero.co.nz
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 older versions of Asterisk such as v1.4
extensions.conf
;receive incoming calls to a connected phone
exten => s,1,Dial(SIP/<yourphonenumber>)
; outbound calls (outside of your own PBX)
exten => _X.*,1,Dial(SIP/${EXTEN}@HeroInternet)
Configure Asterisk with Hero Internet using PJSIP
/etc/pjsip.conf
Replace <yourphonenumber>; with your phone number and <yourpassword>; with your phone password
[simpletrans]
type=transport
protocol=udp ; or tls for TLS registration
bind=0.0.0.0
;===============TRUNK
[herotrunk]
type=registration
outbound_auth=hero
server_uri=sip:sip.hero.co.nz
client_uri=sip:<yourphonenumber>@sip.hero.co.nz
retry_interval=60
[herotrunk]
type=auth
auth_type=userpass
password=<yourpassword>
username=<yourphonenumber>
[herotrunk]
type=aor
contact=sip:sip.hero.co.nz:5060 ; or sip.hero.co.nz:5061 for TLS registration
[herotrunk]
type=endpoint
context=from-external
disallow=all
allow=alaw
outbound_auth=herotrunk
aors=herotrunk
[herotrunk]
type=identify
endpoint=herotrunk
match=sip.hero.co.nz
Configure Asterisk with Hero Internet using IAX2
/etc/iax.conf
Replace <yourphonenumber> with your phone number and <yourpassword> with your phone password
bandwidth=low
disallow=all
allow=gsm
allow=alaw
allow=ulaw
allow=ilbc
trunkfreq=20
trunktimestamps=yes tos=ef
register => <yourphonenumber>:<yourpassword>@iax2.hero.co.nz
[<yourphonenumber>]
type=friend
username=<yourphonenumber>
trunk=yes
context=from-trunk ;(* See below note on context)
host=iax2.hero.co.nz
secret=<yourpassword>
auth=md5
disallow=all
allow=gsm
allow=alaw
allow=ulaw ;(specify your own codec preferences in the allow's here)
NOTES:
* If your context for incoming calls is not 'from-trunk' then you will need to login to the Hero Internet 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.
** 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.