SAIL FAQs

From sailpbx
Revision as of 17:49, 17 March 2013 by Apmutha (talk | contribs) (Common to SAIL versions v3.1.1 and v4.0.0)
Jump to: navigation, search

Introduction

  • As of Feb 2013, SAIL v3.1.1 is considered stable and v4.0.0 is in development.
  • SAIL v3.2.0 has been discontinued and users can either downgrade to v3.1.1 Stable or upgrade to v4.0.0 Testing.
  • All appliance configuration resides in a single file - a SQLite v3.0 database - /opt/sark/db/sark.db - use the FireFox Addon SQLite Manager to manipulate it directly and with care.
  • Upstream version changes and updates to CentOS 5, SME8, Asterisk 1.8 and Digium 1.8 and feature enhancements and maintenance to SAIL are sought to be listed in this FAQ article so as to benefit the building of generic white box SAIL appliances.
  • This FAQ will in most part apply to all versions of Asterisk / DAHDI but has been tested and specific to Asterisk v1.8.
  • sark.db table and field names in particular as and when they are introduced / changed are explained here
  • AsteriskNOW v2.0.0 rpm is used in SAIL for the MySQL cdr and reporting scripts.
  • Base versions taken are v3.1.1-22 and v4.0.0-43.

Common to SAIL versions v3.1.1 and v4.0.0

  • smesailenv* should be installed first before SAIL or along with it rpm -Uvh sail... smesailenv...
  • Vanilla CentOS installs are no longer supported in versions of SAIL later than 3.1.0.
  • When installing Asterisk from sources, all dependencies must be manually satisfied and the SAIL rpms will have to be installed with the --nodeps switch - Forum Post.
  • Doing a yum update will upgrade the kernel and may upgrade the CentOS minor build, breaking the DAHDI drivers which must then be compiled and installed again. Installing / Reverting to some kernel for which DAHDI compiled drivers exist in the Digium - Current repo may be an option.
  • SAIL uses SayUnixTime (formats)inside the sarkhpe binary which has the language hardcoded as GB in it. Set the mode=new in line 6 of /etc/asterisk/say.conf to make it work and test it by dialling feature code *55* and having the current date and time read out.
  • Asterisk 1.8 now uses ulaw instead of alaw by default. The current default SAIL installs have only the alaw sounds installed. Install the ulaw sounds with:
yum --enablerepo=asterisk-current install \
   asterisk-sounds-core-en-ulaw  \
   asterisk-sounds-moh-opsound-ulaw
  • ulaw en_GB sounds
  • All the extensions that have both alaw and ulaw can be altered to push the ulaw up the list and have the GeneralSIP and other Extension templates edited accordingly. If only alaw is there then it can be replaced with or placed below a new ulaw line.
  • Current SAIL installs lack the folder /var/lib/asterisk/firmware/iax that needs to be created manually with:
mkdir -p /var/lib/asterisk/firmware/iax
chown -R asterisk:asterisk /var/lib/asterisk/firmware
  • alaw for Trunks and Carriers in Europe and ulaw for US/Japan since that is the default for codecs in ISDN connections in those countries.
  • Apply say.conf patch fixed in Forum Post:

Lines 95-97 in /etc/asterisk/say.conf:

    ; XXX too bad the '?' function does not remove the quotes
    ; _date:[pP]:. => digits/$[ ${SAY:10:2} > 12 ? "p-m" :: "a-m"] ; am pm
    _date:[pP]:. => digits/p-m ; am pm

must be replaced with:

    _date:[pP]:. => digits/$[ ${SAY:10:2}+0 > 12 ? p :: a ]-m ; am pm

SAIL v3.1.0 only

  • SAIL v3.1.0-146 and earlier an be installed in Vanilla CentOS 5. SAIL v3.1.0-145 was the last released version in that series and v3.1.0-101 (Jan 2011) was the last heard of that ran on Vanilla CentOS.
  • SAIL environment dependency for Plain Vanilla CentOS is el5sailenv and for SME Install it is smesailenv.
  • The el5sailenv is quite old and does not have menu entries for the CDRs.
  • The file /opt/sark/www/cgi-bin/sarksplash.pl is missing in SAIL v3.1.0-140 and v3.1.0-145.
  • A SAIL v3.1.0-145 to SAIL v3.1.1-22 diff file set is available here and it addresses the above two issues as well. This way, a vanilla CentOS 5 install of SAIL can be accomplished and be uptodate. It can also partake of the later sark.db as well.
  • The httpd.conf and other server config files are in /opt/sark/cache in the SAIL RPM.
  • Only last two releases in each archived version of sail will be available for distribution here. Since some files were missing and the post uninstall script was broken, a much older SAIL v3.1.0-84 (2010 vintage) may be referred to.
  • For a plain Vanilla CentOS 5 install, el5sailenv-1.0.0-5 is installed after sail-3.1.0-145 or installed together as in:

