Asterisk (series1.6) Deployment for Concentration

by quinnebert
6 deployments · 0 still active · last rev. 5 years ago

A stackscript designed for deploying an Asterisk 1.6 node, designed to use Kamailio as a concentrator, and for failover control.

Compatible with: No distros currently supported
						#!/bin/bash
# <UDF name="db_password" Label="MySQL root Password" example="Used for SIP authorization process" />
# <UDF name="kamas_ip" Label="Kamailio's IP" example="The IP of the Kamailio node that hosts MySQL for SIP Authentication" />

# Import the Linode standard StackScript Library
source <ssinclude StackScriptID="1">

# Bring The System Up-to-date
system_update

# Ensure APT package list is up-to-date 
apt-get -y update

# Ensure OpenSSH Service is installed...
apt-get -y install openssh-server

# Install bulk of packages we need...
apt-get -y install make automake autoconf libtool pkg-config gcc g++ doxygen libxml2-dev libncurses5-dev unixodbc-dev libltdl3-dev libmyodbc

# Setup ODBC System for Asterisk:
#for /etc/odbcinst.ini
echo "[MySQL]
Description = MySQL driver
Driver = /usr/lib/odbc/libmyodbc.so
Setup = /usr/lib/odbc/libodbcmyS.so
CPTimeout =
CPReuse =
UsageCount = 1" > /etc/odbcinst.ini
#for /etc/odbc.ini
echo "[MySQL-asterisk]
Description = MySQL Asterisk database
Trace = Off
TraceFile = stderr
Driver = MySQL
SERVER = $KAMAS_IP
USER = asterisk
PASSWORD = $DB_PASSWORD
PORT = 3306
DATABASE = asterisk" > /etc/odbc.ini

# less pager, wget, and vim editor
goodstuff

# cleanup after stackscripts
restartServices

## 
## INSTALL ASTERISK
## 
# WARNING: This section is still incomplete!
cd /usr/local/src
wget 'http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.6.2.7.tar.gz'
tar xvfz asterisk-1.6.2.7.tar.gz
cd asterisk-1.6.2.7
./configure
make && make install && make samples && make progdocs

echo "DEBUG: Let's slim down Asterisk now..."
echo "; 
; NoLoads from StackScript
; 
noload => app_adsiprog.so
noload => app_alarmreceiver.so
noload => app_amd.so
noload => app_confbridge.so
noload => app_controlplayback.so
noload => app_dictate.so
noload => app_directed_pickup.so
noload => app_directory.so
noload => app_disa.so
noload => app_dumpchan.so
noload => app_externalivr.so
noload => app_festival.so
noload => app_followme.so
noload => app_ices.so
noload => app_image.so
noload => app_milliwatt.so
noload => app_minivm.so
noload => app_mixmonitor.so
noload => app_morsecode.so
noload => app_mp3.so
noload => app_nbscat.so
noload => app_parkandannounce.so
noload => app_privacy.so
noload => app_queue.so
noload => app_readexten.so
noload => app_record.so
noload => app_sayunixtime.so
noload => app_sendtext.so
noload => app_sms.so
noload => app_speech_utils.so
noload => app_url.so
noload => app_voicemail.so
noload => chan_agent.so
noload => chan_bridge.so
noload => chan_local.so
noload => chan_mgcp.so
noload => chan_phone.so
noload => chan_skinny.so
noload => chan_unistim.so
noload => func_audiohookinherit.so
noload => func_blacklist.so
noload => func_devstate.so
noload => func_extstate.so
noload => func_uri.so
noload => func_vmcount.so
noload => func_volume.so
noload => pbx_ael.so
noload => res_adsi.so
noload => res_monitor.so
noload => res_musiconhold.so
noload => res_phoneprov.so
noload => res_realtime.so
noload => res_ael_share.so
noload => res_smdi.so" >> /etc/asterisk/modules.conf

# Implant the Asterisk config bits...
#for res_odbc.conf
echo "[asterisk]
enabled => yes
dsn => MySQL-asterisk
username => asterisk
password => $DB_PASSWORD
pre-connect => yes" >> /etc/asterisk/res_odbc.conf
#for extconfig.conf
echo "sipusers => odbc,asterisk,sipusers
sippeers => odbc,asterisk,sipusers
sipregs => odbc,asterisk,sipregs
voicemail => odbc,asterisk,voiceboxes" >> /etc/asterisk/extconfig.conf

echo -n 'Starting Asterisk...'
/usr/sbin/asterisk
echo 'Done!'

#               #
# ALL DONE HERE #
#               #