Go to navigation

Details for configuring Asterisk

Config for Elastix 2.4 with iiNet Business Trunks
I've mainly put this here for my own reference but it should help others as iinet's documentation isn't correct.

The host (sip.wa...) will be different depending on your state & your domain (mi04.iibusiness.net.au) will be provided by iinet.

Trunk Name: iinetout

PEER Details:
username=0862XXXXXX
type=friend
secret=*******
pedantic=no
nat=no
insecure=very
host=sip.wa.iibusiness.net.au
fromuser=0862XXXXXX
fromdomain=mi04.iibusiness.net.au
disallow=all
context=from-trunk
canreinvite=no
allow=ulaw&alaw

User Context:
USER Details:
canreinvite=no
context=from-trunk
fromuser=0862XXXXXX
host=sip.wa.iibusiness.net.au
insecure=very
qualify=no
secret=*******
type=user
username=0862XXXXXX

Register String -> 0862XXXXXX@iinetout

Config for Asterisk 1.8.7.1 + Asterisk-GUI (Fedora 16 packages)
Fedora 16 comes comes with Asterisk and Asterisk-GUI pre-packaged as RPMs.

  • asterisk-1.8.7.1-1.fc16.x86_64
  • asterisk-sounds-core-en-1.4.22-1.fc16.noarch
  • asterisk-gui-2.0-3.20111230svn5218.fc16.noarch

You will need to configure your iiNet netphone service as a 'Trunk'. Click on the tab 'VOIP Trunks' and then 'New SIP/AIX Trunk'
Enter the following settings entered into the form:

Type: SIP
Context Naming: Assigned by Asterisk GUI
Provider Name: iinet
Hostname: sip.vic.iinet.net.au
Username: 0398761234
Password: s3cr3t

The Username is the external phone number (supplied by iiNet) and the Password is also the one supplied by iiNet.
The Hostname should be sip.state.iinet.net.au as appropriate for your state.
The Provider Name is arbitrary.

Save this form, and then edit it again, filling in the following details:

Codecs: u-law
CallerID: 0398761234
FromUser: 0398761234
insecure: very
Outbound Proxy: sip.vic.iinet.net.au

Edit /etc/asterisk/users.conf outside of the GUI. Add the following line to the newly created trunk:

nat = yes

The final entry in /etc/asterisk/users.conf should look like this:

[trunk_1]
host = sip.vic.iinet.net.au
username = 0398761234
secret = s3cr3t
trunkname = iinet ; GUI metadata  ; GUI metadata
context = DID_trunk_1
hasexten = no
hasiax = no
hassip = yes
registeriax = no
registersip = yes
trunkstyle = voip
insecure = port,invite
fromuser = 0398761234
outboundproxy = sip.vic.iinet.net.au
nat = yes
disallow = all
allow = ulaw

Don't forget to reload the config using systemctl reload asterisk.service

To receive incoming calls, you will need to create an Incoming Call Rule.

  • Click [New Incoming Rule]
  • Select the trunk 'iinet'
    • Time Interval: None
    • Pattern: s
    • Destination: User Extension – 6000

This will direct all incoming calls directly to extension 6000

In order to make outgoing calls, you will also need to create an Outgoing Calling Rule

  • Click [New Calling Rule]
  • Calling Rule Name: iinet_outgoing
  • Pattern: _0.
  • — Send this call through trunk: — -- — --
    • Use Trunk: iinet
    • Strip: 1 digits from front
  • — -- — -- — -- — -- — -- — -- — -- --

This will allow other VoIP phones connected to Asterisk to dial 0 to use the outgoing line, followed by the regular phone number.

Note that the above config had a Billion 7800N ADSL router in between Asterisk and the Internet, with the siproxd option enabled.

Changing to another router without siproxd also required going to 'Options', tab 'Advanced Options'

  • click [Show Advanced Options].

Next, go back to the left-hand menu, and goto 'SIP Settings', tab 'NAT'. Fill in:

  • Extern IP: 12.34.56.78
  • Local Network Address: 10.0.0.0/8

The 'Extern IP' is your Internet IP address. 'Local Network Address' is whatever you are using on your LAN.
The file /etc/asterisk/sip.conf should now contain the following entries:

