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>
Presence configuration
First, to enable subscriptions for the extension, /etc/asterisk/sip_custom_post.conf needs to be modified.
Note: Due to a possible bug in the presence patch, the subscription seems to be doing greedy matching, which then causes another subscription not to register.
eg. Extensions 301 and 1301 - adding a subscription for 301 will cause 1301 not to register. The work around is to add a subscription for 1301 only.
; Enables 326 to subscribe to presence notifications for 325 and 1000 [326](+) cisco_usecallmanager=yes subscribe=325 subscribe=1000 ; Enables 1301 to subscribe to presence notifications for 152 - see notes above [1301](+) cisco_usecallmanager=yes subscribe=152
It's also necessary to add the following to the lines tag for the phone configuration
<line button="4"> <featureID>21</featureID> <featureLabel>James</featureLabel> <speedDialNumber>325</speedDialNumber> <featureOptionMask>1</featureOptionMask> <!-- If you want the line to cause an epileptic fit when it's ringing --> </line> <line button="5"> <featureID>21</featureID> <featureLabel>Test</featureLabel> <speedDialNumber>1000</speedDialNumber> </line>
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
Digium
Digium cards are picky when it comes to IRQs and Frame Buffers:
Oct 16 19:21:01 pbx1 kernel: wcte13xp 0000:01:00.0: Underrun detected by hardware. Latency bumped to: 4ms Oct 16 19:21:01 pbx1 kernel: wcte13xp 0000:01:00.0: IO error reported by firmware. Oct 16 19:21:01 pbx1 kernel: wcte13xp 0000:01:00.0: Underrun detected by hardware. Latency bumped to: 5ms Oct 16 19:21:01 pbx1 kernel: wcte13xp 0000:01:00.0: Underrun detected by hardware. Latency bumped to: 6ms Oct 16 19:21:01 pbx1 kernel: wcte13xp 0000:01:00.0: Underrun detected by hardware. Latency bumped to: 7ms
Check out these links if the PRI card is spamming the logs
Dahdi Interface Flapping
How to disable the Linux framebuffer if it's causing problems
CentOS
RPM Command: 15 Examples to Install, Uninstall, Upgrade, Query RPM Packages
http://wiki.centos.org/HowTos/RebuildSRPM