-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathvoiz-install-issabel-000.sh
442 lines (362 loc) · 12.6 KB
/
voiz-install-issabel-000.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
#!/bin/bash
<<<<<<< Updated upstream:installVoizOnIssabel.sh
version=5.0
echo "Install voipiran VOIZ PBX"
echo "VOIPIRAN.io"
echo "VOIPIRAN VOIZ Version $version"
sleep 1
=======
function setversion()
{
version=5.2
>>>>>>> Stashed changes:voiz-install-issabel-000.sh
#Set VOIZ tag
file="/etc/voiz.conf"
if [ -f "$file" ]
then
#find version and replace
sed -i -e "s/.*version.*/version=$version/g" /etc/voiz.conf
else
cp voiz-installation/voiz.conf /etc
sed -i -e "s/.*version.*/version=$version/g" /etc/voiz.conf
fi
}
function install_sourecgaurdian()
{
###Install SourceGaurdian Files
cp sourceguardian/ixed.5.4.lin /usr/lib64/php/modules
cp sourceguardian/ixed.5.4ts.lin /usr/lib64/php/modules
cp /etc/php.ini /etc/php-old.ini
cp sourceguardian/php.ini /etc
}
function install_webmin()
{
###Install Webmin - 1.953-1
echo "------------Installing WEBMIN-----------------"
rpm -U rpms/webmin/webmin-1.984-1.noarch.rpm >/dev/null 2>&1
echo "**WEBMIN Util Installed." >> voiz-installation.log
}
function install_developer()
{
echo "------------Installing Issabel DEVELOPER-----------------"
rpm -U rpms/develop/issabel-developer-4.0.0-3.noarch.rpm >/dev/null 2>&1
echo "**Developer Module Installed." >> voiz-installation.log
}
function add_persian_sounds(){
###Install Persian Language Sounds - 4.2.0
echo "Add Persian Language"
sed -e "/language=pr/d" /etc/asterisk/sip_custom.conf > /etc/asterisk/sip_custom.conf.000 >/dev/null 2>&1
echo >> /etc/asterisk/sip_custom.conf.000
echo language=pr >> /etc/asterisk/sip_custom.conf.000
cp -f /etc/asterisk/sip_custom.conf.000 /etc/asterisk/sip_custom.conf
sed -e "/language=pr/d" /etc/asterisk/iax_custom.conf > /etc/asterisk/iax_custom.conf.000 >/dev/null 2>&1
echo >> /etc/asterisk/iax_custom.conf.000
echo language=pr >> /etc/asterisk/iax_custom.conf.000
cp -f /etc/asterisk/iax_custom.conf.000 /etc/asterisk/iax_custom.conf
#Add Say.conf
cp -rf persiansounds/say.conf /etc/asterisk
chmod 777 /etc/asterisk/say.conf
chown asterisk:asterisk /etc/asterisk/say.conf
#Add Perisan Sounds Folder
FILE=/var/lib/asterisk/sounds/pr
#if [ ! -d "$FILE" ]; then
yes | cp -ar persiansounds/pr/ /var/lib/asterisk/sounds
chmod -R 777 /var/lib/asterisk/sounds/pr
chown -R asterisk:asterisk /var/lib/asterisk/sounds/pr
#fi
echo "**Persian Sounds Added." >> voiz-installation.log
}
function add_vitenant_theme(){
echo "------------Installing VOIPIRAN Theme-----------------"
sleep 1
###Install RTL Theme Sounds - 4.2.0
#Add voiz Favicon
cp -f theme/favicon.ico /var/www/html
touch -r /var/www/html/*
#Installing Theme
cp -rf theme/vitenant /var/www/html/themes/
touch -r /var/www/html/themes/*
touch -r /var/www/html/themes/vitenant/*
#Setting DB (Set default language to Farsi)
#Set Persian Langugae and Theme as Default
if [ "$Lang" = "Persian" ]
then
sqlite3 /var/www/db/settings.db "update settings set value='fa' where key='language';"
sqlite3 /var/www/db/settings.db "update settings set value='vitenant' where key='theme';"
echo "**Persian Theme Added." >> voiz-installation.log
fi
if [ "$Lang" = "English" ]
then
sqlite3 /var/www/db/settings.db "update settings set value='en' where key='language';"
sqlite3 /var/www/db/settings.db "update settings set value='tenant' where key='theme';"
echo "**English Theme Added." >> voiz-installation.log
fi
}
function edit_issabel_modules(){
###Install ISSABEL Modules - 4.2.0
#Madules
mkdir /var/www/html/modules000 >/dev/null 2>&1
cp -rf /var/www/html/modules/* /var/www/html/modules000
#cp -avr issabelmodules/modules /var/www/html
yes | cp -arf issabelmodules/modules /var/www/html
touch -r /var/www/html/modules/*
chown -R asterisk:asterisk /var/www/html/modules/*
chown asterisk:asterisk /var/www/html/modules/
find /var/www/html/modules/ -exec touch {} \;
###Install Jalali Calendar - 4.2.0
#Calendar Shamsi(Added ver 8.0)
cp -f jalalicalendar/date.php /var/www/html/libs/
cp -f jalalicalendar/params.php /var/www/html/libs/
cp -rf jalalicalendar/JalaliJSCalendar /var/www/html/libs/
###Install Jalali Date Time Lib - 4.2.0
cp -avr asteriskjalalical/jalalidate/ /etc/asterisk
#Add Persian Language TEXT
mv /var/www/html/lang/fa.lang /var/www/html/lang/fa.lang.000
cp -rf issabelmodules/fa.lang /var/www/html/lang/
}
function downloadable_files(){
###Install Downloadable Files - 4.2.0
#copy Download Folder
cp -rf downloadable/download /var/www/html/
echo "**Downloadable Files Added." >> voiz-installation.log
}
function bulkdids(){
if [ ! -d "/var/www/html/admin/modules/bulkdids" ]; then
#BULK DIDs Module
yes | cp -rf issabelpbxmodules/bulkdids /var/www/html/admin/modules/
amportal a ma install bulkdids
fi
echo "**Bulk DIDs Module Added." >> voiz-installation.log
}
function bosssecretary(){
if [ ! -d "/var/www/html/admin/modules/bosssecretary" ]; then
#bosssecretary Module
yes | cp -rf issabelpbxmodules/bosssecretary /var/www/html/admin/modules/
amportal a ma install bosssecretary
fi
echo "**Boss Secretary Module Added." >> voiz-installation.log
}
function superfecta(){
if [ ! -d "/var/www/html/admin/modules/superfecta" ]; then
#superfecta Module
yes | cp -rf issabelpbxmodules/superfecta /var/www/html/admin/modules/
amportal a ma install superfecta
fi
echo "**Supper Fecta Module Added." >> voiz-installation.log
}
function featurecodes(){
cp -rf customdialplan/extensions_voipiran_featurecodes.conf /etc/asterisk/
sed -i '/\[from\-internal\-custom\]/a include \=\> voipiran\-features' /etc/asterisk/extensions_custom.conf
echo "" >> /etc/asterisk/extensions_custom.conf
echo "#include extensions_voipiran_featurecodes.conf" >> /etc/asterisk/extensions_custom.conf
query="insert into featurecodes (modulename,featurename,description,defaultcode,customcode,enabled,providedest) VALUES('core','Say-DATETIME-Jalali','VOIZ-بیان تاریخ و زمان شمسی','*200',NULL,'1','1') ON DUPLICATE KEY UPDATE defaultcode = '*200'"
mysql -hlocalhost -uroot -p$rootpw asterisk -e "$query" >/dev/null 2>&1
query="insert into featurecodes (modulename,featurename,description,defaultcode,customcode,enabled,providedest) VALUES('core','Say-DATE-Jalali','VOIZ-بیان تاریخ به شمسی','*201',NULL,'1','1') ON DUPLICATE KEY UPDATE defaultcode = '*201'"
mysql -hlocalhost -uroot -p$rootpw asterisk -e "$query" >/dev/null 2>&1
query="insert into featurecodes (modulename,featurename,description,defaultcode,customcode,enabled,providedest) VALUES('core','Say-TIME-Jalali','VOIZ-بیان زمان به فارسی','*202',NULL,'1','1') ON DUPLICATE KEY UPDATE defaultcode = '*202'"
mysql -hlocalhost -uroot -p$rootpw asterisk -e "$query" >/dev/null 2>&1
query="insert into featurecodes (modulename,featurename,description,defaultcode,customcode,enabled,providedest) VALUES('core','Chanspy-Simple','VOIZ-شنود ساده، کد + شماره مقصد','*30',NULL,'1','1')"
mysql -hlocalhost -uroot -p$rootpw asterisk -e "$query" >/dev/null 2>&1
query="insert into featurecodes (modulename,featurename,description,defaultcode,customcode,enabled,providedest) VALUES('core','Chansyp-Whisper','VOIZ-شنود و نجوا، کد + شماره مقصد','*31',NULL,'1','1')"
mysql -hlocalhost -uroot -p$rootpw asterisk -e "$query" >/dev/null 2>&1
echo "**VOIZ Feature Codes Added." >> voiz-installation.log
}
function easyvpn(){
yum install issabel-easyvpn –nogpgcheck -y >/dev/null 2>&1
echo "**OpenVPN Module Added." >> voiz-installation.log
}
function survey(){
cp -rf voipiranagi /var/lib/asterisk/agi-bin
chmod -R 777 /var/lib/asterisk/agi-bin/voipiranagi
query="REPLACE INTO miscdests (id,description,destdial) VALUES('101','نظرسنجی-ویز','4454')"
mysql -hlocalhost -uroot -p$rootpw asterisk -e "$query"
echo "**Queue Survey Module Added." >> voiz-installation.log
}
function vtiger(){
#yes | cp -arf vtiger/crm /var/www/html
cat vtiger/crma* > vtiger/crm.tar.gz
yes | tar -zxvf vtiger/crm.tar.gz -C /var/www/html >/dev/null 2>&1
touch -r /var/www/html/crm/*
chmod -R 777 /var/www/html/crm
if ! mysql -uroot -p$rootpw -e 'use voipirancrm'; then
echo "-------------َADDING VTIGER DATABASE1"
mysql -uroot -p$rootpw -e "CREATE DATABASE IF NOT EXISTS voipirancrm DEFAULT CHARACTER SET utf8 COLLATE utf8_persian_ci;" >/dev/null 2>&1
echo "-------------َADDING VTIGER DATABASE2"
mysql -uroot -p$rootpw -e "GRANT ALL PRIVILEGES ON voipirancrm.* TO 'root'@'localhost';" >/dev/null 2>&1
echo "-------------َADDING VTIGER DATABASE3"
mysql -uroot -p$rootpw voipirancrm < vtiger/crm.db >/dev/null 2>&1
fi
#Config config.inc.php file
sed -i "s/123456/$rootpw/g" /var/www/html/crm/config.inc.php >/dev/null 2>&1
issabel-menumerge crm-menu.xml
echo "**Vtiger CRM Installed." >> voiz-installation.log
}
<<<<<<< Updated upstream:installVoizOnIssabel.sh
echo " "
echo " "
echo "-------------Installing Network Utils----------------"
=======
function webphone(){
cp -rf webphone /var/www/html
chown -R asterisk:asterisk /var/www/html/webphone/*
chown asterisk:asterisk /var/www/html/webphone/
echo "**WebPhone Module Added." >> voiz-installation.log
}
function htop(){
>>>>>>> Stashed changes:voiz-install-issabel-000.sh
#Installing htop
yum install htop traceroute -y >/dev/null 2>&1
echo "**HTOP Util Installed." >> voiz-installation.log
}
function sngrep(){
#Installing SNGREP
yum install -y git ncurses-devel libpcap-devel >/dev/null 2>&1
git clone https://github.com/irontec/sngrep.git >/dev/null 2>&1
cd sngrep
./bootstrap.sh
./configure
make
make install
cd ..
echo "**SNGREP Util Installed." >> voiz-installation.log
}
function voiz_menu(){
issabel-menumerge voiz-guide-menu.xml
echo "**VOIZ Guide Menu Added." >> voiz-installation.log
}
function welcome
{
whiptail --title "VOIZ Installtion" --msgbox "Powered by VOIPIRAN.io..." 8 78
}
function menu-order
{
###َAdd Callcenter Menu
issabel-menumerge callcenter-menu.xml
}
function fop2
{
###َ
}
#######################
#######################
#########START#########
###Fetch DB root PASSWORD
rootpw=$(sed -ne 's/.*mysqlrootpwd=//gp' /etc/issabel.conf)
> voiz-installation.log
echo "VOIZ Installation Log:" >> voiz-installation.log
welcome
###SELECT FEATURES GUI
SELECTED=$(whiptail --title "SELECT Features TO INSTALL" --checklist \
"List of Features to install" 20 100 10 \
"CRM" "ویتایگر با تقویم شمسی" ON \
"Webphone" "تلفن تحت وب" ON \
"Network Utilities" "SNGREP, HTOP" ON 3>&1 1>&2 2>&3)
#echo ${SELECTED[@]}
for SELECTED in $SELECTED; do
case "$SELECTED" in
"CRM")
CRMINSTALL=true
;;
"Webphone")
WEBPHONEINSTALL=true
;;
"Network Utilities")
NETUTILINSTALL=true
;;
esac
done
###SELECT LNGUAGE GUI
Lang=$(whiptail --title "Choose VOIZ Theme Style:" --menu "Choose a Language" 25 78 5 \
"Persian" "پوسته و محیط فارسی به همراه تقویم شمسی" \
"English" "پوسته و محیط انگلیسی به همراه تقویم شمسی" 3>&1 1>&2 2>&3)
COUNTER=0
while [[ ${COUNTER} -le 100 ]]; do
sleep 1
COUNTER=$(($COUNTER+10))
echo ${COUNTER}
##Set Version of VOIZ
setversion
##Install Source Gaurdian Module
install_sourecgaurdian
COUNTER=$(($COUNTER+10))
echo ${COUNTER}
##Install Webmin
install_webmin
##Copy Persian Sounds
add_persian_sounds
##Install Developer Module
install_developer
COUNTER=$(($COUNTER+10))
echo ${COUNTER}
##Install Persian Theme
add_vitenant_theme
COUNTER=$(($COUNTER+10))
echo ${COUNTER}
##Copy Issabel Edited Modules
edit_issabel_modules
##Coppy Downloadable Files
downloadable_files
##Install Bulk DIDs Module
bulkdids
COUNTER=$(($COUNTER+10))
echo ${COUNTER}
##Install BossSecretory Module
#bosssecretary
##Install Superfecta Module
superfecta
##Install VOIZ FeatueCodes
featurecodes
COUNTER=$(($COUNTER+10))
echo ${COUNTER}
##Install Openvpn Module
easyvpn
##Install Survey
survey
COUNTER=$(($COUNTER+10))
echo ${COUNTER}
##Install Vtiger CRM
if [ "$CRMINSTALL" = "true" ]
then
vtiger
fi
##Install Webphone
if [ "$WEBPHONEINSTALL" = "true" ]
then
webphone
fi
COUNTER=$(($COUNTER+10))
echo ${COUNTER}
##Install Htop
if [ "$NETUTILINSTALL" = "true" ]
then
htop
fi
COUNTER=$(($COUNTER+10))
echo ${COUNTER}
##Install SNGREP
if [ "$NETUTILINSTALL" = "true" ]
then
sngrep
fi
COUNTER=$(($COUNTER+10))
echo ${COUNTER}
fop2
##Install VOIZ Guide Menu
voiz_menu
menu_order
service httpd restart >/dev/null 2>&1
amportal a r 2>&1
COUNTER=$(($COUNTER+10))
done | whiptail --gauge "Sit back, enjoy coffee, VOIPIRAN." 6 50 ${COUNTER}
<<<<<<< Updated upstream:installVoizOnIssabel.sh
=======
##FINISHED
clear
cat voiz-installation/logo.txt
cat voiz-installation.log
#echo "-------------Adminer Installation----------------"
#sleep 1
#cp -rf www/adminer /var/www/html/
#issabel-menumerge adminer-menu.xml
#echo "Adminer Menu is Created Sucsessfully"
>>>>>>> Stashed changes:voiz-install-issabel-000.sh