setenforce 0
DATABASE_PASS=PASSWORD
systemctl stop iptables
systemctl disable iptables
echo "[irontec]" >> /etc/yum.repos.d/irontec.repo
echo "name=Irontec RPMs repository" >> /etc/yum.repos.d/irontec.repo
echo "baseurl=http://packages.irontec.com/centos/\$releasever/\$basearch/" >> /etc/yum.repos.d/irontec.repo
rpm --import http://packages.irontec.com/public.key
yum install -y epel-release  >> /var/log/astinstall
yum install -y wget vim bind-utils iptables-utils iptables-services sngrep expect MySQL-python libiodbc python-pip mysql-connector-odbc cyrus-sasl cyrus-sasl-devel cyrus-sasl-lib dnstop freetds freetds-devel gmime gmime-devel iftop iksemel iksemel-devel ipset ipset-libs iputils jack-audio-connection-kit jack-audio-connection-kit-devel jansson jansson-devel json-c kernel-devel kernel-headers kernel-tools kernel-tools-libs libgcrypt libgcrypt-devel libical libical-devel libjpeg-turbo libnetfilter_conntrack liboath libogg libogg-devel libpcap libresample libresample-devel libraw1394 libsamplerate libsrtp libsrtp-devel libtiff libtiff-devel mariadb mariadb-devel mariadb-libs mariadb-server mlocate mysql-connector-python nano ncurses ncurses-base ncurses-devel ncurses-libs net-snmp-agent-libs net-snmp-devel net-snmp-libs net-tools oathtool ntpdate ntp openldap openldap-devel openssl openssl-devel openssl-libs openssl-perl opus pam_oath pcre pcre-devel perl perl-Authen-Captcha perl-Authen-Credential perl-Authen-DigestMD5 perl-Authen-PAM perl-Authen-SASL perl-Authen-Simple perl-Authen-Simple-Passwd perl-B-Hooks-EndOfScope perl-Business-ISBN perl-Business-ISBN-Data perl-CPAN perl-Carp perl-Class-Accessor perl-Class-Data-Inheritable perl-Class-Load perl-Compress-Raw-Bzip2 perl-Compress-Raw-Zlib perl-Crypt-PasswdMD5 perl-Crypt-SSLeay perl-DBD-MySQL perl-DBI perl-Data-Dumper perl-Data-OptList perl-Devel-GlobalDestruction perl-Devel-PartialDump perl-Digest perl-Digest-HMAC perl-Digest-MD5 perl-Digest-SHA perl-Digest-SHA1 perl-Dist-CheckConflicts perl-Encode perl-Encode-Locale perl-Error perl-Eval-Closure perl-Exporter perl-ExtUtils-Install perl-ExtUtils-MakeMaker perl-ExtUtils-Manifest perl-ExtUtils-ParseXS perl-File-Listing perl-File-Path perl-File-Temp perl-Filter perl-GD perl-GSSAPI perl-Getopt-Long perl-Git perl-HTML-Parser perl-HTML-Tagset perl-HTTP-Cookies perl-HTTP-Daemon perl-HTTP-Date perl-HTTP-Message perl-HTTP-Negotiate perl-HTTP-Tiny perl-IO-Compress perl-IO-HTML perl-IO-Socket-IP perl-IO-Socket-SSL perl-LWP-Authen-Negotiate perl-LWP-MediaTypes perl-LWP-Protocol-https perl-List-MoreUtils perl-MRO-Compat perl-Module-Implementation perl-Module-Runtime perl-Moose perl-Mozilla-CA perl-Net-Daemon perl-Net-HTTP perl-Net-LibIDN perl-Net-SSLeay perl-No-Worries perl-Package-DeprecationManager perl-Package-Generator perl-Package-Stash perl-Package-Stash-XS perl-Params-Util perl-Params-Validate perl-PathTools perl-PlRPC perl-Pod-Escapes perl-Pod-Perldoc perl-Pod-Simple perl-Pod-Usage perl-Scalar-List-Utils perl-Socket perl-Storable perl-String-Random perl-Sub-Exporter perl-Sub-Exporter-Progressive perl-Sub-Install perl-Sub-Name perl-Sys-Syslog perl-TermReadKey perl-Test-Harness perl-Text-ParseWords perl-Text-Unidecode perl-Thread-Queue perl-Time-HiRes perl-Time-Local perl-TimeDate perl-Try-Tiny perl-URI perl-Variable-Magic perl-WWW-Curl perl-WWW-RobotRules perl-XML-Parser perl-constant perl-devel perl-libintl perl-libs perl-libwww-perl perl-local-lib perl-macros perl-namespace-clean perl-parent perl-podlators perl-srpm-macros perl-threads perl-threads-shared perltidy php-common php-mysql php-pdo pjproject pjproject-devel popt popt-devel portaudio portaudio-devel postfix postgresql postgresql-devel postgresql-libs python python-IPy python-backports python-backports-ssl_match_hostname python-boto python-chardet python-cheetah python-configobj python-decorator python-iniparse python-jsonpatch python-jsonpointer python-kitchen python-libs python-markdown python-perf python-pillow python-prettytable python-pyasn1 python-pycurl python-pygments python-pyudev python-requests python-setuptools python-six python-slip python-slip-dbus python-urlgrabber python-urllib3 python2-rsa rsync rsyslog rsyslog-mysql sox spandsp spandsp-devel speex speex-devel sqlite sqlite-devel sqlite2 sqlite2-devel subversion subversion-libs tcpdump telnet texinfo traceroute unixODBC unixODBC-devel unzip yum-cron yum-metadata-parser yum-plugin-fastestmirror yum-utils zip zlib zlib-devel gcc gcc-c++ php-xml php php-mysql php-pear php-mbstring mariadb-devel mariadb-server mariadb sqlite-devel lynx bison gmime-devel psmisc tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel uuid-devel libtool libuuid-devel subversion kernel-devel kernel-devel-$(uname -r) git subversion kernel-devel php-process crontabs cronie cronie-anacron libvorbis-devel neon neon-devel libtool-ltdl-devel corosynclib corosync openldap-devel gmime22-devel gmime sqlite2-devel mysql-devel bluez-libs-devel jack-audio-connection-kit-devel gsm-devel libedit-devel libuuid-devel libsqlite3x-devel radiusclient-ng-devel portaudio-devel postgresql-devel libresample-devel neon-devel libical-devel spandsp-devel freetds-devel net-snmp-devel iksemel-devel corosynclib-devel newt-devel popt-devel libtool-ltdl-devel lua-devel automake gcc gcc-c++ ncurses-devel openssl-devel libxml2-devel unixODBC-devel libcurl-devel libogg-devel libvorbis-devel speex-devel curl-devel net-snmp-devel neon-devel sendmail mysql-server xinted ntp ntpdate libical-devel iksemel-devel libxml2-devel ncurses-devel subversion doxygen texinfo sqlite-devel mlocate man gcc-c++ make gnutls-devel kernel-devel >> /var/log/astinstall
yum update -y >> /var/log/astinstall
pip install --upgrade pip

