When working with VOIP, it’s helpful to have Asterisk server on the development machine. Asterisk server is Digium’s software implementation of PBX (private branching exchange), which provides features like voice calls, video and voice conferencing, and messaging. This blog entry details how to set up and apply basic configuration to an Asterisk on an Ubuntu virtual machine.
Step 1: Install VirtualBox on your machine.
VirtualBox is a free virtualization product from Oracle. After installing VirtualBox, start the app and click “New” to create a new virtual machine. Enter name for your new virtual machine. I used “ubuntu” here. The Type and Version are then automatically selected. Adjust to what matches your setting.
You can adjust the memory size. I just used the defualt memory size: 512 MB
Select “Dynamically allocated”. It’s easier to configure but not as fast as the “fixed size” hard drive.
Adjust the virtual machine name if desired, as well as the hard disk size. Be mindful of the disk space available on the host machine. Then click “Create” to start creating the virtual machine.
Then power up the new machine by clicking the power button.
Upon power up, you will be prompted to enter a disk or a iso file. Browse to the Ubunto ISO file (can be obtained from Ubuntu download site). The user created during installation has the root privilege, so be sure to write down the password.
After installing, you can turn on the virtual machine. This is what my Ubuntu 14 virtual machine looks like in VirtualBox
Step 2: Build Asterisk and its depended libraries
To install prerequisite: Install the following packages
- libxml2-dev
- libncurses-dev
- build
- build-essential
- linux-headers-`uname -r`
- openssh-server
- libssl-dev
- libxml2-dev
- libnewt-dev
- sqlite3
- libsqlite3-dev
- pkg-config
- automake
- libtool
- autoconf
- git
- subversion
- uuid
- uuid-dev
At the commandline, use apt-get to install:
sudo apt-get update && sudo apt-get upgrade -y sudo apt-get install -y build-essential linux-headers-`uname -r` openssh-server libssl-dev libxml2-dev libnewt-dev sqlite3 libsqlite3-dev pkg-config automake libtool autoconf git subversion uuid uuid-dev
Then download the source tar ball for dahdi, libpri, and asterisk
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete-current/dahdi-linux-complete-current.tar.gz wget http://dowloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz
To build and install dahdi
tar xvfz dahdi-linux-complete-current.tar.gz cd dahdi-linux-complete- make all sudo make install make config
To build and install libpri
tar xvfz libpri-1.4-current.tar.gz cd libpri-1.4.15 make sudo make install
To build Asterisk
./configure contrib/scripts/get_mp3_source.sh make menuselect (select modules you wished to include) make sudo make install sudo make config sudo make samples (to make sample configurations)
Note, if you would like to enable IAX, make sure the channel driver for  IAX is selected during “make menuselect” step:
Step 3: Create Asterisk User and Run Asterisk with default setting
Then create asterisk user
sudo adduser asterisk --disabled-password --no-create-home --gecos "Asterisk User" sudo chown asterisk. /var/run/asterisk sudo chown -R asterisk. /etc/asterisk sudo chown -R asterisk. /var/{/lib,log,spool}/asterisk sudo chown -R asterisk. /usr/lib/asterisk
Start asterisk server
sudo service asterisk start
Then test connecting to asterisk
sudo asterisk -rvvvvvv
If it connects successfully, you should see the asterisk commandline prompt
In Set up Asterisk Server on Ubuntu VM in VirtualBox to test Linphone : Part 2Â , I will show you how to configure asterisk to accept connection from linphone.