Thursday, 24 November 2011

Compiling app_swift for AsteriskNOW or Fedora

For those building Asterisk interactive voice menus the app_swift plugin is a must. Giving the administrator the ability to directly interface with Cepstral voices from within the dial plans is a massive time saver. 


The problem 

Unfortunately many users are having issues with compiling the app_swift module on AsteriskNOW as the appropriate build tools are not included in the operating system.

If you don't have the correct tools installed you will probably see an output like this.

/usr/include/string.h:66: error: declaration for parameter âmemchrâ but no such parameter
/usr/include/string.h:62: error: declaration for parameter âmemcmpâ but no such parameter
/usr/include/string.h:59: error: declaration for parameter âmemsetâ but no such parameter
/usr/include/string.h:51: error: declaration for parameter âmemccpyâ but no such parameter
/usr/include/string.h:43: error: declaration for parameter âmemmoveâ but no such parameter
/usr/include/string.h:38: error: declaration for parameter âmemcpyâ but no such parameter
/usr/lib/gcc/i486-linux-gnu/4.3.2/include/stddef.h:214: error: declaration for parameter âsize_tâ

app_swift.c:569: error: expected â{â at end of input
make: *** [app_swift.o] Error 1


The result is no app_swift.o module and a frustrated administrator. 


Installing app_swift

The following instructions will work with Asterisk 1.6.x on AsteriskNOW or Fedora distributions.

1. Before you install app_swift you need to download and build the Cepstral swift package. Start by downloading the Allison voice package, alternatively you can choose a voice you prefer from Cepstral.com.
wget http://downloads.cepstral.com/cepstral/i386-linux/Cepstral_Allison-8kHz_i386-linux_5.1.0.tar.gz

2. Extract the package .
tar -zxvf Cepstral*

3. Enter the directory.
cd Cepstral_Allison-8kHz_i386-linux_5.1.0

4. Run the installer.
./install.sh

5. Load the library into ld.
echo /opt/swift/lib > /etc/ld.so.conf.d/cepstral.conf

6. Now run ldconfig to finish the ld configuration process.
ldconfig

7. Its time to get app_swift compiled, first start by downloading the source.
wget http://pbxinaflash.net/source/app_swift/app_swift-1.6.2.tar.gz

8. Before we can compile swift, the appropriate build tools and libraries must be installed into the OS. Issue the following commands sequentially to install the tools with yum.
yum install gcc

yum install build-essential
yum install asterisk-devel

yum install kernel-devel
yum groupinstall "Development Tools"

9. Extract app_swift in preparation of compiling.
tar -zxvf app_swift-1.6*

10. Go into the app_swift directory.
cd app_swift-1.6.2

11. Now we can make the package.
make ; make install

12. Copy the configuration file to the asterisk directory.
cp swift.conf.sample /etc/asterisk/swift.conf


13. We also need to make a symbolic link to the swift binary for easier access.
ln -s /opt/swift/bin/swift /usr/bin/swift

14. Finally you need to edit swift.conf to reflect the voice you have installed. I always choose Allison, but the choice is yours.
sed -i 's|David-8kHz|Allison-8kHz|' /etc/asterisk/swift.conf

15. We finish with restarting Asterisk
/etc/init.d/asterisk restart  



Confirming all is well

Once the installation is complete the module should be loaded into Asterisk. You can check this by starting asterisk console and issuing the show application command.

1. asterisk -cr
2. core show application swift
If everything is running smoothly you should see an output similar to below.

asterisk*CLI> core show application swift
  -= Info about application 'Swift' =-

You can now start swift()'ing your way to a flexible, intuitive and interactive dial plan that suites your requirements.

No comments:

Post a Comment