cd /root
rm -rf asterisk

rm -f /var/log/astinstall
mkdir asterisk
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz >> /var/log/astinstall
#wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-2.11.1+2.11.1.tar.gz >> /var/log/astinstall
#tar -xf dahdi-linux-complete-2.11.1+2.11.1.tar.gz >> /var/log/astinstall
tar -xf asterisk-13-current.tar.gz --strip 1 -C asterisk >> /var/log/astinstall
sed -i -e 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/sysconfig/selinux >> /var/log/astinstall
sed -i -e 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config >> /var/log/astinstall
#service asterisk stop >> /var/log/astinstall
#service iptables stop >> /var/log/astinstall

systemctl enable mariadb
systemctl start mariadb

#cd /root/dahdi-linux-complete-2.11.1+2.11.1
#make >> /var/log/astinstall
#make install >> /var/log/astinstall
#make config >> /var/log/astinstall
#systemctl enable dahdi >> /var/log/astinstall
cd /root/asterisk
./contrib/scripts/install_prereq install >> /var/log/astinstall
./configure --libdir=/usr/lib64 --with-pjproject-bundled >> /var/log/astinstall
make menuselect.makeopts
menuselect/menuselect --enable streamplayer --enable stereorize --enable smsq --enable astman --enable aelparse --enable app_alarmreceiver --enable app_amd --enable app_chanisavail --enable res_fax --enable res_fax_spandsp --enable app_dictate --enable app_festival --enable app_image --enable app_morsecode --enable app_sms --enable app_url --enable app_waitforring --enable app_waitforsilence --enable app_ices --enable res_mwi_external --enable cdr_pgsql --enable cdr_csv --enable cdr_odbc --enable chan_alsa --enable chan_console --enable chan_mgcp --enable chan_oss --enable chan_phone --enable chan_sip --enable chan_skinny --enable chan_unistim --enable format_vox --enable pbx_realtime --enable pbx_lua --enable pbx_dundi --enable pbx_ael --enable res_mwi_external --enable odbc_storage  --enable res_mwi_external_ami --enable chan_mobile --enable chan_ooh323 --enable format_mp3 --enable res_config_mysql --enable res_corosync --enable res_endpoint_stats --enable ODBC_STORAGE --enable aelparse --enable astman --enable check_expr --enable check_expr2 --enable conf2ael --enable muted --enable smsq --enable stereorize --enable streamplayer --enable CORE-SOUNDS-EN-WAV --enable CORE-SOUNDS-EN-ULAW --enable CORE-SOUNDS-EN-ALAW --enable CORE-SOUNDS-EN-G729 --enable CORE-SOUNDS-EN-G722 --enable CORE-SOUNDS-EN-SLN16 --enable CORE-SOUNDS-EN-SIREN7 --enable CORE-SOUNDS-EN-SIREN14 --enable MOH-OPSOUND-ULAW --enable MOH-OPSOUND-ALAW --enable MOH-OPSOUND-GSM --enable MOH-OPSOUND-G729 --enable MOH-OPSOUND-G722 --enable MOH-OPSOUND-SLN16 --enable MOH-OPSOUND-SIREN7 --enable MOH-OPSOUND-SIREN14 --enable EXTRA-SOUNDS-EN-WAV --enable EXTRA-SOUNDS-EN-ULAW --enable EXTRA-SOUNDS-EN-ALAW --enable EXTRA-SOUNDS-EN-GSM --enable EXTRA-SOUNDS-EN-G729 --enable EXTRA-SOUNDS-EN-G722 --enable EXTRA-SOUNDS-EN-SLN16 --enable EXTRA-SOUNDS-EN-SIREN7 --enable EXTRA-SOUNDS-EN-SIREN14 >> /var/log/astinstall
./contrib/scripts/get_mp3_source.sh
make >> /var/log/astinstall
make install >> /var/log/astinstall
make progdocs >> /var/log/astinstall
make samples >> /var/log/astinstall
make config >> /var/log/astinstall
systemctl enable asterisk >> /var/log/astinstall
pip install alembic
mysqladmin -u root create astpbx
mysqladmin -u root password "$DATABASE_PASS"
mysql -u root -p"$DATABASE_PASS" -e "UPDATE mysql.user SET Password=PASSWORD('$DATABASE_PASS') WHERE User='root'"
mysql -u root -p"$DATABASE_PASS" -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')"
mysql -u root -p"$DATABASE_PASS" -e "DELETE FROM mysql.user WHERE User=''"
mysql -u root -p"$DATABASE_PASS" -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%'"
mysql -u root -p"$DATABASE_PASS" -e "FLUSH PRIVILEGES"
cd contrib/ast-db-manage/
cp config.ini.sample config.ini
cp voicemail.ini.sample voicemail.ini
cp cdr.ini.sample cdr.ini
sed -i -e 's/sqlalchemy.url = mysql:\/\/user:pass@localhost\/asterisk/sqlalchemy.url = mysql:\/\/root:'$DATABASE_PASS'@localhost\/astpbx/g' /root/asterisk/contrib/ast-db-manage/config.ini
sed -i -e 's/sqlalchemy.url = mysql:\/\/user:pass@localhost\/voicemail/sqlalchemy.url = mysql:\/\/root:'$DATABASE_PASS'@localhost\/astpbx/g' /root/asterisk/contrib/ast-db-manage/voicemail.ini
sed -i -e 's/sqlalchemy.url = mysql:\/\/user:pass@localhost\/cdr/sqlalchemy.url = mysql:\/\/root:'$DATABASE_PASS'@localhost\/astpbx/g' /root/asterisk/contrib/ast-db-manage/cdr.ini
alembic -c config.ini upgrade head
alembic -c voicemail.ini upgrade head
alembic -c cdr.ini upgrade head
mysql -u root -p"$DATABASE_PASS" -e "ALTER TABLE \`astpbx\`.\`ps_transports\` CHANGE COLUMN \`local_net\` \`local_net\` VARCHAR(200)"

