Aastra XML scripts part II, auto-provisioning and auto setup with RPMS

In previous posts I showed how to auto-provision and configure Aastra phones by manually installing XML scripts.  Aastra has released RPM packages for Trixbox that combines everything and adds new features as well as mDNS so the phones can find the TFTP server even if you don't have a DHCP server capable of assigning it.  The script won't install unless mDNS is installed. 

This pretty much ties off most if not all loose ends IMHO so we now have a full featured fully automatic script that has addressed just about everything.  I'm pleased to provide everything needed to install this on any CentOS 5 based distribution of Asterisk and/or FreePBX including your own from scratch install which is what I did.  So having said that I have only tested this on my own from scratch install of CentOS5-Asterisk1.4-FreePBX2.4 using a 57i and 55i phone.  I have also tested this on CentOS5-Asterisk1.6-FreePBX2.4. It should work on just about any distribution out there using the same versions of software.  It has templates and configurations for all Aastra phones so you don't even have to worry about that.  It will automatically configure the phone with all the features it's capable of.  What else could you ask for! 

The beauty of this procedure is it's all RPM based so it's much simpler and does just about everything for you.  The downside is it does everything for you.  You don't have to think so if you want to go in and change things or troubleshoot you'll have more of a learning curve.

NOTE:  Before you install this script you should enable all the features you plan to use (such as call parking) on FreePBX otherwise you may not be able to get them working and may (reportedly) have to re-install the script.  Also, you must have the extensions entered in FreePBX before you assign them to a phone during the autoprovision procedure.
You should have the latest firmware for your Aastra phone installed.  According to the official Aastra documentation, this script has been developed and tested with the following firmware versions:

v1.4.2.3000 for Aastra 9112i/9133i/480i and 480iCT
v2.2.0.166 for Aastra 51i/53i/55i/57i and 57iCT 

Before you do this you need to uninstall any previous aastra xml scripts. 
rpm -q aastra-xml-scripts

If you have previous scripts installed it should come up with something like "aastra-xml-scripts-1.1.0-1".  Remove this by typing
rpm -e --noscripts aastra-xml-scripts-1.1.0-1

Note: make sure your /tftpboot directory is r/w/x by user:asterisk group:asterisk otherwise this won't work
chmod -R a+rwx /tftpboot
chown -R asterisk.asterisk /tftpboot

Download and install all the required packages into your /usr/src or other directory.  As time goes on you might want to check if these are the latest versions.
yum install php-gd
cd /usr/src
wget http://yum.trixbox.org/centos/5/RPMS/aastra-ipphone-2.3.0-1.noarch.rpm
rpm -ivh aastra-ipphone-2.3.0-1.noarch.rpm
wget http://yum.trixbox.org/centos/5/RPMS/mDNSResponder-108.5-1.i386.rpm
rpm -ivh mDNSResponder-108.5-1.i386.rpm
wget http://yum.trixbox.org/centos/5/RPMS/mDNSResponder-util-108.5-1.i386.rpm
rpm -ivh mDNSResponder-util-108.5-1.i386.rpm
wget ftp://ftp.pbone.net/mirror/www.haoli.org/pub/redhat-6.x/RPMS/i386/mpg123-0.59r-1.i386.rpm
rpm -ivh mpg123-0.59r-1.i386.rpm
wget http://yum.trixbox.org/centos/5/RPMS/aastra-xml-scripts-2.0.0-2.noarch.rpm
rpm -ivh aastra-xml-scripts-2.0.0-2.noarch.rpm

NOTE: If you get a conflict error try this:
rpm -ivh --force aastra-xml-scripts-2.0.0-2.noarch.rpm

redo permissions to make sure the newly copied files are r/w/x by user:asterisk group:asterisk
chmod -R a+rwx /tftpboot
chown -R asterisk.asterisk /tftpboot


This command creates a proper aastra.cfg in the TFTP directory (/tftpboot) to allow self-configuration.  If you need to change how the phones are configured that is all done in the template file /var/www/html/aastra/asterisk/trixbox.prf

I removed all previous files from my /tftpboot directory and deleted my /var/cache/aastra and /var/www/html/aastra directories before I performed this procedure but I'm not sure if that is necessary as long as permissions are correct.

That's it!  Now remove the local phone config from the phone or from the phone web gui and reboot.  The phone will ask for the ext and password assignment (which must be setup on the FreePBX/Asterisk side first) and reboot again at which point it will come up with the default configuration with all the bells and whistles.  Obviously if you don't want some of those features to be configured you can go into the template file and change it.

Here is the official Aastra XML script 2.0.0 manual.

NOTE:  If you get a "page load error" on the phone after you reboot it you may need to disable SSL on the server.  I did it by issuing a "yum remove mod_ssl" command.  This may have some other dependencies in which case it should be disabled in httpd.conf.