Running Askozia PBX on OSX with Sun’s VirtualBox

Here’s some instructions on how to get Askozia PBX running on a virtual machine with VirtualBox on OSX.

1)  If you haven’t already, download and install VirtualBox.

2) Download the Askozia disk image that you want to use. I’m using the latest Linux port release at the time of writing (r1161)

3) Uncompress the image, and then convert it to a Virtual Disk Image

gzcat askozia-pbx-generic-pc-x86-i486-uclibc-r1161.img > test.img
VBoxManage convertdd test.img test.vdi --variant Fixed

4) Load up VirtualBox and create a new virtual machine. Use whatever name you want, and select “Other” as the operating system. Allocate some memory (I used 256MB), and then choose the virtual hard disk that you created in the previous step as the boot hard disk (primary master). Click Finish.

5) Select your new virtual machine and go to Settings > Network. Specify Intel Pro/1000 MT Desktop, Bridged Adapter, and then en0: Ethernet in the three drop down boxes. Click OK to save. This will join the virtual machine to the same network as your host machine is on. We have DHCP configured on our network, so the virtual machine should pick up an IP address from that.

6) Start your virtual machine.

Once the virtual machine has loaded it should tell you what IP address it has been assigned at the terminal. You can then access the control panel from a web browser by going to that IP address using admin/askozia as the login details.

Learning Fonica PABX and FreePBX

I’ve been testing out a few free PBX distributions, and the most recent one I’ve tried is called Fonica PABX. It’s basically a bundle of Centos, Asterisk, FreePBX, and some other asterisk modules that are wrapped together with a nice installer system.

Step 1 – Install Fonica PABX

  • Download the latest ISO and burn it to a CD
  • Follow the instructions on the Fonica PABX wiki.
  • Make sure you change all the default passwords as described in the instructions, otherwise your box will be open to the world.

Step 2 – Set up some extensions with FreePBX

  • Browse to FreePBX > Basic > Extensions
  • Add a generic sip device, specifying the user extension (e.g. 0001) and a secret (password)
  • You may also wish to enable call recording, and voice mail – if so, specify a voicemail pin.

Step 3 – Configure FreePBX to allow Inbound and Outbound calls

In this example we are going to set up a trunk to Magrathea Telecom to allow inbound / outbound calls via IAX2.

  • Browse to FreePBX > Basic > Trunks
  • Add an IAX2 Trunk.
  • For the outgoing settings, give the trunk a name such as “magrathea-out”, then specify the hostname (iax3.magrathea-telecom.co.uk) and your username / password. Magrathea or your VOIP service provide will have given you these details.
  • For the incoming settings, the user context (username) and secret (password) are the authentication details that the VOIP provider will use when connecting to you. In Magrathea’s case we can set these to anything we want, we then notify magrathea of them through an API call. E.g. username:password@pabx-hostname.net

After the trunk is setup, you must define both an outbound and inbound route. For the outbound route:

  • Browse to FreePBX > Basic > Outbound Routes
  • Give the route a name, e.g. default
  • Specify the dialplan pattern, e.g. XXXXXXXXXXX would match any 11 digit number
  • Specify the outgoing trunk to use e.g. magrathea-out (or the name you used when setting it up).

For the inbound route:

  • Browse to FreePBX > Inbound Call Control > Inbound Routes
  • Give the route a description (e.g. default) and a destination (e.g. an extension, voicemail, queue or ring group). You can leave the DID number blank if you want this to be a default route, but fill it out  if you want to match a specific number. Magrathea send the DID numbers in the full international format, e.g. 448448160054.

Step 4 – Install additional FreePBX modules such as Queues and Ring Groups

  • Browse to FreePBX > Admin > Module Admin
  • Click “check for updates online”
  • You should then see a list of modules. Click on the modules you would like to install, and then select the “download and install” action.
  • Once you’ve chosen all the modules you want, click the “process” button in the bottom right hand corner of the page.

Other things I plan to do:

  • Set up queues and / or ring groups with their own voicemail (how can queue members access it?)
  • Set up a phone directory to
    • Automatically look up known caller ID from a database, and append to CID on inbound calls.
    • Allow directory lookup from Snom phone itself.
  • Get auto-provisioning working, to automatically assign extensions to our snoms.
  • Work out how to set up patterns for inbound calls, so that 0844 816 XXXX goes to extension XXXX.
  • Port our existing geographic numbers from BT to Magrathea and assign to extensions.
  • Set up system to fall back to analogue lines if VOIP not working, and also to route 999 / operator calls out over PSTN.
  • Is it secure to allow “anonymous inbound sip calls” from the FreePBX > Basic > General Settings menu?

Trixbox blue screen after probing video card