touch /etc/odbc.ini
echo "[asterisk-connector]" >> /etc/odbc.ini
echo "Description = MySQL connection to 'asterisk' database" >> /etc/odbc.ini
echo "Driver = MySQL" >> /etc/odbc.ini
echo "Database = astpbx" >> /etc/odbc.ini
echo "Server = localhost" >> /etc/odbc.ini
echo "Port = 3306" >> /etc/odbc.ini
echo "Socket = /var/lib/mysql/mysql.sock" >> /etc/odbc.ini

mv /etc/asterisk/res_odbc.conf /etc/asterisk/res_odbc.conf.bak
touch /etc/asterisk/res_odbc.conf
echo "[ENV]" >> /etc/asterisk/res_odbc.conf
echo "[asterisk]" >> /etc/asterisk/res_odbc.conf
echo "enabled = yes" >> /etc/asterisk/res_odbc.conf
echo "dsn => asterisk-connector" >> /etc/asterisk/res_odbc.conf
echo "username => root" >> /etc/asterisk/res_odbc.conf
echo "password => " $DATABASE_PASS >> /etc/asterisk/res_odbc.conf
echo "pre-connect => yes" >> /etc/asterisk/res_odbc.conf
echo "sanitysql => select 1" >> /etc/asterisk/res_odbc.conf