externip = 12.34.56.78
localnet = 10.0.0.0/8

Config known to work with Asterisk 1.6.0-beta8

This config assumes you have a local extension '101' in your sip.conf file. All incoming calls will be routed to extension '101'.

This config allows for outbound numbers to be dialed with a prepended 0, and all numbers also beginning with a 0. For example, 00418123456 will dial the mobile number 0418 123 456, but 090291234 will not work because the first digit of the outside number is 9. A relatively simple modification to the [outbound-local] section could fix this though.

This will probably work with asterisk versions back until 1.0.9. Versions including and prior to 1.0.9 changed the possible values for the 'insecure' setting. Current versions expect a value of 'port', 'invite' or 'port,invite' however versions 1.0.9 and prior expect a value of 'yes', and 'very'.

0390xxxxxx = your iiNet phone number
yyyyyyy = your iiNet Phone password
zzz.zzz.zzz.zzz = your closest iiNet SIP server (use IP address, not host name)

sip.conf
[general]
register => :yyyyyy:0390xxxxxx@iiNet-out/0390xxxxxx
(as of Asterisk 1.6.0.3, this register format seems not to work, we receive an error "han_sip.c: A reserved character ('@') was used in a "register" line. This registration will not occur"

Note:
If you find that you are unable to make outgoing calls, after an approx 10 sec delay with the error "All circuits are busy, please try again later", try the following registration string instead. This works for me with Asterisk 1.4.2 and FreePBX 2.9.0.7.
register => 0390xxxxxx:yyyyyy@sip.state.iinet.net.au:5060

[iiNet-out]
host=zzz.zzz.zzz.zzz
fromdomain=iinetphone.iinet.net.au
fromuser=0390xxxxxx
username=0390xxxxxx
defaultuser=0390xxxxxx
context=inbound
disallow=all
allow=g729
allow=ulaw
allow=alaw
insecure=port,invite
canreinvite=no
secret=yyyyyyy
type=friend
nat=yes
qualify=yes

extensions.conf
[default]
include => inbound
include => outbound-local

[outbound-local]
exten => _00XXXXXXXXX,1,Dial(iiNet-out/${EXTEN:1})

[inbound]
exten => 0390xxxxxx,1,Dial(SIP/101)

Details for configuring Asterisk – versions 1.0.9 and prior

Ensure your outbound Caller ID is set to your iiNetPhone Number.

Asterisk SIP Settings
[TrunkName]
type=friend
disallow=all
allow=g729
allow=ulaw
allow=alaw
host=IP Address of your state SIP server
username=iiNetPhoneNumber
fromuser=iiNetPhoneNumber
secret=passwordhere
fromdomain=iinetphone.iinet.net.au
context=sip-in
canreinvite=no
nat=yes
qualify=yes
insecure=very

Note:' IP Address of your state SIP server' is the ip address in dotted notation. Asterisk does not currently operate with iiNet if you use a host name here. A side effect is you will get the 'number disconnected message' when you dial a known good number if you use a name and not a dotted address.

Note:' If you are going to use music on hold or voicemail and do not want to purchase a license for G729 from Digium, then comment out the g729 line like this ;allow=g729. Asterisk will then use G711 (ulaw or alaw). iiNet allows G711 see here:
[http://www.iinet.net.au/support/voip/guide/voip_settings.html]
If you don't do this then Asterisk will complain that it cannot find the codec for G729. You can install G729 codec for Asterisk but it requires a license.

Note:'Asterisk@Home users' place these settings in your Outgoing Settings
and leave the entire Incoming Settings section blank.

Example register string
This is placed within the [general] section of your sip.conf file.

register => iiNetPhoneNumber@iinetphone.iinet.net.au:password:iiNetPhoneNumber@TrunkName/iiNetPhoneNumber

<i>Note: your user name is the combination of the iiNetPhone number and your phone number seperated by the first @. You iinet phone number will appear twice in the string before the 'official' @ of the asterisk registration. For Example:

0229111111@iinetphone.iinet.net.au:6xhdgdgs:0229111111@iinettrunk/0229111111</i>

Example extensions.conf entry
[sip-in]
exten => 0229111111,1,Dial(SIP/internal extension (fxs))

[local-out]
exten => _X.,1,Dial(SIP/${EXTEN}@TrunkName,60,t)
exten => _X.,2,Congestion
exten => _X.,102,Hangup

In the register string example, the extension addition tells Asterisk to map this to our internal extension which is dialed in the above extensions.conf example.

Links:
Asterisk website
Asterisk@Home
Trixbox – New Name and Version of Asterisk@Home
Bens Guide for Trixbox
BenS Asterisk@Home User Guide
Forum post that helped

Alternative Asterisk SIP Settings

Firewall issue:
If you're having firewall issue, you can limit the ports being used.

in the rtp.conf file, change:
rtpstart=30000
rtpend=31000

Another option here is try expand this from 30000-40000 also don't forget to edit your firewall settings to expand the range of UDP ports to 40000 (Worked for Jeffa using Trixbox 2.0)

Then finally on my router (Linksys WRT54G) I added the following forward of ports to the asterisk server:
UDP 30000 to 31000
TCP/UDP 5060

Registration expiry period

IINet enforce a 3600 second registration expiry period for users not behind NAT, and a 30 second expiry period when behind NAT.
They determine if you are behind a NAT by looking for a difference in the IP addresses used in the sip Contact/Via headers, and the source address the UDP packets are received from.

If the sip.conf, externhost setting is set to your external address, IINet will think that you are not behind a NAT and give you a 3600 second registration expiry period.
For this reason it is recommended that externhost settings not be used.

Config for Asterisk@home and Trixbox

Outgoing Settings

Trunk Name : iinetout

PEER Details:
allow=alaw&ulaw
canreinvite=no
context=ext-did
disallow=all
fromdomain=iinetphone.iinet.net.au
fromuser=029029XXXX
host=IP Address of your state SIP server
insecure=very
nat=no
pedantic=no
secret="PASSWORD"
type=peer
username=029029XXX

Incoming Settings

User Context: iinet In

USER Details:
canreinvite=no
context=from-pstn
fromuser=029029XXXX
host=IP Address of your state SIP server
insecure=very
qualify=no
secret="PASSWORD"
type=user
username=029029XXXX

Registration
Register String:
:PASSWORD:029029XXXX@iinetout/029029XXXX

029029XXXX=Your iinetphone number

IMPORTANT:
IN THE SETUP SECTION OF A@H/TRIXBOX CLICK ON “DID Routes”. CREATE AN ENTRY FOR YOUR IINETPHONE NUMBER:

DID Number: 029029xxxx

Set Destination (click on any of the buttons below)

Config for trixbox 2.8.0

Note these may work on earlier versions of trixbox/AsteriskNOW

Outgoing Settings

Trunk Name : iinetout

PEER Details:
canreinvite=no
context=from-trunk
fromdomain=iinetphone.iinet.net.au
insecure=very
nat=no;leave this as no even if behind a nat – it will force the re-register every 30 secs, rather than 3600.
pedantic=no
type=friend
qualify=no

Incoming Settings

User Context: 0292029XXXX

USER Details:
type=user
context=from-pstn

Registration
Register String:
:PASSWORD:029029XXXX@iinetout/029029XXXX

029029XXXX=Your iinetphone number

IMPORTANT:
IN THE SETUP SECTION OF TRIXBOX CLICK ON “DID Routes”. CREATE AN ENTRY FOR YOUR IINETPHONE NUMBER:

Config for trixbox 2.8.0 These settings also work for FreePBX

Trunk Name:

iinetout

PEER Details

username=039xxxxxxx
type=friend
secret=XXXXXXX
pedantic=no
nat=yes
insecure=very
host=sip.vic.iinet.net.au <----change to your state
fromuser=039xxxxxxx
fromdomain=iinetphone.iinet.net.au
disallow=all
context=from-pstn
canreinvite=no
allow=ulaw&alaw

USER Context: 039xxxxxxx

USER Details

canreinvite=no
context=from-trunk
fromuser=039xxxxxxx
host=sip.vic.iinet.net.au <----change to your state
insecure=very
qualify=no
secret=xxxxxx
type=user
username=039xxxxxxx

Register String

:xxxxxxx:039xxxxxxx@iinetout/039xxxxxxx

return to iiNetPhone