I was experiencing an error during an installation of Trixbox 2.6.2.2 whereby it would lock up with a blue screen after the keyboard language selection / probing video card steps. Initially I thought it was a faulty CD, but after burning 3 copies with 2 computers, I would get the same problem every time.

This thread had some more info, but in the end I fixed it by disabling the machines secondary hard drive.

Asterisk – Outgoing calls rejected because extension not found

I had been having problems making external calls from my asterisk box. When I initially set it up, I used the asterisk-gui to setup a service provider for outgoing calls. This automatically appended the following context to extensions.conf

[numberplan-custom-1]
plancomment = Default DialPlan
include = default
include = parkedcalls
exten = _0XXXXX!,1,Macro(trunkdial,${trunk_1}/${EXTEN:0},${trunk_1_cid})
comment = _0XXXXX!,1,test,standard

However, since the default context for users is default, and the [default] context did not include this custom context, the calls weren’t being routed. This was giving the following error:

Call from '6000' to extension '08448160000' rejected because extension not found.

The simple way to fix it was to include the custom [numberplan-custom-1] context within the default context:

[default]
;
; By default we include the demo.  In a production system, you 
; probably don't want to have the demo there.
;
include => demo
include => numberplan-custom-1
exten => 1571,1,VoiceMailMain

Asterisk – Rejected incoming IAX connection

I was having trouble getting an inbound IAX connection to connect successfully to test my asterisk box. The asterisk console was showing the following error:

 Rejected connect attempt from 213.166.5.129, who was trying to reach '448448160404@'

After some hacking around it turns out that the username in the IAX address must match the [header] name in iax.conf, even though you specify the username separately.

E.g. if your iax address is something like IAX2/xxxx:password@domain.com then your iax.conf defintion will need to be:

[xxxx]
type=user
context=inboundmagrathea
username=xxxx
secret=password

I also added the inboundmagrathea context to extensions.conf

[inboundmagrathea]
exten => 448448160404,1,Dial(SIP/6000)
exten => 448448160404,2,Hangup

Learning Asterisk

In preparation for the launch of a new Fubra VOIP service later this year, I decided that it would be wise if I knew a little more about asterisk (our chosen PBX software). Although I’m not building the underlying phone system (we have an asterisk expert working on that), nor the user control panel (our in-house developers will be doing that), I think it’s always helpful as a director of a technology company to have a fairly in-depth knowledge of your systems.

So over the next few weeks I will be installing an asterisk PBX at my house, and setting it up to make and receive calls via VOIP to the PSTN and beyond.

We’ve been using asterisk in our office to power our phone system since 2005, and so I’ve gotten pretty good at configuring Snom phones and other sip devices, but this is the first time I will have actually tried to setup an asterisk box from scratch.

Setting up asterisk-gui on Ubuntu

Tonight I had a go at installing Digium’s asterisk-gui. I followed some instructions from Asterisk Guru, but then had to apply a fix at the end because the static-http folder was in the wrong place.

Installation Instructions

Download the asterisk-gui source code from SVN:

mkdir -p ~/downloads/asterisk-gui
cd ~/downloads/asterisk-gui
svn checkout http://svn.digium.com/svn/asterisk-gui/trunk .

Compile the source code:

./configure
./make
./make install

Backup your asterisk config:

cp -r /etc/asterisk /etc/asterisk.backup

Install the sample settings if you wish (this adds things like a list of VOIP providers to use as a PSTN gateway).

./make samples

Edit /etc/asterisk/manager.conf to enable the web management interface and to add a user:

enabled = yes
webenabled = yes
[administrator]
secret = YoUrPaSwOrD
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config

Edit /etc/asterisk/http.conf to enable asterisk’s mini webserver. If you are accessing from your local machine use 127.0.0.1 otherwise you might want to bind to a public ip, but be aware this is less secure.

enabled=yes
enablestatic=yes
bindaddr=127.0.0.1

Run make checkconfig to verify your configuration settings:

./make checkconfig

I then had to do an additional step to link the static http scripts folder to inside /usr/share/asterisk as it seems asterisk was looking in here instead of /var/lib/asterisk/

sudo ln -s /var/lib/asterisk/static-http/ /usr/share/asterisk/

After that you should be able to login to the control panel at http://127.0.0.1:8088/asterisk/static/config/cfgbasic.html (replacing the IP address with whichever one you chose).

Missing asterisk config files in Ubuntu / Debian

If you install Asterisk on Ubuntu via apt-get, and then remove it and re-install again, you may find that you are missing the all the config files in /etc/asterisk.

This is a bug in the debian asterisk package that means that the config files are deleted when you remove the asterisk package even though they are part of the asterisk-config package.

To fix it simply run the following commands: (NB: This will nuke any asterisk installation you have)

sudo dpkg --purge asterisk
sudo dpkg --purge asterisk-config
sudo apt-get install asterisk-config
sudo apt-get install asterisk