VoIP Phones - FreePBX - chan sip

From AAISP Support Site

Freepbx logo.png

FreePBX is based on Asterisk - you may wish to read this page for more background information.

These instructions were last tested on FreePBX 2.11.0.23.

Setting up your A&A trunk

Configuration in FreePBX Web UI

Log into your FreePBX administration interface and go to Connectivity, Trunks - then select Add SIP Trunk.

Fill out the fields as below:

General Settings

  • Trunk Name: A descriptive name for the trunk - enter whatever you wish.
  • Outbound CallerID: The caller ID you will use for calls made on this trunk. I entered my phone number in the format: 01234567890.
  • CID Options: Set this as you prefer. I left it set to "Allow Any CID".
  • Maximum Channels: Leave this blank.
  • Asterisk Trunk Dial Options: Leave this blank and make sure "Override" isn't ticked.
  • Continue if Busy: Set this as you prefer.
  • Disable Trunk: Make sure "Disable" is not ticked.

Dialed Number Manipulation Rules

I left this entire section alone.

Outgoing Settings

These are your outgoing call settings - for calls you make from your phone through voiceless. These settings can be found under the "SIP Phone" heading in clueless for your number.

Trunk Name: out-01234567890

PEER Details:

host=voiceless.aa.net.uk
username=+441234567890
secret=YOUR-OUTGOING-PASSWORD-HERE
type=peer
insecure=invite

Incoming Settings

These are your incoming call settings - for calls you receive from voiceless. These settings can be found under the "To your server via SIP" heading in clueless for your number.

My settings in clueless look like the following:

Clueless to your server settings.png

In FreePBX, I entered the following:

USER Context: in-01234567890

USER Details:

secret=YOUR-INCOMING-PASSWORD-HERE
type=peer
context=from-trunk
insecure=invite

Registration

If your FreePBX is behind a NAT you may need to enter a registration string here.

If you FreePBX is not behind a NAT, you should not use registration if possible.

More details can be found on the VoIP Phones - Asterisk article.

Fix for incoming calls

After using the above for a while, you may well find that your incoming calls randomly stop working - this is because they are being rejected by Asterisk as it does not recognise the incoming calls properly.

This can be fixed by manually adding some fixes to /etc/asterisk/sip_custom_post.conf:

; IPv4 voiceless addresses for 01234567890
[in-01234567890-a4](in-01234567890)
host=a4.voiceless.aa.net.uk
[in-01234567890-b4](in-01234567890)
host=b4.voiceless.aa.net.uk
[in-01234567890-c4](in-01234567890)
host=c4.voiceless.aa.net.uk
[in-01234567890-d4](in-01234567890)
host=d4.voiceless.aa.net.uk
[in-01234567890-e4](in-01234567890)
host=e4.voiceless.aa.net.uk
[in-01234567890-f4](in-01234567890)
host=f4.voiceless.aa.net.uk
[in-01234567890-g4](in-01234567890)
host=g4.voiceless.aa.net.uk
[in-01234567890-h4](in-01234567890)
host=h4.voiceless.aa.net.uk
[in-01234567890-i4](in-01234567890)
host=i4.voiceless.aa.net.uk
[in-01234567890-j4](in-01234567890)
host=j4.voiceless.aa.net.uk

; [[IPv6]] voiceless addresses for 01234567890
[in-01234567890-a6](in-01234567890)
host=a6.voiceless.aa.net.uk
[in-01234567890-b6](in-01234567890)
host=b6.voiceless.aa.net.uk
[in-01234567890-c6](in-01234567890)
host=c6.voiceless.aa.net.uk
[in-01234567890-d6](in-01234567890)
host=d6.voiceless.aa.net.uk
[in-01234567890-e6](in-01234567890)
host=e6.voiceless.aa.net.uk
[in-01234567890-f6](in-01234567890)
host=f6.voiceless.aa.net.uk
[in-01234567890-g6](in-01234567890)
host=g6.voiceless.aa.net.uk
[in-01234567890-h6](in-01234567890)
host=h6.voiceless.aa.net.uk
[in-01234567890-i6](in-01234567890)
host=i6.voiceless.aa.net.uk
[in-01234567890-j6](in-01234567890)
host=j6.voiceless.aa.net.uk

This seems to keep incoming calls working OK.

You will need to force Asterisk to reload the configuration files for this to take effect - this can be done by restarting Asterisk or by running asterisk -rx 'reload'.

If you are using the test voiceless server for any reason, you will also need to add those addresses to your /etc/asterisk/sip_custom_post.conf:

; voiceless test server addresses for 01234567890
[in-01234567890-z4](in-01234567890)
host=z4.voiceless.aa.net.uk
[in-01234567890-z6](in-01234567890)
host=z6.voiceless.aa.net.uk

Making IPv6 work

You may notice that out of the box your FreePBX install will not talk IPv6. This is because by default it configures Asterisk to only listen on IPv4.

This can be fixed!

  1. Log into the FreePBX administration UI.
  2. Go to Settings, Asterisk SIP Settings.
  3. Scroll down to Advanced General Settings.
  4. Change Bind Address to an IPv6 Address. :: can be used for binding to all available IPv6 and IPv4 addresses.
  5. Scroll to the bottom and click Submit Changes.

Setting your audio settings

For best results, your FreePBX install should be set up to use only alaw audio.

To set this up, do the following:

  1. Log into the FreePBX administration UI.
  2. Go to Settings, Asterisk SIP Settings.
  3. Scroll to Audio Codecs.
  4. In the list of codecs, untick every codec except alaw.
  5. Scroll to the bottom and click Submit Changes.

Firewall & Security

  • You will also want to set up firewall rules, as per the VoIP Firewall page.
  • Also see the VoIP Security page for information about securing your VoIP service.