SME 8.0 + Asterisk 1.8 + SAIL 3.1.1

From sailpbx
Jump to: navigation, search

Download ISO

The combined SME 8 / Asterisk 1.8.0.7 / SAIL 3.1.1-16 ISO is available for download at:

http://sailpbx.com/iso/SME8FA18V311-16.iso

Install normally as outlined in the Wiki. A normal whitebox generic i386 (32 bit) install is envisaged here.

Update SME

yum update

This will break DAHDI and possibly Asterisk as the kernel will get updated. Not to worry. Operations in the following sections will fix it.

Update Asterisk 1.8

Whilst the ISO installs Asterisk v1.8.0.7 available in the Asterisk Current Repo, the Asterisk 1.8 repo has a later set of rpms that can be used to update the installation. The update will result in a few rpmnew files being created - study them and prudently make changes in the template fragments without overwriting SAIL required includes.

Update DAHDI

The ISO installs DAHDI from the Digium Current Repo. The DAHDI 1.8 repo has only a few rpms that are later in build. It is essential to get DAHDI and kmod drivers installed for the current kernel after SME 8 update.

Update SAIL

The ISO installs SAIL v3.1.1-16. The latest version in this series is v3.1.1-20. The SAIL installation can be upgraded with:

cd /usr/src
wget http://sailpbx.com/sail/sail-3.1/sail-3.1.1-20.noarch.rpm
rpm -Uvh sail-3.1.1-20.noarch.rpm

List of unused files in SAIL

  • /opt/sark/db/DBSQL
  • /opt/sark/db/lineIOdump
  • /opt/sark/db/startDBSQL

List of files not used for generic SAIL

DB Upgrade Logic

  • SAIL uses a clean SQLite3 database - /opt/sark/db/sarkstart.db - to start with.
  • During an install or upgrade, the installer looks to see if /opt/sark/db/sark.db exists.
  • If it does not exist, then it copies /opt/sark/db/sarkstart.db to /opt/sark/db/sark.db.
  • Whether install or upgrade, a script is run that applies all of the sql fragments in /opt/sark/amacs folder in name sequence. The name is made up of a letter plus the svn commit number, so it's effectively applied in ascending time order (datetime, then revision number).
  • NULL and blank / empty values are treated one and the same. Only if a field returns true, it's value is taken. Some SQLite3 export and then import returns NULL for blank values that must be taken into account when performing arithmetic and / or comparison operations on unwrapped / cast values.

Note from the SARK Devs

There is redundancy in the fragments but by and large it does not matter. The process relies on the natural entity integrity of the database for its idempotency. In other words pretty much everything it does is additive so a re-run will simply cause a lot of harmless errors because the row(s) will already exist. It's not pretty but it's not bad and in theory it allows upgrade over any jump in release although it can't categorically rule out any corner cases.

Preferred sark.db for new installs

On testing it was found that a few sql statements get skipped when an earlier one fails. Hence to obviate such occurrences in new installs, it is advisable (take a leap of faith in Ap.Muthu's sarknew.db file) to follow the code here before any SAIL configuration is done:

service sark stop
mv /opt/sark/db/sark.db /opt/sark/db/sark.db.bak 
mv /opt/sark/db/sarkstart.db /opt/sark/db/sarkstart.db.bak 
wget http://www.apmuthu.com/bugfixes/sarknew311.db -O /opt/sark/db/sarkstart.db
chown www:www /opt/sark/db/sarkstart.db
cp /opt/sark/db/sarkstart.db /opt/sark/db/sark.db
service sark start

If all goes well, then remove the *.bak files with:

rm -rf /opt/sark/db/sarkstart.db.bak 
rm -rf /opt/sark/db/sark.db.bak 

If something went wrong, then revert back with:

service sark stop
rm -rf /opt/sark/db/sark.db
mv /opt/sark/db/sark.db.bak /opt/sark/db/sark.db
rm -rf /opt/sark/db/sarkstart.db
mv /opt/sark/db/sarkstart.db.bak /opt/sark/db/sarkstart.db 
service sark start

Unreleased fixes

A list of forum postings of interest to the avid SAIL developer / consultant is available here.

SAIL Reference File Locations

  • SAIL Install Date: /opt/sark/db/.sail-install-date
  • SAIL Version: /opt/sark/.sail-release
  • Asterisk Version: /opt/sark/.astrelease
  • SAIL Serial Number is used for SARK Customers is hardcoded in globals['SNO']
  • SAIL Serial Number for others is a random number computed in line 297 of /opt/sark/www/cgi-bin/sarkglobals.pl and stored in globals['SNO']
$sno = ($global{'SNO'}) || int(rand(1000000));

Resources