diff --git a/debian/install.sh b/debian/install.sh index c998510..be617bf 100644 --- a/debian/install.sh +++ b/debian/install.sh @@ -1,38 +1,77 @@ #!/bin/sh +#----OS ENVIRONMENT CHECKS------- +# check to confirm running as root. # First, we need to be root... +if [ "$(id -u)" -ne "0" ]; then + sudo -p "$(basename "$0") must be run as root, please enter your sudo password : " "$0" "$@" + exit 0 +fi +echo +echo "You're root.... continuing!" +echo -#Update Debian -echo "Update Debian" -apt-get upgrade && apt-get update -y --force-yes +# removes the cd img from the /etc/apt/sources.list file (not needed after base install) +sed -i '/cdrom:/d' /etc/apt/sources.list -#IPTables -resources/./iptables.sh +#if lsb_release is not installed it installs it +if [ ! -s /usr/bin/lsb_release ]; then + apt-get update && apt-get -y install lsb-release +fi -#FusionPBX -resources/./fusionpbx.sh +#Os/Distro Check +lsb_release -c |grep -i jessie > /dev/null +if [ $? -eq 0 ]; then + echo " OK you are running Debian 8 : Jessie. This script is known to work " + echo " with building from source. No Jessie pkgs yet. " +else + echo " This script was written for Debian 8 Jessie (Stable) " + echo " Your OS appears to be: " lsb_release -a + echo " Your OS is not currently supported... Exiting the install. " + exit +fi +clear -#NGINX web server -resources/./nginx.sh - -#Fail2ban -resources/./fail2ban.sh +# +#Update Debian & install ntpd +for i in update upgrade ;do apt-get -y "${i}" ; done +apt-get -y install ntp +service ntp res #FreeSWITCH resources/switch/./package-release.sh #resources/switch/./package-master.sh #resources/switch/./source-release.sh -#Postgres -resources/./postgres.sh +#NGINX web server +resources/./nginx.sh + +#FusionPBX +resources/./fusionpbx.sh + +#FusionPBX Optional Pkgs +resources/./packages.sh + +#FusionPBX Phone Provisioning Selections +resources/./provision.sh + +#Fail2ban +resources/./fail2ban.sh + +#Postgres-Client +#resources/./postgres-client.sh + +#Postgres-server +#resources/./postgres-server.sh + +#IPTables +resources/./iptables.sh #set the ip address server_address=$(hostname -I) #restart services -/bin/systemctl daemon-reload -/bin/systemctl try-restart freeswitch -/bin/systemctl daemon-reload -/bin/systemctl restart nginx -/bin/systemctl restart fail2ban +systemctl daemon-reload +systemctl restart nginx +systemctl restart fail2ban #/usr/sbin/service nginx restart #/usr/sbin/service fail2ban restart @@ -45,3 +84,4 @@ echo "" #wait for the config.php to exist and then restart the service #resources/./finish.sh + diff --git a/debian/resources/debian-repos.sh b/debian/resources/debian-repos.sh new file mode 100644 index 0000000..9e6ca7e --- /dev/null +++ b/debian/resources/debian-repos.sh @@ -0,0 +1,19 @@ +####################################### +#Setup Main debian repo for right pkgs +####################################### +echo "installing jessie release repo" +cat > "/etc/apt/sources.list" << DELIM +deb http://httpredir.debian.org/debian/ jessie main contrib non-free +deb-src http://httpredir.debian.org/debian/ jessie main contrib non-free + +deb http://httpredir.debian.org/debian/ jessie-updates main contrib non-free +deb-src http://httpredir.debian.org/debian/ jessie-updates main contrib non-free + +deb http://httpredir.debian.org/debian/ jessie-backports main contrib non-free +deb-src http://httpredir.debian.org/debian/ jessie-backports main contrib non-free +DELIM + +#################################### +#----- upgrading base install----- +#################################### +apt-get update && apt-get -y upgrade \ No newline at end of file diff --git a/debian/resources/finish.sh b/debian/resources/finish.sh index 0243778..d19f00a 100644 --- a/debian/resources/finish.sh +++ b/debian/resources/finish.sh @@ -25,3 +25,4 @@ done #restart freeswitch /bin/systemctl daemon-reload /bin/systemctl restart freeswitch + diff --git a/debian/resources/fusionpbx.sh b/debian/resources/fusionpbx.sh index a61a8cc..c409bd7 100644 --- a/debian/resources/fusionpbx.sh +++ b/debian/resources/fusionpbx.sh @@ -4,9 +4,102 @@ echo "Install FusionPBX" #install dependencies -apt-get install -y --force-yes vim git dbus haveged ssl-cert -apt-get install -y --force-yes ghostscript libtiff5-dev libtiff-tools +apt-get install -y --force-yes vim git dbus haveged +apt-get install -y --force-yes ghostscript libtiff5 libtiff-tools -#get the source code -git clone https://github.com/fusionpbx/fusionpbx.git /var/www/fusionpbx -chown -R www-data:www-data /var/www/fusionpbx +###################### +#adding FusionPBX repo +####################### +echo ' installing fusionpbx jessie Stabe/Release repo ' +cat > "/etc/apt/sources.list.d/fusionpbx.list" < '/etc/default/freeswitch' << DELIM +CONFDIR="/etc/fusionpbx" +# +# Uncooment extra lines and make sure to add cut and paste them to the DAEMON_ARGS +# Options to control locations of files: +fs_conf="/etc/fusionpbx" +fs_db="/var/lib/freeswitch/db" +fs_imgs="/var/lib/fusionpbx/images" +fs_log="/var/log/freeswitch" +fs_recordings="/var/lib/fusionpbx/recordings" +fs_run="/var/run/freeswitch" +fs_scripts="/var/lib/fusionpbx/scripts" +fs_storage="/var/lib/fusionpbx/storage" +fs_usr=freeswitch +fs_grp=\$fs_usr +# +#These are the optional arguments you can pass to freeswitch: (add options to fs_options line) +# -nf -- no forking +# -reincarnate -- restart the switch on an uncontrolled exit +# -reincarnate-reexec -- run execv on a restart (helpful for upgrades) +# -u [user] -- specify user to switch to +# -g [group] -- specify group to switch to +# -core -- dump cores +# -rp -- enable high(realtime) priority settings +# -lp -- enable low priority settings +# -np -- enable normal priority settings +# -vg -- run under valgrind +# -nosql -- disable internal sql scoreboard +# -heavy-timer -- Heavy Timer, possibly more accurate but at a cost +# -nonat -- disable auto nat detection +# -nonatmap -- disable auto nat port mapping +# -nocal -- disable clock calibration +# -nort -- disable clock clock_realtime +# -stop -- stop freeswitch +# -nc -- do not output to a console and background +# -ncwait -- do not output to a console and background but wait until the system is ready before exiting (implies -nc) +# -c -- output to a console and stay in the foreground +fs_options="-nc -rp -reincarnate" +# +# Reads in the arguments into 1 line command +DAEMON_ARGS="-u \$fs_usr -g \$fs_grp -conf \$fs_conf -db \$fs_db -images \$fs_images -log \$fs_log -scripts \$fs_scripts -run \$fs_run -storage \$fs_storage -recordings \$fs_recordings \$fs_options" +DELIM + +################################################################# +#restartng services with thefusionpbx freeswitch fhs dir layoout +################################################################# +echo " Restarting freeswitch for changes to take effect...." +service freeswitch restart + +######################## +#set permissions on dir +######################## +find "/var/lib/fusionpbx" -type d -exec chmod 775 {} + +find "/var/lib/fusionpbx" -type f -exec chmod 664 {} + diff --git a/debian/resources/logging.sh b/debian/resources/logging.sh new file mode 100644 index 0000000..68055a9 --- /dev/null +++ b/debian/resources/logging.sh @@ -0,0 +1,53 @@ +######################################################### +#Turning off Repeated Msg Reduction in /etc/rsyslog.conf" +######################################################### +sed -i 's/RepeatedMsgReduction\ on/RepeatedMsgReduction\ off/' /etc/rsyslog.conf + +############################ +# Restarting rsyslog service +############################ +service rsyslog restart + +sed -i /usr/bin/fail2ban-client -e s,^\.setInputCmd\(c\),'time.sleep\(0\.1\)\n\t\t\tbeautifier.setInputCmd\(c\)', + +############################## +#Restarting Nginx and PHP FPM +############################## +for i in freeswitch fail2ban +do service "${i}" restart > /dev/null 2>&1 +done + +############################################################ +# see http://wiki.fusionpbx.com/index.php?title=RotateFSLogs +############################################################ +cat > "/etc/cron.daily/freeswitch_log_rotation" </tmp/rotateFSlogs + +if [ $? -eq 0 ]; then + #-cmin 2 could bite us (leave some files uncompressed, eg 11M auto-rotate). Maybe -1440 is better? + find "$FSPATH" -name "freeswitch.log.*" -cmin -2 -exec gzip {} \; + find "$FSPATH" -name "freeswitch.log.*.gz" "-mtime" "+$NUMBERDAYS" -exec rm {} \; + chown freeswitch:freeswitch "$FSPATH"/freeswitch.log + chmod 664 "$FSPATH"/freeswitch.log + logger FreeSWITCH Logs rotated + rm /tmp/</dev/null 2>&1 ; done diff --git a/debian/resources/nginx.sh b/debian/resources/nginx.sh index 2f9e670..bf3f5aa 100644 --- a/debian/resources/nginx.sh +++ b/debian/resources/nginx.sh @@ -4,15 +4,29 @@ echo "Install the web server\n" #install dependencies -apt-get install -y --force-yes nginx php5 php5-cli php5-fpm php5-pgsql php5-sqlite php5-odbc php5-curl php5-imap php5-mcrypt +apt-get -y install ssl-cert nginx php5-cli php5-common php-apc php5-gd php-db php5-fpm php5-memcache php5-sqlite php5-imap php5-mcrypt php5-curl #enable fusionpbx nginx config cp resources/nginx/fusionpbx /etc/nginx/sites-available/fusionpbx ln -s /etc/nginx/sites-available/fusionpbx /etc/nginx/sites-enabled/fusionpbx #self signed certificate -ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/private/nginx.key -ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/certs/nginx.crt +cp -r /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/private/nginx.key +cp -r /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/certs/nginx.crt #remove the default site -rm /etc/nginx/sites-enabled/default \ No newline at end of file +rm /etc/nginx/sites-enabled/default + +# Changing file upload size from 2M to upload_size +sed -i /etc/php5/fpm/php.ini -e "s#upload_max_filesize = 2M#upload_max_filesize = 25M#" + +# Changing post_max_size limit from 8M to upload_size +sed -i /etc/php5/fpm/php.ini -e "s#post_max_size = 8M#post_max_size = 25M#" + +#Adding users to needed groups +adduser www-data freeswitch +adduser www-data audio +adduser www-data dialout + +#restart nginx +service nginx restart \ No newline at end of file diff --git a/debian/resources/nginx/fusionpbx b/debian/resources/nginx/fusionpbx index 869c05b..76a39e1 100644 --- a/debian/resources/nginx/fusionpbx +++ b/debian/resources/nginx/fusionpbx @@ -1,4 +1,3 @@ - server{ listen 127.0.0.1:80; server_name 127.0.0.1; diff --git a/debian/resources/packages.sh b/debian/resources/packages.sh new file mode 100644 index 0000000..54442fd --- /dev/null +++ b/debian/resources/packages.sh @@ -0,0 +1,96 @@ +adminer="y" # : integrated for an administrator in the superadmin group to enable easy database access +backup="y" # : pbx backup module. backup sqlite db / configs/ logs +call_broadcast="n" # : Create a recording and select one or more groups to have the system call and play the recording +call_center="y" # : display queue status, agent status, tier status for call centers using mod_callcenter call queues +call_flows="n" # : Typically used with day night mode. To direct calls between two destinations. +conference_centers="n" # : tools for multi room confrences and room contol +conferences="n" # : tools for single room confrences and room contol +edit="y" # : multi tools for editing (templates/xmlfiles/configfiles/scripts) files +exec="n" # : comman shells pages for executing (php/shells) commands +fax="y" # : fusionpbx send/recieve faxes service +fifo="n" # : first in first out call queues system +services="n" # : allows interaction with the processes running on your server +traffic_graph="n" # : php graph for monitoing the network interface traffic + +########################### +#Optional APP PKGS installs +########################### +if [[ $adminer == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-adminer +fi + +if [[ $backup == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-backup +fi + +if [[ $call_broadcast == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-call-broadcast +fi + +if [[ $call_center == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-call-center fusionpbx-app-call-center-active + if [[ -f /root/.fs_src ]] ; then + if [[ ! -f /usr/lib/freeswitch/mod/mod_callcenter ]] ; then + echo " Requires freeswitch mod_callcenter " + fi + else + apt-get -y --force-yes install freeswitch-mod-callcenters + fi +fi + +if [[ $call_flows == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-call-flows +fi + +if [[ $conference_centers == "y" ]]; then + apt-get -y --force-yes install freeswitch-mod-conference fusionpbx-app-conference-centers fusionpbx-app-conferences-active fusionpbx-app-meetings + if [[ -f /root/.fs_src ]] ; then + if [[ ! -f /usr/lib/freeswitch/mod/mod_conference ]] ; then + echo " Requires freeswitch mod_conference " + fi + else + apt-get -y --force-yes install freeswitch-mod-conferences + fi +fi + +if [[ $conference == "y" ]]; then + apt-get -y --force-yes install freeswitch-mod-conference fusionpbx-app-conferences fusionpbx-app-conferences-active fusionpbx-app-meetings + if [[ -f /root/.fs_src ]] ; then + if [[ ! -f /usr/lib/freeswitch/mod/mod_conference ]] ; then + echo " Requires freeswitch mod_conference " + fi + else + apt-get -y --force-yes install freeswitch-mod-conferences + fi +fi + +if [[ $edit == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-edit +fi + +if [[ $exec == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-exec +fi + +if [[ $fax == "y" ]]; then + apt-get -y --force-yes install ghostscript libreoffice-common fusionpbx-app-fax +fi + +if [[ $fifo == "y" ]]; then + apt-get -y --force-yes install freeswitch-mod-fifo fusionpbx-app-fifo fusionpbx-app-fifo-list + if [[ -f /root/.fs_src ]] ; then + if [[ ! -f /usr/lib/freeswitch/mod/mod_fifo ]] ; then + echo " Requires freeswitch mod_fifo " + fi + else + apt-get -y --force-yes install freeswitch-mod-fifo + fi +fi + +if [[ $services == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-services +fi + +if [[ $traffic_graph == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-traffic-graph +fi diff --git a/debian/resources/postgres-client.sh b/debian/resources/postgres-client.sh new file mode 100644 index 0000000..51aa179 --- /dev/null +++ b/debian/resources/postgres-client.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +#send a message +echo "Install PostgreSQL Client" + +#Install postgres repo +lsb_release -c |grep -i jessie > /dev/null +if [ $? -eq 0 ]; then +cat > "/etc/apt/sources.list.d/pgsql-pgdg.list" << DELIM +deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main +DELIM +else +cat > "/etc/apt/sources.list.d/pgsql-pgdg.list" << DELIM +deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main +DELIM +fi + +#Postgres +echo "Install PostgreSQL and create the database and users\n" +for i in postgresql-client-9.5 php5-pgsql ;do sudo apt-get -y install --force-yes "${i}"; done diff --git a/debian/resources/postgres-server.sh b/debian/resources/postgres-server.sh new file mode 100644 index 0000000..f7d8887 --- /dev/null +++ b/debian/resources/postgres-server.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +#send a message +echo "Install PostgreSQL" + +#Install postgres repo +lsb_release -c |grep -i jessie > /dev/null +if [ $? -eq 0 ]; then +cat > "/etc/apt/sources.list.d/pgsql-pgdg.list" << DELIM +deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main +DELIM +else +cat > "/etc/apt/sources.list.d/pgsql-pgdg.list" << DELIM +deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main +DELIM +fi + +#update +apt-get update + +#generate a random password +password=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64) + +#Postgres +echo "Install PostgreSQL and create the database and users\n" +for i in postgresql-server-9.5 php5-pgsql ;do sudo apt-get -y install --force-yes "${i}"; done + + +################################################# +#Edit the freeswitch systemd toadd pgsql service +################################################# +sed -i /lib/systemd/system/freeswitch.service -e"s#After=syslog.target network.target local-fs.target#After=syslog.target network.target local-fs.target postgresql.service#" + +######################################### +#Edit pg_hba.conf to enable sections +######################################## +sed -i /etc/postgresql/9.5/main/pg_hba.conf -e 's#\#local#local#' +sed -i /etc/postgresql/9.5/main/pg_hba.conf -e 's#\#host#host#' + +#systemd +service postgresql restart + +#init.d +#/usr/sbin/service postgresql restart + +#add the databases, users and grant permissions to them +sudo -u postgres psql -c "CREATE DATABASE fusionpbx"; +sudo -u postgres psql -c "CREATE DATABASE freeswitch"; +sudo -u postgres psql -c "CREATE ROLE fusionpbx WITH SUPERUSER LOGIN PASSWORD '$password';" +sudo -u postgres psql -c "CREATE ROLE freeswitch WITH SUPERUSER LOGIN PASSWORD '$password';" +sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE fusionpbx to fusionpbx;" +sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE freeswitch to fusionpbx;" +sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE freeswitch to freeswitch;" +#ALTER USER fusionpbx WITH PASSWORD 'newpassword'; + +#set the ip address +server_address=$(hostname -I) + +#Show database password +echo "" +echo "" +echo "PostgreSQL" +echo " Database name: fusionpbx" +echo " Database username: fusionpbx" +echo " Database password: $password" +echo "" \ No newline at end of file diff --git a/debian/resources/provision.sh b/debian/resources/provision.sh new file mode 100644 index 0000000..ebe6e5a --- /dev/null +++ b/debian/resources/provision.sh @@ -0,0 +1,58 @@ +#Selet What Phone Provision System to Install + +aastra="n" # : phone provisioning tool & templates for aastra phones +atcom="n" # : phone provisioning tool & templates for atcom phones +cisco="n" # : phone provisioning tool & templates for cisco phones +digium="n" # : phone provisioning tool & templates for digium phones +escene="n" # : phone provisioning tool & templates for escene phones +grandstream="n" # : phone provisioning tool & templates for grandstream phones +linksys="n" # : phone provisioning tool & templates for linksys phones +panasonic="n" # : phone provisioning tool & templates for panasonic phones +polycom="n" # : phone provisioning tool & templates for polycom phones +snom="n" # : provisioning tool & templates for snom phones +yealink="n" # : phone provisioning tool & templates for yealink phones + + +if [[ $aastra == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-devices fusionpbx-app-provision fusionpbx-provisioning-template-aastra && mkdir -p /etc/fusionpbx/resources/templates/provision && cp -rp /usr/share/examples/fusionpbx/resources/templates/provision/aastra /etc/fusionpbx/resources/templates/provision/ +fi + +if [[ $atcom == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-devices fusionpbx-app-provision fusionpbx-provisioning-template-atcom && mkdir -p /etc/fusionpbx/resources/templates/provision && cp -rp /usr/share/examples/fusionpbx/resources/templates/provision/atcom /etc/fusionpbx/resources/templates/provision/ +fi + +if [[ $cisco == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-devices fusionpbx-app-provision fusionpbx-provisioning-template-cisco && mkdir -p /etc/fusionpbx/resources/templates/provision && cp -rp /usr/share/examples/fusionpbx/resources/templates/provision/cisco /etc/fusionpbx/resources/templates/provision/ +fi + +if [[ $digium == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-devices fusionpbx-app-provision fusionpbx-provisioning-template-digium && mkdir -p /etc/fusionpbx/resources/templates/provision && cp -rp /usr/share/examples/fusionpbx/resources/templates/provision/grandstream /etc/fusionpbx/resources/templates/provision/ +fi + +if [[ $escene == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-devices fusionpbx-app-provision fusionpbx-provisioning-template-escene && mkdir -p /etc/fusionpbx/resources/templates/provision && cp -rp /usr/share/examples/fusionpbx/resources/templates/provision/grandstream /etc/fusionpbx/resources/templates/provision/ +fi + +if [[ $grandstream == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-devices fusionpbx-app-provision fusionpbx-provisioning-template-grandstream && mkdir -p /etc/fusionpbx/resources/templates/provision && cp -rp /usr/share/examples/fusionpbx/resources/templates/provision/grandstream /etc/fusionpbx/resources/templates/provision/ +fi + +if [[ $linksys == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-devices fusionpbx-app-provision fusionpbx-provisioning-template-linksys && mkdir -p /etc/fusionpbx/resources/templates/provision && cp -rp /usr/share/examples/fusionpbx/resources/templates/provision/linksys /etc/fusionpbx/resources/templates/provision/ +fi + +if [[ $panasonic == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-devices fusionpbx-app-provision fusionpbx-provisioning-template-panasonic && mkdir -p /etc/fusionpbx/resources/templates/provision && cp -rp /usr/share/examples/fusionpbx/resources/templates/provision/panasonic /etc/fusionpbx/resources/templates/provision/ +fi + +if [[ $polycom == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-devices fusionpbx-app-provision fusionpbx-provisioning-template-polycom && mkdir -p /etc/fusionpbx/resources/templates/provision && cp -rp /usr/share/examples/fusionpbx/resources/templates/provision/polycom /etc/fusionpbx/resources/templates/provision/ +fi + +if [[ $snom == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-devices fusionpbx-app-provision fusionpbx-provisioning-template-snom && mkdir -p /etc/fusionpbx/resources/templates/provision && cp -rp /usr/share/examples/fusionpbx/resources/templates/provision/snom /etc/fusionpbx/resources/templates/provision/ +fi + +if [[ $yealink == "y" ]]; then + apt-get -y --force-yes install fusionpbx-app-devices fusionpbx-app-provision fusionpbx-provisioning-template-yealink && mkdir -p /etc/fusionpbx/resources/templates/provision && cp -rp /usr/share/examples/fusionpbx/resources/templates/provision/yealink /etc/fusionpbx/resources/templates/provision/ +fi diff --git a/debian/resources/switch/package-release.sh b/debian/resources/switch/package-release.sh index adcde0a..a440e86 100644 --- a/debian/resources/switch/package-release.sh +++ b/debian/resources/switch/package-release.sh @@ -1,5 +1,18 @@ #!/bin/sh -apt-get update && apt-get install -y --force-yes curl memcached haveged +( +#Used for pkg based installs for cp the base configs into place +fs_conf_dir="/etc/freeswitch" +fs_dflt_conf_dir="/usr/share/freeswitch/conf" + +# Set what language lang/say pkgs and language sound files to use. ( Only if pkgs install is selected ) +# en-ca=English/CA en-us=English/US (default) fr-ca=French/Canadian pt-br=Portuguese/Brazill +# ru-ru=Russian/Russia sv-se=Swedish/Sweden zh-cn=chinese/Mandarin zh-hk=chinese/HongKong +freeswitch_sounds_language="en-us" #Currently other sounds dont exist. + +#Pre Deps +apt-get update && apt-get install -y --force-yes sqlite3 unixodbc uuid memcached libtiff5 libtiff-tools time bison htop screen libpq5 lame curl haveged + +#Repos USE_UNOFFICIAL_ARM_REPO=0 arch=$(uname -m) if [ $arch = 'armv7l' ] && [ $USE_UNOFFICIAL_ARM_REPO -eq 1 ]; then @@ -9,45 +22,71 @@ else echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list curl http://files.freeswitch.org/repo/deb/freeswitch-1.6/key.gpg | apt-key add - fi -apt-get update -apt-get install -y --force-yes gdb -apt-get install -y --force-yes freeswitch-meta-bare freeswitch-conf-vanilla freeswitch-systemd freeswitch-mod-commands freeswitch-meta-codecs freeswitch-mod-console freeswitch-mod-logfile freeswitch-mod-distributor -apt-get install -y --force-yes freeswitch-lang-en freeswitch-mod-say-en freeswitch-sounds-en-us-callie freeswitch-music-default -apt-get install -y --force-yes freeswitch-mod-enum freeswitch-mod-cdr-csv freeswitch-mod-event-socket freeswitch-mod-sofia freeswitch-mod-sofia-dbg freeswitch-mod-loopback -apt-get install -y --force-yes freeswitch-mod-conference freeswitch-mod-db freeswitch-mod-dptools freeswitch-mod-expr freeswitch-mod-fifo libyuv-dev freeswitch-mod-httapi -apt-get install -y --force-yes freeswitch-mod-hash freeswitch-mod-esl freeswitch-mod-esf freeswitch-mod-fsv freeswitch-mod-valet-parking freeswitch-mod-dialplan-xml freeswitch-dbg -apt-get install -y --force-yes freeswitch-mod-sndfile freeswitch-mod-native-file freeswitch-mod-local-stream freeswitch-mod-tone-stream freeswitch-mod-lua freeswitch-meta-mod-say -apt-get install -y --force-yes freeswitch-mod-xml-cdr freeswitch-mod-verto freeswitch-mod-callcenter freeswitch-mod-rtc freeswitch-mod-png freeswitch-mod-json-cdr freeswitch-mod-shout -apt-get install -y --force-yes freeswitch-mod-skypopen freeswitch-mod-skypopen-dbg freeswitch-mod-sms freeswitch-mod-sms-dbg freeswitch-mod-cidlookup freeswitch-mod-memcache -apt-get install -y --force-yes freeswitch-mod-imagick freeswitch-mod-tts-commandline freeswitch-mod-directory freeswitch-mod-flite -#make sure that postgresql is started before starting freeswitch -sed -i /lib/systemd/system/freeswitch.service -e s:'local-fs.target:local-fs.target postgresql.service:' +#Freeswitch Pkgs +apt-get install -y libfreeswitch1 freeswitch freeswitch-mod-curl freeswitch-systemd freeswitch-mod-db freeswitch-doc \ + freeswitch-mod-distributor freeswitch-mod-dptools freeswitch-mod-enum freeswitch-mod-esf freeswitch-mod-esl \ + freeswitch-mod-expr freeswitch-mod-fsv freeswitch-mod-hash freeswitch-mod-memcache freeswitch-mod-portaudio \ + freeswitch-mod-portaudio-stream freeswitch-mod-spandsp freeswitch-mod-spy freeswitch-mod-translate \ + freeswitch-mod-valet-parking freeswitch-mod-flite freeswitch-mod-pocketsphinx freeswitch-mod-tts-commandline \ + freeswitch-mod-dialplan-xml freeswitch-mod-loopback freeswitch-mod-sofia freeswitch-mod-event-multicast \ + freeswitch-mod-event-socket freeswitch-mod-local-stream freeswitch-mod-native-file freeswitch-mod-sndfile \ + freeswitch-mod-tone-stream freeswitch-mod-lua freeswitch-mod-console freeswitch-mod-logfile freeswitch-mod-syslog \ + freeswitch-mod-say-en freeswitch-mod-posix-timer freeswitch-mod-timerfd freeswitch-mod-xml-cdr freeswitch-mod-shout\ + freeswitch-mod-xml-curl freeswitch-mod-xml-rpc freeswitch-conf-vanilla freeswitch-mod-vlc freeswitch-mod-verto \ + freeswitch-mod-sms freeswitch-timezones freeswitch-mod-bert freeswitch-mod-basic freeswitch-mod-lcr freeswitch-mod-rtc \ + freeswitch-mod-commands freeswitch-mod-csv -#set the file permissions -mkdir /usr/share/freeswitch/scripts -chmod g+ws /usr/share/freeswitch/scripts +#setup language / sound files for use +#if [[ $freeswitch_sounds_language == "en-ca" ]]; then +# apt-get -y install --force-yes freeswitch-lang-en freeswitch-mod-say-en freeswitch-sounds-en-ca-june +#fi -chown -R freeswitch:freeswitch /var/lib/freeswitch -chmod -R g+s /var/lib/freeswitch -setfacl -R -m u:www-data:rwx,g:www-data:rwx /var/lib/freeswitch -setfacl -R -d -m u:www-data:rwx,g:www-data:rwx /var/lib/freeswitch +if [[ $freeswitch_sounds_language == "en-us" ]]; then + apt-get -y install freeswitch-lang-en freeswitch-mod-say-en freeswitch-sounds-en-us-callie freeswitch-music-default +fi -chown -R freeswitch:freeswitch /usr/share/freeswitch -chmod -R g+s /usr/share/freeswitch -setfacl -R -m u:www-data:rwx,g:www-data:rwx /usr/share/freeswitch -setfacl -R -d -m u:www-data:rwx,g:www-data:rwx /usr/share/freeswitch +#if [[ $freeswitch_sounds_language == "fr-ca" ]]; then +# apt-get -y install --force-yes freeswitch-lang-fr freeswitch-mod-say-fr freeswitch-sounds-fr-ca-june +#fi +# +#if [[ $freeswitch_sounds_language == "pt-br" ]]; then +# apt-get -y install --force-yes freeswitch-lang-pt freeswitch-mod-say-pt freeswitch-sounds-pt-br-karina +#fi +# +#if [[ $freeswitch_sounds_language == "ru-ru" ]]; then +# apt-get -y install --force-yes freeswitch-lang-ru freeswitch-mod-say-ru freeswitch-sounds-ru-ru-elena +#fi +# +#if [[ $freeswitch_sounds_language == "sv-se" ]]; then +# apt-get -y install --force-yes freeswitch-lang-sv freeswitch-mod-say-sv freeswitch-sounds-sv-se-jakob +#fi -chown -R freeswitch:freeswitch /etc/freeswitch -chmod -R g+s /etc/freeswitch -setfacl -R -m u:www-data:rwx,g:www-data:rwx /etc/freeswitch -setfacl -R -d -m u:www-data:rwx,g:www-data:rwx /etc/freeswitch +#if [[ $freeswitch_sounds_language == "zh-cn" ]]; then +# apt-get -y install --force-yes freeswitch-mod-say-zh freeswitch-sounds-zh-cn-sinmei +#fi -chown -R freeswitch:freeswitch /var/log/freeswitch -setfacl -R -m u:www-data:rwx,g:www-data:rwx /var/log/freeswitch -setfacl -R -d -m u:www-data:rwx,g:www-data:rwx /var/log/freeswitch +#if [[ $freeswitch_sounds_language == "zh-hk" ]]; then +# apt-get -y install --force-yes freeswitch-mod-say-zh freeswitch-sounds-zh-hk-sinmei +#fi -chown -R freeswitch:freeswitch /usr/share/freeswitch/sounds -chmod -R g+s /usr/share/freeswitch/sounds -setfacl -R -m u:www-data:rwx,g:www-data:rwx /usr/share/freeswitch/sounds -setfacl -R -d -m u:www-data:rwx,g:www-data:rwx /usr/share/freeswitch/sounds +# make the freeswitch conf dir +mkdir -p "$fs_conf_dir" + +#cp the default configs into place. +cp -rp "$fs_dflt_conf_dir"/vanilla/* "$fs_conf_dir" + +#fix ownership of files for freeswitch +chown -R freeswitch:freeswitch "$fs_conf_dir" + +#Adding users to needed groups +adduser freeswitch www-data +adduser freeswitch dialout + +#Restarting freeswitch +service freeswitch restart + +#cleanup +apt-get clean + +) | tee ~/freeswitch-install.log \ No newline at end of file diff --git a/debian/resources/switch/source-release.sh b/debian/resources/switch/source-release.sh index 92db7da..47a8eb5 100644 --- a/debian/resources/switch/source-release.sh +++ b/debian/resources/switch/source-release.sh @@ -26,7 +26,7 @@ sed -i /usr/src/freeswitch/modules.conf -e s:'#applications/mod_curl:application sed -i /usr/src/freeswitch/modules.conf -e s:'#formats/mod_shout:formats/mod_shout:' #./configure --help #./configure --prefix=/usr/local/freeswitch --enable-core-pgsql-support --enable-system-lua --disable-fhs -./configure --prefix=/usr/local/freeswitch --enable-core-pgsql-support --disable-fhs +./configure --prefix=/usr/local/freeswitch --enable-core-pgsql-support #make mod_shout-install make rm -rf /usr/local/freeswitch/{lib,mod,bin}/*