mv /etc/asterisk/extconfig.conf /etc/asterisk/extconfig.conf.bak
touch /etc/asterisk/extconfig.conf
echo "[settings]" >> /etc/asterisk/extconfig.conf
echo "iaxusers => odbc,asterisk,iaxfriends" >> /etc/asterisk/extconfig.conf
echo "iaxpeers => odbc,asterisk,iaxfriends" >> /etc/asterisk/extconfig.conf
echo "iaxfriends => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo ";sippeers => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "ps_endpoints => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "ps_auths => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "ps_aors => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "ps_domain_aliases => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "ps_endpoint_id_ips => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "ps_globals => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "ps_transports => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "ps_systems => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "ps_subscription_persistence => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "ps_registrations => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "ps_contacts => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "voicemail => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "extensions => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "meetme => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "queues => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "queue_members => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "queue_rules => odbc,asterisk" >> /etc/asterisk/extconfig.conf
echo "followme => odbc,asterisk,followme" >> /etc/asterisk/extconfig.conf
echo "followme_numbers => odbc,asterisk,followme_numbers" >> /etc/asterisk/extconfig.conf
echo "musiconhold => odbc,asterisk" >> /etc/asterisk/extconfig.conf

mv /etc/asterisk/sorcery.conf /etc/asterisk/sorcery.conf.bak
touch /etc/asterisk/sorcery.conf
echo "[res_pjsip]" >> /etc/asterisk/sorcery.conf
echo "endpoint=realtime,ps_endpoints" >> /etc/asterisk/sorcery.conf
echo "auth=realtime,ps_auths" >> /etc/asterisk/sorcery.conf
echo "transport=realtime,ps_transports" >> /etc/asterisk/sorcery.conf
echo "aor=realtime,ps_aors" >> /etc/asterisk/sorcery.conf
echo "domain_alias=realtime,ps_domain_aliases" >> /etc/asterisk/sorcery.conf
echo "registrations=realtime,ps_registrations" >> /etc/asterisk/sorcery.conf
echo "contact=realtime,ps_contacts" >> /etc/asterisk/sorcery.conf
echo "subrcription=realtime,ps_subscription_persistence" >> /etc/asterisk/sorcery.conf
echo "[res_pjsip_endpoint_identifier_ip]" >> /etc/asterisk/sorcery.conf
echo "identify=realtime,ps_endpoint_id_ips" >> /etc/asterisk/sorcery.conf
echo "system=realtime,ps_systems" >> /etc/asterisk/sorcery.conf

echo 'preload => res_odbc.so' >> /etc/asterisk/modules.conf
echo 'preload => res_config_odbc.so' >> /etc/asterisk/modules.conf
echo 'noload => chan_alsa.so' >> /etc/asterisk/modules.conf
echo 'noload => res_config_mysql.so' >> /etc/asterisk/modules.conf
echo 'noload => res_config_ldap.so' >> /etc/asterisk/modules.conf
echo 'noload => res_config_pgsql.so' >> /etc/asterisk/modules.conf
echo 'noload => chan_skinny.so' >> /etc/asterisk/modules.conf
echo 'noload => chan_mobile.so' >> /etc/asterisk/modules.conf
echo 'noload => chan_sip.so' >> /etc/asterisk/modules.conf

