Phone System
Asterisk
Building Asterisk from source
Asterisk needs to be built from source so that it can be patched to enable Presence Subscriptions. A non-root build environment needs to be configured, and the Source RPM downloaded.
The CentOS Wiki provides general instructions.
As root
yum install rpm-build useradd rpmbuild su rpmbuild
As rpmbuild - create the build environment
cd
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
Fetch the src.rpm - use the current version
wget http://yum.freepbxdistro.org/pbx/SRPMS/asterisk/11/asterisk11-11.13.0-1.shmz65.1.31.src.rpm
Extract the rpm - this will likely show a list of packages that need to be created
rpmbuild --rebuild asterisk11-11.13.0-1.shmz65.1.31.src.rpm
Extract and patch the source - this gives us something to test the ASTERISK-13145 patch on
cd rpmbuild/SPECS/ rpmbuild -bp --without misdn asterisk11.spec
Test the patch downloaded from the ASTERISK-13145
cd ../BUILD/asterisk-11.13.0/ patch --dry-run -p1 < ../../../gareth-11.13.0.patch
If the patch is ok, then copy it to the SOURCE directory, and add it to the SPEC file - it needs to bee added under the list of Patch1, Patch2, etc, and also under the %patch1, $patch2, etc.
For example, in Asterisk 11.13, it was added as Patch13, and %patch13 needed flags "-p1 -F2"
The Release field also has to be updated, in this case "1%{dist}.1.31_13145%{?_without_optimizations:_debug}"
cp ../../../gareth-11.13.0.patch ../../SOURCES/ cd ../../SPECS/ vim asterisk11.spec
And build
rpmbuild -bb --without misdn asterisk11.spec
To install, you need to be root. List all the asterisk RPMs already installed, and the upgrade them (The oldpackage flag may be needed if rpm thinks the compiled version is older).
cd /home/rpmbuild/rpmbuild/RPMS/x86_64 rpm -qa | grep asterisk11 | sort rpm -Uvh --oldpackage <rpm>
Converting WAV to PCM:
Asterisk can't play mu-law files, so they need to be converted to PCM
ORIG=<ulaw file> PCM=$(echo "$ORIG" | sed 's/ulaw/pcm/') sox "$ORIG" -r 8000 -c 1 -e signed $PCM
CentOS
RPM Command: 15 Examples to Install, Uninstall, Upgrade, Query RPM Packages
http://wiki.centos.org/HowTos/RebuildSRPM