Skip to content

Instantly share code, notes, and snippets.

@andibastian
Last active May 8, 2020 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andibastian/83a8be31c9088ea13dadd1a3c723ad2c to your computer and use it in GitHub Desktop.
Save andibastian/83a8be31c9088ea13dadd1a3c723ad2c to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Download modul asterisk..";
cd /usr/src && wget https://src.fedoraproject.org/lookaside/pkgs/iksemel/iksemel-1.4.tar.gz/532e77181694f87ad5eb59435d11c1ca/iksemel-1.4.tar.gz && tar xf iksemel-*.tar.gz && cd iksemel-* && ./configure && make && make install
echo "Add User asterisk ..";
adduser asterisk -m -c "Asterisk User"
echo "Download & Install module basic asterisk ..";
cd /usr/src && wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz && wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz && wget https://src.fedoraproject.org/lookaside/pkgs/spandsp/spandsp-0.0.6.tar.gz/897d839516a6d4edb20397d4757a7ca3/spandsp-0.0.6.tar.gz && wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz && wget -O jansson.tar.gz https://github.com/akheron/jansson/archive/v2.7.tar.gz && wget http://www.pjsip.org/release/2.4/pjproject-2.4.tar.bz2
cd /usr/src && tar xvfz dahdi-linux-complete-current.tar.gz && tar xvfz libpri-current.tar.gz && rm -f dahdi-linux-complete-current.tar.gz libpri-current.tar.gz && cd dahdi-linux-complete-* && make all && make install && make config && cd /usr/src/libpri-* && make && make install
cd /usr/src && tar -xjvf pjproject-2.4.tar.bz2 && rm -f pjproject-2.4.tar.bz2 && cd pjproject-2.4 && CFLAGS='-DPJ_HAS_IPV6=1' ./configure --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr --libdir=/usr/lib64 && make dep && make && make install
cd /usr/src && tar vxfz jansson.tar.gz && rm -f jansson.tar.gz && cd jansson-* && autoreconf -i && ./configure --libdir=/usr/lib64 && make && make install
cd /usr/src && tar -xzf spandsp-0.0.6.tar.gz && cd spandsp-0.0.6 && ./configure --libdir=/usr/lib64 && make && make install
echo "Download & Install SRTP"
cd /usr/src && wget https://downloads.sourceforge.net/project/srtp/srtp/1.4.4/srtp-1.4.4.tgz && tar zxvf srtp-1.4.4.tgz && cd srtp && ./configure CFLAGS=-fPIC --prefix=/usr/local/lib && make
echo "Update Line 7 file SRTP - RTPW"
#Change line 7 of test/rtpw_test.sh to RTPW=./rtpw
sed -i 's/rtpw/.\/rtpw/' test/rtpw_test.sh
echo "Runtest & install SRTP"
make runtest && make install
echo "Download Asterisk Core"
cd /usr/src && tar xvfz asterisk-13-current.tar.gz && rm -f asterisk-13-current.tar.gz
echo "Install Prereq asterisk"
cd asterisk-* && contrib/scripts/install_prereq install
echo "Configure asterisk"
./configure --with-pjproject-bundled --libdir=/usr/lib64 --with-srtp=/usr/local/lib
echo "Download MP3"
contrib/scripts/get_mp3_source.sh
echo "Pilih menu"
make menuselect
echo "Install asterisk ......."
make && make install && make config && ldconfig
echo "Download & extract module sound.."
mkdir -p /var/lib/asterisk/sounds && cd /var/lib/asterisk/sounds && wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en-wav-current.tar.gz && wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz && tar xvf asterisk-core-sounds-en-wav-current.tar.gz && rm -f asterisk-core-sounds-en-wav-current.tar.gz && tar xfz asterisk-extra-sounds-en-wav-current.tar.gz && rm -f asterisk-extra-sounds-en-wav-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en-g722-current.tar.gz && wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-g722-current.tar.gz && tar xfz asterisk-core-sounds-en-g722-current.tar.gz && rm -f asterisk-core-sounds-en-g722-current.tar.gz && tar xfz asterisk-extra-sounds-en-g722-current.tar.gz && rm -f asterisk-extra-sounds-en-g722-current.tar.gz
echo "Set ownership"
chown asterisk. /var/run/asterisk && chown -R asterisk. /etc/asterisk && chown -R asterisk. /var/{lib,log,spool}/asterisk && chown -R asterisk. /usr/lib64/asterisk && chown -R asterisk. /var/www/
echo "Modifikasi PHP"
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php.ini && sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/httpd/conf/httpd.conf && sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf && service httpd restart
echo "Downlaod & install Freepbx"
cd /usr/src && wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-13.0-latest.tgz
tar xfz freepbx-13.0-latest.tgz && rm -f freepbx-13.0-latest.tgz && cd freepbx && ./start_asterisk start && ./install -n
echo "Update REPO & Install PHP zend guard"
wget -P /etc/yum.repos.d/ -N http://yum.schmoozecom.net/schmooze-commercial/schmooze-commercial.repo
yum clean all
yum -y install php-5.3-zend-guard-loader sysadmin fail2ban incron ImageMagick
/var/lib/asterisk/bin/freepbx_setting MODULE_REPO http://mirror1.freepbx.org,http://mirror2.freepbx.org
echo "Restart HTTPD"
service httpd restart
echo "Run Fwconsole"
fwconsole ma download sysadmin && fwconsole ma install sysadmin
echo "Terakhir, install mod_ssl"
yum install -y mod_ssl
echo "Set permission"
fwconsole restart
fwconsole ma downloadinstall userman
fwconsole ma downloadinstall ucp
fwconsole ma downloadinstall webrtc
fwconsole chown
fwconsole reload
echo "Finish.. enjoy your stressss"
#chown asterisk. /var/log/asterisk/freepbx_security.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment