AurosBlog

Technical Blog

MySQL 5′s big bonuses

Stored procedures allow you to move business logic from end applications to the MySQL server, which can save effort when you have multiple end applications (instead of implementing a price calculation routine in PHP for the web and VC for the desktop, you can implement it in a stored procedure and call it from both PHP and VC).

Stored procedures can also enhance security by allowing you to prevent a user from accessing a table directly, but instead giving them permission to call a stored procedure that has access to the table.

Triggers are stored routines that are written with a syntax like that of stored procedures, but instead of being called by a user or application, triggers are activated by table events such as inserts, updates, and deletes. The triggers can modify or abort the triggering table actions, or take the information provided by the action and use it elsewhere.

Views are essentially named virtual tables defined by SQL queries. I can take a complex set of tables, create a SELECT query that might be more meaningful to end users, then turn it into a view. The end users can then perform SELECT queries against the view and, in most cases, also execute INSERT, UPDATE, and DELETE statements against the view, with the changes being reflected in the underlying tables. Views help to simplify complicated data and also enhance security. As with a stored procedure, you can create a view and give a user permission to SELECT from the view but not the underlying table.

Evaluating MySQL 5

In the end most users will eventually move to MySQL 5 as MySQL 4 and 4.1 age and become outdated. The timing will have to depend on whether you consider the features of MySQL 5 to be useful to your organization.

When evaluating the new features, I would recommend installing MySQL 5 on a separate machine and trying it with your existing applications, run as many tests as you can and see if everything runs smoothly. If you do not encounter any errors you can then bring MySQL 5 into your production systems (after a production release of MySQL 5).

There really should not be things to watch out for, in the sense of bugs or incompatibilities, but you can always watch the changelogs at the 5.0 news page on MySQL’s site and look for entries that are marked ‘Incompatible Change’.

Asterisk Installation Step By Step on Ubuntu

Install Pre-Requisites:
apt-get install build-essential autoconf automake libtool flex bison libssl-dev libnewt-dev libncurses5-dev linux-headers-`uname -r`
apt-get install sox curl subversion subversion-tools
apt-get install mysql-client mysql-server libmysqlclient15-dev
apt-get install php5 php5-cli php5-curl php5-gd php5-json(php5-common) php5-mcrypt php5-mhash php5-mysql php5-suhosin php5-xmlrpc php5-xsl php-pear
apt-get install apache2 apache2-mpm-prefork

Setup Accounts:
adduser –system –home /var/lib/asterisk –group asterisk
mkdir /var/run/asterisk
chown -R asterisk:asterisk /var/run/asterisk

Download Asterisk:

wget ftp.digium.com/pub/asterisk/releases/asterisk-1.4.21.1.tar.gz

wget ftp.digium.com/pub/asterisk/releases/asterisk-addons-1.4.7.tar.gz

wget ftp.digium.com/pub/libpri/releases/libpri-1.4.4.tar.gz


Uncompress Asterisk Sources:

tar xzvf asterisk-1.4.21.1.tar.gz

tar xzvf asterisk-addons-1.4.7.tar.gz

tar xzvf libpri-1.4.4.tar.gz

Compile Asterisk Sources:
cd asterisk-1.4.13 && ./configure && make install && make samples && cd -
cd asterisk-addons-1.4.4 && ./configure && make install && cd -
cd libpri-1.4.2 && make && make install && cd -


Setup MySQL:

mysql -u root –p (Enter your password to check if mysql is running properly or not)

mysqladmin -u root password ”
mysqladmin -p create asterisk create asteriskcdrdb
echo “GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY ”;” | mysql -u root –p
echo “GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY ”;” | mysql -u root -p

Configure Asterisk Files:
(/etc/apache2/apache2.conf):
User asterisk
Group asterisk

(/etc/asterisk/asterisk.conf):
astrundir => /var/run/asterisk

(/etc/php5/apache2/php.ini):
post_max_size = 20M
upload_max_filesize = 20M

Install PEAR for PHP:
pear install db

Setup Asterisk:

edit /etc/init.d/skeleton

DAEMON=/usr/src/asterisk/asterisk

NAME=Asterisk

DESC=”Asterisk PBX”

save file as asterisk in /etc/init.d/

>
chmod +x /etc/init.d/asterisk
/etc/init.d/asterisk start
nano /etc/inittab
chown -R asterisk:asterisk /var/spool/asterisk/
chown -R asterisk:asterisk /var/log/asterisk/

Setup FreePBX:
svn co https://amportal.svn.sourceforge.net/svnroot/amportal/freepbx/branches/2.3/ /usr/src/freepbx
mysql -p asterisk < /usr/src/freepbx/SQL/newinstall.sql mysql -p asteriskcdrdb < /usr/src/freepbx/SQL/cdr_mysql_table.sql cd /usr/src/freepbx

>

./install_amp

Username to connect to the asterisk database

[asteriskuser]asterisk

Password to connect to the asterisk database

[amp109]

Hostname of Asterisk Database [localhost]

Username to connect to the Asterisk Manager Interface[admin]

Password to connect to the Asterisk Manager interface[amp111]

Path to use for your AMP web root[/var/www/html]

Ip address or hostname used to access the AMP web-admin [xx.xx.xx.xx]

Password to perform call transfer with the flash operator panel[passw0rd]

Use simple Extensions [extensions] admin or separate Devices and Users [devicesandusers]

Directory to store AMP executable scripts [/var/lib/asterisk/bin]

Directory to store super user scripts [/usr/local/sbin]

If it fails running or problem connecting to the database try

./install_amp –username=root –password=[password]

&& cd -

Update Ubuntu Startup Files:
update-rc.d zaptel defaults
update-rc.d asterisk defaults

Setup Zaptel if Required:
(/etc/zaptel.conf)
span=1,0,0,esf,b8zs
bchan=1-23
dchan=24

Load Zaptel Modules:
modprobe zaptel
modprobe wct1xxp
ztcfg -vv

Visit the Web Interface:
http://<localhost>/html/

|