Asterisk for Raspberry Pi on Raspbian

From KlavoWiki
Jump to navigationJump to search

If you don't want to follow these instructions and would prefer to download an image you can do so by downloading the image from Asterisk for Raspberry Pi Image.

The following instructions are based on Raspbian (2013-12-20-wheezy-raspbian.zip)

Write Image to SD Card

Using Win32DiskImager and the latest version of Raspbian from Raspberry Pi write the image to the SD card.

Once the image is written insert the SD card into the Raspberry Pi and boot. The device will get an IP address from DHCP.

Update and Configure the OS

Log into the operating system with the default username and password.

Username : pi
Password : raspberry

Run raspi-config and configure all requires settings.

sudo raspi-config

If you have not already done so from raspi-config update the operating system by running:

sudo apt-get update
sudo apt-get upgrade

Set required IP Address

Static_IP_Address_for_Raspbian

Create ll alias

Add the following line

alias ll="ls -la --color --group-directories-first"

to the file /home/pi/.profile

reboot

sudo reboot

Install Utilities and Prerequisites

The following packages are for Asterisk dependencies and utilities to mange the operating system and packages.

sudo apt-get install vim mlocate zip unzip gcc make hgsvn libssl-dev \
libtiff4-dev libsqlite3-dev subversion mysql-server libmysqlclient-dev \
libmysqlclient18 libnewt-dev libuuid1 libxslt1-dev liburiparser1 \
libncurses5-dev libjansson-dev libspeex-dev libspandsp-dev libjansson4 \
uuid-dev libxml2 mime-construct sendmail

Asterisk

cd /usr/src
sudo wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-12-current.tar.gz
sudo tar xvf asterisk-12-current.tar.gz
cd asterisk-12......

sudo ./contrib/scripts/get_mp3_source.sh
sudo ./configure
sudo make menuselect

sudo make
sudo make install
sudo make samples
sudo make config

sudo ldconfig


logrotate

sudo vi /etc/logrotate.d/asterisk

add the following lines to the file

/var/log/asterisk/messages /var/log/asterisk/*log {
   missingok
   notifempty
   rotate 12
   weekly
   create 0640 root root
   postrotate
       /usr/sbin/asterisk -rx 'logger reload' > /dev/null 2> /dev/null
   endscript
}

logger

sudo vi /etc/asterisk/logger.conf

change from:

;dateformat=%F %T

to

dateformat=%F %T %Z

Verbosity

sudo vi /etc/asterisk/asterisk.conf

change

;verbose = 3

to

verbose = 3

CDR

Send all CDR records to a MySQL database. Review the CDR page.

Fax2Mail

Create a default email address for fax delivery

sudo vi /usr/sbin/fax2mail

On line 99 make the required change

DEFAULTTO="myemail@mydomain.com"

Apache Install

sudo apt-get install apache2 php5 libapache2-mod-php5 php5-gd php5-mysql
sudo service apache2 restart