yum install sail el5sailenv

  • Uninstall of el5sailenv is done first and then sail. As there is an error in the %{postun} script in the el5sailenv rpm, the following is to be done to remove sail fully in a plain vanilla CentOS install:
rpm -e --noscripts el5sailenv
rpm -e sail

If the above is not done, the following error occurs:

# rpm -e el5sailenv
/var/tmp/rpm-tmp.18355: line 1: syntax error near unexpected token `fi'
/var/tmp/rpm-tmp.18355: line 1: `fi'
error: %postun(el5sailenv-1.0.0-5.noarch) scriptlet failed, exit status 2

The error can be traced to:

# rpm -qp --qf "%{postun}\n" el5sailenv-1.0.0-5.noarch.rpm
fi
  • The post install script of the SAIL v3.1.0-145 will do the following:
# rpm -qp --qf "%{postin}\n" sail-3.1.0-145.noarch.rpm

/bin/grep -q www /etc/passwd
if [  "$?" -ne "0" ] ; then
        /usr/sbin/useradd -s /sbin/nologin www
fi

[ ! -e /etc/asterisk/sark_customer_agents_main.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_agents_main.conf
[ ! -e /etc/asterisk/sark_customer_extensions_globals.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_extensions_globals.conf
[ ! -e /etc/asterisk/sark_customer_iax_main.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_iax_main.conf
[ ! -e /etc/asterisk/sark_customer_queues_main.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_queues_main.conf
[ ! -e /etc/asterisk/sark_customer_sip_main.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_sip_main.conf
[ ! -e /etc/asterisk/sark_customer_vmail_main.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_vmail_main.conf

[ ! -e /etc/asterisk/sark_customer_agents_header.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_agents_header.conf
[ ! -e /etc/asterisk/sark_customer_queues_header.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_queues_header.conf
[ ! -e /etc/asterisk/sark_customer_vmail_header.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_vmail_header.conf

[ ! -e /etc/asterisk/sark_customer_manager.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_manager.conf

[ ! -e /opt/sark/otrr/var/spool/asterisk/monitor ] && /bin/mkdir -p /opt/sark/otrr/var/spool/asterisk/monitor
[ ! -e /opt/sark/mixmon/var/spool/asterisk/monitor ] && /bin/mkdir -p /opt/sark/mixmon/var/spool/asterisk/monitor
[ ! -e /var/spool/asterisk/monstage ] && /bin/mkdir -p /var/spool/asterisk/monstage
[ ! -e /var/spool/asterisk/monout ] && /bin/mkdir -p /var/spool/asterisk/monout

if [ ! -e /etc/asterisk/sark_customer_iax_header.conf ]; then
        /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_iax_header.conf
        /bin/echo "language=en-gb" >> /etc/asterisk/sark_customer_iax_header.conf
fi

if [ ! -e /etc/asterisk/sark_customer_sip_header.conf ]; then
        /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_sip_header.conf
        /bin/echo "language=en-gb" >> /etc/asterisk/sark_customer_sip_header.conf
fi

/bin/grep -q asterisk /etc/group
if [  "$?" -eq "0" ] ; then
        /usr/sbin/usermod -a -G asterisk www
        /usr/sbin/usermod -a -G nobody www
fi

if [ -e /bin/chown ] ; then
        /bin/chown -R www:www           /opt/sark/www
        /bin/chown -R www:www           /opt/sark/db
        /bin/chown -R www:www           /opt/sark/passwd
        /bin/chown -R asterisk:asterisk /etc/dahdi
        /bin/chown -R asterisk:asterisk /etc/asterisk/sark*
        /bin/chown -R asterisk:asterisk /etc/asterisk/selauth.conf
        /bin/chown -R asterisk:asterisk /var/spool/asterisk/monstage
        /bin/chown -R asterisk:asterisk /var/spool/asterisk/monout
        /bin/chown -R asterisk:asterisk /opt/sark/otrr/var/spool/asterisk/monitor
        /bin/chown -R asterisk:asterisk /opt/sark/mixmon/var/spool/asterisk/monitor
fi

if [ -e /bin/chmod ] ; then
        /bin/chmod 664 -R /etc/asterisk/sark*
        /bin/chmod 664 -R /etc/asterisk/selauth.conf
        /bin/chmod 755 -R /opt/sark/www
        /bin/chmod 755 -R /opt/sark/generator
        /bin/chmod 755 -R /opt/sark/perl
        /bin/chmod 755 -R /opt/sark/scripts
        /bin/chmod 777 -R /tftpboot
fi

/bin/grep -q '#include sark_manager.conf' /etc/asterisk/manager.conf
if [  "$?" -ne "0" ] ; then
        /bin/mv -f /opt/sark/cache/manager.conf /etc/asterisk
fi

/bin/grep -q '#include sark_customer_manager.conf' /etc/asterisk/sark_manager.conf
if [  "$?" -ne "0" ] ; then
        echo "#include sark_customer_manager.conf" >> /etc/asterisk/sark_manager.conf
fi

/bin/grep -q '#include sark_sip_notify.conf' /etc/asterisk/sip_notify.conf
if [  "$?" -ne "0" ] ; then
        echo "#include sark_sip_notify.conf" >> /etc/asterisk/sip_notify.conf
fi

if [ ! -e /opt/sark/db/sark.db ] ; then
        /bin/mv -f  /opt/sark/db/sarkstart.db /opt/sark/db/sark.db
fi

/bin/sh /opt/sark/scripts/update_db.sh >/dev/null
date --iso-8601=minutes > /opt/sark/db/.sail-install-date
echo "3.1.0-145" > /opt/sark/.sail-release

SAIL v3.1.1 only

  • Undocumented web service is running on Port 7601 as seen in /opt/sark/scripts/srkhelper.pl possibly for internal use.
  • SME8/SAIL v3.1.1 URL: https://server.ip.address/sail
  • SAIL v3.1.1 cannot be installed in a plain vanilla CentOS 5.
  • A copy of the fully updated /opt/sark/db/sark.db file with no extensions or trunks is available here.
  • SAIL environment dependency for SME Install is smesailenv.
  • The httpd.conf and other server config files are in /opt/sark/cache in the SAIL RPM.
  • The removal of smesailenv would result in:
# rpm -qp --qf "%{postun}\n" smesailenv-1.0.0-30.noarch.rpm
if [ "$1" = "0" ]; then
        /sbin/e-smith/config delete sark
        /sbin/e-smith/config delete dahdi
        /sbin/e-smith/config delete tftpd
        /sbin/e-smith/config delete setlan
        /sbin/e-smith/config delete sailSIP
        /sbin/e-smith/config delete sailIAX
        /sbin/e-smith/config delete sailRTP
        /sbin/e-smith/config delete sailAMI

        /bin/rm -rf /etc/rc.d/rc7.d/S94setlan
        /bin/rm -rf /etc/rc.d/rc7.d/S95dahdi
        /bin/rm -rf /etc/rc.d/rc7.d/S95sark
        /bin/rm -rf /etc/rc.d/rc7.d/S95tftpd
fi
  • The Post install of SAIL v3.1.1-22 will do the following:
# rpm -qp --qf "%{postin}\n" sail-3.1.1-22.noarch.rpm

/bin/grep -q www /etc/passwd
if [  "$?" -ne "0" ] ; then
        /usr/sbin/useradd -s /sbin/nologin www
fi

[ ! -e /etc/asterisk/sark_customer_agents_main.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_agents_main.conf
[ ! -e /etc/asterisk/sark_customer_extensions_globals.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_extensions_globals.conf
[ ! -e /etc/asterisk/sark_customer_iax_main.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_iax_main.conf
[ ! -e /etc/asterisk/sark_customer_queues_main.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_queues_main.conf
[ ! -e /etc/asterisk/sark_customer_sip_main.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_sip_main.conf
[ ! -e /etc/asterisk/sark_customer_vmail_main.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_vmail_main.conf

[ ! -e /etc/asterisk/sark_customer_agents_header.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_agents_header.conf
[ ! -e /etc/asterisk/sark_customer_queues_header.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_queues_header.conf
[ ! -e /etc/asterisk/sark_customer_vmail_header.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_vmail_header.conf

[ ! -e /etc/asterisk/sark_customer_manager.conf ] && /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_manager.conf

[ ! -e /opt/sark/otrr/var/spool/asterisk/monitor ] && /bin/mkdir -p /opt/sark/otrr/var/spool/asterisk/monitor
[ ! -e /opt/sark/mixmon/var/spool/asterisk/monitor ] && /bin/mkdir -p /opt/sark/mixmon/var/spool/asterisk/monitor
[ ! -e /var/spool/asterisk/monstage ] && /bin/mkdir -p /var/spool/asterisk/monstage
[ ! -e /var/spool/asterisk/monout ] && /bin/mkdir -p /var/spool/asterisk/monout

if [ ! -e /etc/asterisk/sark_customer_iax_header.conf ]; then
        /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_iax_header.conf
        /bin/echo "language=en-gb" >> /etc/asterisk/sark_customer_iax_header.conf
fi

if [ ! -e /etc/asterisk/sark_customer_sip_header.conf ]; then
        /bin/cp -f /opt/sark/cache/template_cust.conf /etc/asterisk/sark_customer_sip_header.conf
        /bin/echo "language=en-gb" >> /etc/asterisk/sark_customer_sip_header.conf
fi

#/bin/grep -q asterisk /etc/group
#if [  "$?" -eq "0" ] ; then
        /usr/sbin/usermod -a -G asterisk www
        /usr/sbin/usermod -a -G nobody www
#fi

if [ -e /bin/chown ] ; then
        /bin/chown -R www:www           /opt/sark/www
        /bin/chown -R www:www           /opt/sark/db
        /bin/chown -R www:www           /opt/sark/passwd
        /bin/chown -R asterisk:asterisk /etc/dahdi
        /bin/chown -R asterisk:asterisk /etc/asterisk/sark*
        /bin/chown -R asterisk:asterisk /etc/asterisk/selauth.conf
        /bin/chown -R asterisk:asterisk /var/spool/asterisk/monstage
        /bin/chown -R asterisk:asterisk /var/spool/asterisk/monout
        /bin/chown -R asterisk:asterisk /opt/sark/otrr/var/spool/asterisk/monitor
        /bin/chown -R asterisk:asterisk /opt/sark/mixmon/var/spool/asterisk/monitor
fi

if [ -e /bin/chmod ] ; then
        /bin/chmod 664 -R /etc/asterisk/sark*
        /bin/chmod 664 -R /etc/asterisk/selauth.conf
        /bin/chmod 755 -R /opt/sark/www
        /bin/chmod 755 -R /opt/sark/generator
        /bin/chmod 755 -R /opt/sark/perl
        /bin/chmod 755 -R /opt/sark/scripts
        /bin/chmod 777 -R /tftpboot
fi

/bin/grep -q '#include sark_manager.conf' /etc/asterisk/manager.conf
if [  "$?" -ne "0" ] ; then
        /bin/cp -f /opt/sark/cache/manager.conf /etc/asterisk
fi

/bin/grep -q '#include sark_customer_manager.conf' /etc/asterisk/sark_manager.conf
if [  "$?" -ne "0" ] ; then
        echo "#include sark_customer_manager.conf" >> /etc/asterisk/sark_manager.conf
fi

/bin/grep -q '#include sark_sip_notify.conf' /etc/asterisk/sip_notify.conf
if [  "$?" -ne "0" ] ; then
        echo "#include sark_sip_notify.conf" >> /etc/asterisk/sip_notify.conf
fi

if [ ! -e /opt/sark/db/sark.db ] ; then
        /bin/mv -f  /opt/sark/db/sarkstart.db /opt/sark/db/sark.db
fi

/bin/sh /opt/sark/scripts/update_db.sh >/dev/null
date --iso-8601=minutes > /opt/sark/db/.sail-install-date
echo "3.1.1-22" > /opt/sark/.sail-release

SAIL v4.0.0 only

  • SAIL v4.0.0 runs on SME 8 and there are no current plans to make it run on a vanilla CentOS. Hence for SME8 installs, the perl-Apache-Htpasswd-1.8-1.el5.rf.noarch.rpm should not be used.
  • SAIL v4.0.0 Access URL: https://server.ip.address:8443
  • smesailenvast18 rpm is available only in the ISO. All it does is set the asterisk delimiter in globals to a comma, Digium changed the delimiter from pipe (|) to comma(,) in 1.8. You can use it, if you are running 1.8, or set the value manually, doesn't matter which. It's in the ISO repo because we know ahead of time which asterisk we are running. V3/V4 will also run with 1.4 so the variable has to be changeable. Don't run with Asterisk 1.6 because it's nasty.
  • httpd.conf and other service files have been moved from smesailenv_4.0.0-10 rpm to sail_v4.0.0-34 rpm as the same files were used across many hardware / OS builds. The appropriate rpm/deb now moves it to where it should be in the target appliance. It now resides in /opt/sark/service in the sail_v4.0.0-* rpms. In generic SME8 appliance, the httpd.conf file will now get moved to /opt/sark/etc/httpd folder. The coressponding old files in /opt/sark/httpd will no longer be used and can be safely removed.
  • smesailenv_4.0.0-11 rpm upgrade must first be installed before upgrading sail_v4.0.0-* rpm.
  • Apply EXTLEN fix - Invert logic of SAIL v4.0.0-43 at line 334 in /opt/sark/php/sarkglobal/view.php to be:
if ( ! $extensions ) {
  • SAIL v4.0.0-43 sark.db schema (needs to set Primary key for vendorxref table)
  • SAIL 4 RPM Scriptlets
  • Changes (lines re-arranged for stanza comparision) in generated Dial Plan in v4.0.0 - mcstdial:
--- sail311-22/dialplanlist.txt	Fri Mar 01 03:30:31 2013
+++ sail400-43/dialplanlist.txt	Fri Mar 01 03:28:48 2013
@@ -9,6 +9,7 @@
 
 [ Context 'internal' created by 'pbx_config' ]
   '0' =>            1. Goto(extensions,${SYSOP},1)                [pbx_config]
+  '_**X.' =>        1. agi(sarkhpe,OutCos,${EXTEN},,)             [pbx_config]
   '_[+*]X.' =>      1. agi(sarkhpe,OutCos,${EXTEN},,)             [pbx_config]
   '_X.' =>          1. agi(sarkhpe,OutCos,${EXTEN},,)             [pbx_config]
   Include =>        'parkedcalls'                                 [pbx_config]
@@ -23,6 +24,7 @@
   '_XXXX.' =>       1. agi(sarkhpe,OutRoute,DEFAULT,,)            [pbx_config]
   Include =>        'internal-presets'                            [pbx_config]
   Include =>        'extensions'                                  [pbx_config]
+  Include =>        'mcstdial'                                    [pbx_config]
 
 [ Context 'qrxvtmny-callback' created by 'pbx_config' ]
   '_X.' =>          1. DISA(no-password,qrxvtmny)                 [pbx_config]
@@ -68,6 +70,7 @@
   '999' =>          1. agi(sarkhpe,OutCluster,${EXTEN},,)         [pbx_config]
 
 [ Context 'Cosend' created by 'pbx_config' ]
+  '_**X.' =>        1. agi(sarkhpe,OutCluster,${EXTEN},,)         [pbx_config]
   '_[+*]X.' =>      1. agi(sarkhpe,OutCluster,${EXTEN},,)         [pbx_config]
   '_X.' =>          1. agi(sarkhpe,OutCluster,${EXTEN},,)         [pbx_config]
 
@@ -350,5 +353,16 @@
   's' =>            1. Set(chan=${CUT(CHANNEL,/,2)})              [pbx_config]
                     2. GoTo(mainmenu,GSM${chan},1)                [pbx_config]
 
+[ Context 'mcstdial' created by 'pbx_config' ]
+  '8181' =>         1. Set(room=${RAND(3000,4000)})               [pbx_config]
+                    2. system(/usr/bin/php /opt/sark/generator/mcstcaller.php -n4422 -r${room} ) [pbx_config]
+                    3. meetme(${room},Ad)                         [pbx_config]
+  's' =>            1. GoTo(8181,1)                               [pbx_config]
+
+[ Context 'mcstcnfxfer' created by 'pbx_config' ]
+  's' =>            1. Read(digit0,${greeting},1,,2,10)           [pbx_config]
+                    2. GotoIf($["${digit0}" = ""]?101)            [pbx_config]
+                    3. MeetMe(${room},x)                          [pbx_config]
+                    101. Hangup()                                 [pbx_config]

Device Settings

Digium Echo Cancellation

A forum post dealing with Digium cards provides the commands necessary to achieve good sound quality on SARK / SAIL.

In summary:

amportal stop
/etc/init.d/dahdi stop

then I edited /etc/dahdi/system.conf and added:
echocanceller=none

edited /etc/asterisk/chan_dahdi.conf and added a ; infont of echotrining
;echotraining=800

/etc/init.d/dahdi start

then:

fxotune -i 5
Tuning module /dev/dahdi/1
Done!
Tuning module /dev/dahdi/2
Done!

fxotune -i 5 (took 2 minutes for each channel)

fxotune -s to record the values

then:
amportal start

and I have:
cat /etc/fxotune.conf 
1=0,0,0,0,0,0,0,0,0
2=9,255,1,4,0,0,1,255,0

Perfect Sound!

SPA 31xx SAIL settings

References