Skip to content

Instantly share code, notes, and snippets.

@rodrigolang
Created December 15, 2012 22:29
Show Gist options
  • Save rodrigolang/4299899 to your computer and use it in GitHub Desktop.
Save rodrigolang/4299899 to your computer and use it in GitHub Desktop.
Script para instalação do FreeSwitch 1.0.6 no Debian ou Ubuntu.
#!/bin/sh
[ `id -u` -eq 0 ] || { echo "You must have root privilege to run this script." && exit 0; }
check_network() {
echo "\nTesting your internet connection. This process may take a few seconds..."
ping 8.8.8.8 -W5 -c1 >/dev/null;
if [ $? != "0" ]; then
echo "Wait..."
ping 4.2.2.2 -W5 -c1 >/dev/null;
if [ $? != "0" ]; then
echo "You must have an Internet connection to run this script."
exit 0
fi
else
echo "Your Internet connection is Ok."
fi
}
install_sounds() {
make cd-sounds-install && make cd-moh-install
make uhd-sounds-install && make uhd-moh-install
make hd-sounds-install && make hd-moh-install
make sounds-install && make moh-install
}
install_dependences() {
apt-get -y install git-core build-essential automake autoconf libtool wget make libncurses5 libncurses5-dev \
libgdbm-dev libdb-dev libperl-dev zlib1g-dev libtiff4-dev libjpeg62-dev debhelper \
unixodbc-dev libasound2-dev libcurl4-openssl-dev libssl-dev libogg-dev libvorbis-dev \
libgdbm-dev libgnutls-dev devscripts curl >/dev/null;
}
install_freeswitch() {
sleep 2
cd /usr/src/
get -c http://files.freeswitch.org/freeswitch-1.0.6.tar.gz
tar zxvf freeswitch-1.0.6.tar.gz
cd /usr/src/freeswitch-1.0.6/
./configure && make && make check && make samples
}
commands_freeswitch() {
ln -s /usr/local/freeswitch/bin/freeswitch /usr/local/bin/freeswitch
ln -s /usr/local/freeswitch/bin/fs_cli /usr/local/bin/fs_cli
}
echo "\nCopyright© Rodrigo Ferreira Lang"
echo "Purpose: Script made to install FreeSWITCH-1.0.6 in Debian/Ubuntu OS."
check_network
echo "\nTo install FreeSWITCH you must have some dependences. Do you want upgrade? [Y/n]" && read option
case $option in
[Nn])
echo "Canceling the instalation."
exit 0
;;
*)
install_dependences
;;
esac
echo "Starting the instalation of FreeSWITCH."
install_freeswitch
echo "Creating commands."
commands_freeswitch
echo "\nDo you want install the default sounds of FreeSWITCH? [Y/n]" && read option
case $option in
[Nn])
echo "Instalation completed."
exit 0
;;
*)
install_sounds
;;
esac
echo "Instalation completed."
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment