TrixboxInstall: a2b_trixbox_2.2_installer_FRESH.sh

File a2b_trixbox_2.2_installer_FRESH.sh, 5.1 kB (added by crshman, 1 year ago)
Line 
1 #!/bin/bash
2
3 echo 
4 echo
5 echo ===================================================
6 echo Install script for A2B 1.3 US ver. on Trixbox 2.2
7 echo
8 echo a2b_trixbox_2.2_installer_FRESH.sh
9 echo
10 echo Script for Trixbox Written by: Robert Navarro
11 echo eFireHost.com, Limited -- VoIP Division
12 echo ===================================================
13 echo 5/31/07
14 echo
15 echo
16 echo " ==================================================="
17 echo "| WARNING THIS SCRIPT IS FOR FRESH INSTALLS ONLY    |"
18 echo "|                                             |"
19 echo "| I CANNOT BE HELD RESPONSIBLE FOR DAMAGE CAUSED    |"
20 echo "| BY NOT HEEDING THIS WARNING!!!!             |"
21 echo " ==================================================="
22 echo Script will resume in 10 seconds
23 sleep 10
24
25 echo
26 echo "----------- Updating Trixbox: ----------"
27 echo
28
29 yum -y install tbm-GUIcore
30 yum -y update
31
32 echo
33 echo "----------- Backing Up Old Config: ----------"
34 echo
35
36 mv /var/www/html/a2billing/ /var/www/html/a2billing_old/
37 mv /var/www/html/a2customer/ /var/www/html/a2customer_old/
38 mv /var/lib/asterisk/agi-bin/a2billing.php /var/lib/asterisk/agi-bin/a2billing.php.bak
39 mv /var/lib/asterisk/agi-bin/libs_a2billing/ /var/lib/asterisk/agi-bin/libs_a2billing_old/
40 mv /etc/asterisk/additional_a2billing_iax.conf /etc/asterisk/additional_a2billing_iax.conf.bak
41 mv /etc/asterisk/additional_a2billing_sip.conf /etc/asterisk/additional_a2billing_sip.conf.bak
42 mv /etc/asterisk/a2billing.conf /etc/asterisk/a2billing.conf.bak
43
44 mysqldump -Q -uroot -ppassw0rd mya2billing > ~/mya2billing_1.2.3.sql
45 yes | mysqladmin drop  mya2billing -u root -ppassw0rd
46
47 echo
48 echo "----------- Installing PHP-PCNTL: ----------"
49 echo
50
51 cd /usr/local/src
52
53 wget http://dfn.dl.sourceforge.net/sourceforge/phprpms/php-pcntl-4.3.11-2.5.1.i386.rpm
54 rpm -iv php-pcntl-4.3.11-2.5.1.i386.rpm
55 rm -f php-pcntl-4.3.11-2.5.1.i386.rpm
56
57 echo
58 echo "----------- Fetching and Extracting A2B v1.3: ----------"
59 echo
60
61 cd /usr/local/src
62
63 wget http://a2billing.net/download.php?get=a2billing-v1-3-Beta.tar.gz
64 mv download.php?get=a2billing-v1-3-Beta.tar.gz a2billing-v1-3-Beta.tar.gz
65 tar zxfv a2billing-v1-3-Beta.tar.gz
66 rm -f a2billing-v1-3-Beta.tar.gz
67
68 echo
69 echo "----------- Installing the new Database ----------"
70 echo
71
72 cd 1.3.0-Beta/DataBase/mysql/Mysql-3.x_4.x/
73
74 echo "GRANT ALL PRIVILEGES ON *.* TO 'a2billinguser'@'localhost' IDENTIFIED BY 'a2billing' WITH GRANT OPTION;" | mysql -ppassw0rd
75 mysqladmin create mya2billing -u a2billinguser -pa2billing
76 mysql mya2billing -u a2billinguser -pa2billing < a2billing-mysql-schema-MYSQL.3.X-4.X_v1.3.0.sql
77
78 echo
79 echo "----------- Installing the new Web Interface ----------"
80 echo
81
82 cd ../../..
83
84 cp -fr ./A2Billing_UI /var/www/html/A2Billing_UI
85 cp -fr ./A2BCustomer_UI/ /var/www/html/A2BCustomer_UI
86
87 echo
88 echo "----------- Installing the default configuration file ----------"
89 echo
90
91 cp -fr a2billing.conf /etc/asterisk/a2billing.conf
92 sed -i '/postgres/s/dbtype/;dbtype/g' /etc/asterisk/a2billing.conf
93 sed -i '/mysql/s/;dbtype/dbtype/g' /etc/asterisk/a2billing.conf
94 sed -i '/manager_user/s/myasterisk/a2billinguser/g' /etc/asterisk/a2billing.conf
95 sed -i '/manager_secret/s/mycode/a2billing/g' /etc/asterisk/a2billing.conf
96
97 echo
98 echo "----------- Installing the AGI ----------"
99 echo
100
101 cd A2Billing_AGI
102
103 cp -fr a2billing.php /var/lib/asterisk/agi-bin/a2billing.php
104 cp -fr libs_a2billing /var/lib/asterisk/agi-bin
105
106 echo
107 echo "----------- Installing Extra Sounds ----------"
108 echo
109
110 cd ..
111 cd addons/sounds/
112
113 cp -fr * /var/lib/asterisk/sounds/
114
115 echo
116 echo "----------- Installing IAX and SIP conf Files ----------"
117 echo
118
119 cd /etc/asterisk/
120 touch additional_a2billing_iax.conf
121 touch additional_a2billing_sip.conf
122 touch extensions_a2billing.conf
123
124 chmod 666 /etc/asterisk/additional_a2billing_iax.conf
125 chmod 666 /etc/asterisk/additional_a2billing_sip.conf
126 chmod 666 /etc/asterisk/extensions_a2billing.conf
127
128 chown -R asterisk:asterisk /etc/asterisk/
129 chown -R asterisk:asterisk /var/www/html/
130 chown -R asterisk:asterisk /var/lib/asterisk/
131
132 echo
133 echo "----------- Registering IAX and SIP conf Files ----------"
134 echo
135
136 echo "#include additional_a2billing_sip.conf" >> /etc/asterisk/sip.conf
137 echo "#include additional_a2billing_iax.conf" >> /etc/asterisk/iax.conf
138 echo "#include extensions_a2billing.conf" >> /etc/asterisk/extensions_custom.conf
139
140 echo "
141 [a2billing]
142
143 exten => _X.,1,Answer
144 exten => _X.,n,Wait(1)
145 exten => _X.,n,DeadAGI(a2billing.php|1)
146 exten => _X.,n,Hangup
147 " >> /etc/asterisk/extensions_a2billing.conf
148
149 echo
150 echo "----------- Restarting some services: ----------"
151 echo
152
153 service httpd restart
154 service mysqld restart
155
156 echo
157 echo
158 echo ===============================================================
159 echo 
160 echo Script for Trixbox Written by: Robert Navarro
161 echo eFireHost.com, Limited -- VOIP Division
162 echo 
163 echo Congratulations! You have installed A2B v1.3
164 echo
165 echo -e "Dont forget to edit \"/etc/asterisk/a2billing.conf\" to your liking"
166 echo 
167 echo Go to your webrowser and enter: http://`ifconfig | awk '/inet addr:/ {print $2}' | awk '{split ($0,a,":"); print a[2]}' | awk '{split ($0,a,"127."); print a[1]}'`/A2Billing_UI/
168 echo -----------------------------------------------
169 echo


Google