mysql -u root -p"$DATABASE_PASS" -e "INSERT INTO \`astpbx\`.\`ps_transports\` (\`id\`, \`async_operations\`, \`bind\`, \`ca_list_file\`, \`cert_file\`, \`cipher\`, \`domain\`, \`external_media_address\`, \`external_signaling_address\`, \`external_signaling_port\`, \`method\`, \`local_net\`, \`password\`, \`priv_key_file\`, \`protocol\`, \`require_client_cert\`, \`verify_client\`, \`verify_server\`, \`tos\`, \`cos\`, \`allow_reload\`) VALUES ('nat_udp', NULL, '0.0.0.0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '10.200.100.0/24,10.200.101.0/24', NULL, NULL, 'udp', NULL, NULL, NULL, NULL, NULL, 'yes')"
mysql -u root -p"$DATABASE_PASS" -e "INSERT INTO \`astpbx\`.\`ps_aors\` (\`id\`, \`contact\`, \`default_expiration\`, \`mailboxes\`, \`max_contacts\`, \`minimum_expiration\`, \`remove_existing\`, \`qualify_frequency\`, \`authenticate_qualify\`, \`maximum_expiration\`, \`outbound_proxy\`, \`support_path\`, \`qualify_timeout\`, \`voicemail_extension\`) VALUES ('1506', NULL, NULL, NULL, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
mysql -u root -p"$DATABASE_PASS" -e "INSERT INTO \`astpbx\`.\`ps_auths\` (\`id\`, \`auth_type\`, \`nonce_lifetime\`, \`md5_cred\`, \`password\`, \`realm\`, \`username\`) VALUES ('phone', 'userpass', NULL, NULL, 'pass', NULL, 'voip')"
mysql -u root -p"$DATABASE_PASS" -e "INSERT INTO \`astpbx\`.\`ps_endpoints\` (\`id\`, \`transport\`, \`aors\`, \`auth\`, \`context\`, \`disallow\`, \`allow\`, \`direct_media\`, \`connected_line_method\`, \`direct_media_method\`, \`direct_media_glare_mitigation\`, \`disable_direct_media_on_nat\`, \`dtmf_mode\`, \`external_media_address\`, \`force_rport\`, \`ice_support\`, \`identify_by\`, \`mailboxes\`, \`moh_suggest\`, \`outbound_auth\`, \`outbound_proxy\`, \`rewrite_contact\`, \`rtp_ipv6\`, \`rtp_symmetric\`, \`send_diversion\`, \`send_pai\`, \`send_rpid\`, \`timers_min_se\`, \`timers\`, \`timers_sess_expires\`, \`callerid\`, \`callerid_privacy\`, \`callerid_tag\`, \`100rel\`, \`aggregate_mwi\`, \`trust_id_inbound\`, \`trust_id_outbound\`, \`use_ptime\`, \`use_avpf\`, \`media_encryption\`, \`inband_progress\`, \`call_group\`, \`pickup_group\`, \`named_call_group\`, \`named_pickup_group\`, \`device_state_busy_at\`, \`fax_detect\`, \`t38_udptl\`, \`t38_udptl_ec\`, \`t38_udptl_maxdatagram\`, \`t38_udptl_nat\`, \`t38_udptl_ipv6\`, \`tone_zone\`, \`language\`, \`one_touch_recording\`, \`record_on_feature\`, \`record_off_feature\`, \`rtp_engine\`, \`allow_transfer\`, \`allow_subscribe\`, \`sdp_owner\`, \`sdp_session\`, \`tos_audio\`, \`tos_video\`, \`sub_min_expiry\`, \`from_domain\`, \`from_user\`, \`mwi_from_user\`, \`dtls_verify\`, \`dtls_rekey\`, \`dtls_cert_file\`, \`dtls_private_key\`, \`dtls_cipher\`, \`dtls_ca_file\`, \`dtls_ca_path\`, \`dtls_setup\`, \`srtp_tag_32\`, \`media_address\`, \`redirect_method\`, \`set_var\`, \`cos_audio\`, \`cos_video\`, \`message_context\`, \`force_avp\`, \`media_use_received_transport\`, \`accountcode\`, \`media_encryption_optimistic\`, \`user_eq_phone\`, \`rpid_immediate\`, \`g726_non_standard\`, \`rtp_keepalive\`, \`rtp_timeout\`, \`rtp_timeout_hold\`, \`bind_rtp_to_media_address\`, \`voicemail_extension\`, \`mwi_subscribe_replaces_unsolicited\`, \`deny\`, \`permit\`, \`acl\`, \`contact_deny\`, \`contact_permit\`, \`contact_acl\`, \`subscribe_context\`, \`fax_detect_timeout\`, \`contact_user\`) VALUES ('1506', 'nat_udp', '1506', 'phone', 'ADMIN', 'all', 'ulaw', 'no', NULL, NULL, NULL, NULL, 'rfc4733', NULL, NULL, NULL, 'username', '1506', NULL, NULL, NULL, NULL, 'no', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '<1506> \"Jeff\"', NULL, NULL, NULL, 'yes', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1506', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"

init 6
