-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-asterisk.sh
executable file
·625 lines (485 loc) · 20.1 KB
/
install-asterisk.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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
#!/bin/bash
########################################################
# Script creado por Enrique Fermin
# email: [email protected]
# Fecha de creacion 14 de Abril de 2014
# Registrado bajo licencia GPL Version 2
# Este script instala y desintala asterisk
# para la plataforma MPSANP de CANTV.
# Parametros de entrada:
# 1.- install , unistall
# 2.- desarrollo , calidad , produccion
# 3.- ivr , acd , asr, full
# 4.- nossl , ssl
# IMPORTANTE: Se debe correr con un usuario no root
# que tenga permisologia de sudo. NO DEBE CORRER COMO ROOT.
#
#
# Ejemplo: ./install-asterisk.sh install produccion full nossl
#
#
# Actualizaciones:
# 21April2014: Se Agrego la actualizacion de cola cuando es un ACD
# 22April2014: Se modifico para borrar los modulos de lib64 o lib de usr
# 22Jan2015: Se modifica para el caso de servidor full
#
#
##############################################################
PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
#Section Variable decaration######
group=''
ambient=''
type=''
option=''
home_directory=''
install_directory=''
SSL=''
##################################
#section for dependences###########
packages_snmp="snmp libsnmp-dev snmpd unixodbc unixodbc-dev"
packages_essential="build-essential linux-headers-`uname -r` libxml2 libxml2-dev libncurses5-dev libgtk2.0-dev libnewt0.52 libnewt-dev libsqlite3-dev screen"
packages_postgresql="postgresql-client libpq-dev php5 php5-pgsql uuid uuid-dev"
###################################
group=`groups $USER | awk -F": " '{print $2}'`
install_directory=`pwd`
echo "Install Directory: " $install_directory
echo "The current user is: " $USER
echo "The current group is: " $group
option=$1
ambient=$2
type=$3
SSL=$4
if [ -z "$option" ];then
echo "You must provide one parameter for action install|unistall"
exit 0
fi
if [ -z "$ambient" ];then
echo "You must provide one parameter for schema desarrollo|calidad|produccion"
exit 0
fi
if [ -z "$type" ];then
echo "You must provide one parameter for type ivr|acd|asr|full"
exit 0
fi
if [ -z "$SSL" ];then
echo "You must provide one parameter for type ssl|nossl"
exit 0
fi
echo "Begin to install"
#Case for determinate ambient
case $ambient in
"desarrollo" )
home_directory="/desarrollo"
echo "estoy en desarrollo"
sleep 5
;;
"calidad" )
echo "estoy en calidad"
home_directory="/calidad"
sleep 5
;;
"produccion" )
echo "estoy en producccion"
home_directory="/produccion"
sleep 5
;;
esac
#Case for determinate option of install or unistall
case $option in
"install" )
sudo chown -R $USER.$group $home_directory
cd $home_directory
sudo chown -R $USER.$group *
sudo apt-get update
echo "******************************"
echo "****INSTALING PACKAGES SNMP***"
echo "******************************"
sleep 5
sudo apt-get -y install $packages_snmp
echo "******************************"
echo "INSTALING PACKAGES ESSENTIALS"
echo "******************************"
sleep 5
sudo apt-get -y install $packages_essential
echo "******************************"
echo "INSTALING PACKAGES POSTGRESQL"
echo "******************************"
sleep 5
sudo apt-get -y install $packages_postgresql
cd $home_directory/$USER
mkdir src
cd src/
cp $install_directory/src/libhoard-3.9.tar.gz .
tar zxvf libhoard-3.9.tar.gz
cd emeryberger-Hoard-d065953/src/
sudo make linux-gcc-x86-64
sudo /etc/init.d/snmpd stop
sudo cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori
sudo cp $install_directory/src/snmp/snmpd.conf /etc/snmp/snmpd.conf
sudo /etc/init.d/snmpd start
snmpwalk -v1 127.0.0.1 -c C0mcantvc0r .1.3.6.1.2.1.25.2.3.1.3
sleep 10
cd $home_directory/$USER/src/
cp $install_directory/src/asterisk-11-current.tar.gz .
tar xvzf asterisk-11-current.tar.gz
cd asterisk-11.11.0
if [ "$SSL" == "ssl" ];
then
echo "*****************************************************************"
echo "*********************Configure whit ssl**************************"
echo "*****************************************************************"
sleep 5
sudo ./configure CFLAGS=-mtune=native --libdir=/usr/lib64 -with-hoard=$home_directory/$USER/src/emeryberger-Hoard-d065953/src/
else
echo "*****************************************************************"
echo "******************Configure whitout ssl**************************"
echo "*****************************************************************"
sleep 5
sudo ./configure CFLAGS=-mtune=native --libdir=/usr/lib64 --disable-asteriskssl -with-hoard=$home_directory/$USER/src/emeryberger-Hoard-d065953/src/
fi
cp $install_directory/$USER/src/menuselect/* .
sudo make
sudo make all
sudo make install
sudo make samples
sudo make config
sudo make install-logrotate
sudo /etc/init.d/asterisk start
sleep 10
if [ -f "/var/run/asterisk/asterisk.pid" ];
then
echo "***************************************"
echo "********Asterisk install succefful*****"
echo "***************************************"
sudo /etc/init.d/asterisk stop
else
echo "***************************************"
echo "ALERT: Asterisk instalation no succefull"
echo "***************************************"
fi
echo "***************************************"
echo "********Second Lap*********************"
echo "***************************************"
cd $home_directory/$USER
mkdir etc
cd etc
sudo cp -R /etc/asterisk .
sudo mv /etc/asterisk /etc/asterisk.old
echo "Create link symbolic /etc/asterisk"
sudo ln -s $home_directory/$USER/etc/asterisk /etc/asterisk
sleep 5
cd $home_directory/$USER
mkdir -p var/lib
cd var/lib
sudo cp -R /var/lib/asterisk .
sudo mv /var/lib/asterisk /var/lib/asterisk.old
sleep 5
echo "Create link symbolic /var/lib/asterisk"
sudo ln -s $home_directory/$USER/var/lib/asterisk /var/lib/asterisk
cd $home_directory/$USER
mkdir -p var/spool
cd var/spool
sudo cp -R /var/spool/asterisk .
sudo mv /var/spool/asterisk /var/spool/asteisk.old
sleep 5
echo "Create link symbolic /var/spool/asterisk"
sudo ln -s $home_directory/$USER/var/spool/asterisk /var/spool/asterisk
cd $home_directory/$USER
mkdir -p var/run
cd var/run
sudo cp -R /var/run/asterisk .
sudo mv /var/run/asterisk /var/run/asteisk.old
sleep 5
echo "Create link symbolic var/run/asterisk"
sudo ln -s $home_directory/$USER/var/run/asterisk /var/run/asterisk
cd $home_directory/$USER
mkdir -p usr/sbin
mkdir -p usr/share
mkdir -p usr/com
mkdir -p usr/var
mkdir -p usr/include
sudo cp /usr/sbin/asterisk $home_directory/$USER/usr/sbin/asterisk
sudo mv /usr/sbin/asterisk /usr/sbin/asterisk.old
sleep 5
echo "Create link symbolic /usr/sbin/asterisk"
sudo ln -s $home_directory/$USER/usr/sbin/asterisk /usr/sbin/asterisk
sudo cp /usr/sbin/astcanary $home_directory/$USER/usr/sbin/astcanary
sudo mv /usr/sbin/astcanary /usr/sbin/astcanary.oldsip.conf
sleep 5
echo "Create link symbolic /usr/sbin/astcanary"
sudo ln -s $home_directory/$USER/usr/sbin/astcanary /usr/sbin/astcanary
sudo cp /usr/sbin/astdb2bdb $home_directory/$USER/usr/sbin/astdb2bdb
sudo mv /usr/sbin/astdb2bdb /usr/sbin/astdb2bdb.old
sleep 5
echo "Create link symbolic /usr/sbin/astdb2bdb"
sudo ln -s $home_directory/$USER/usr/sbin/astdb2bdb /usr/sbin/astdb2bdb
sudo cp /usr/sbin/astdb2sqlite3 $home_directory/$USER/usr/sbin/astdb2sqlite3
sudo mv /usr/sbin/astdb2sqlite3 /usr/sbin/astdb2sqlite3.old
sleep 5
echo "Create link symbolic /usr/sbin/astdb2sqlite3"
sudo ln -s $home_directory/$USER/usr/sbin/astdb2sqlite3 /usr/sbin/astdb2sqlite3
sudo cp /usr/sbin/astgenkey $home_directory/$USER/usr/sbin/astgenkey
sudo mv /usr/sbin/astgenkey /usr/sbin/astgenkey.old
sleep 5
echo "Create link symbolic /usr/sbin/astgenkey"
sudo ln -s $home_directory/$USER/usr/sbin/astgenkey /usr/sbin/astgenkey
mkdir $home_directory/logs
cd $home_directory/logs
sudo cp -R /var/log/asterisk .
sudo mv /var/log/asterisk /var/log/asterisk.old
sleep 5
echo "Create link symbolic /var/log/asterisk"
sudo ln -s $home_directory/logs/asterisk /var/log/asterisk
cd $home_directory
sudo chown -R $USER.$group *
#cd $home_directory/$USER/src/asterisk-11.4.0 vieja version
cd $home_directory/$USER/src/asterisk-11.11.0
sudo make clean
if [ "$SSL" == "ssl" ];
then
echo "*****************************************************************"
echo "*********************Configure whit ssl**************************"
echo "*****************************************************************"
sleep 5
sudo ./configure CFLAGS=-mtune=native --libdir=/usr/lib64 -with-hoard=$home_directory/$USER/src/emeryberger-Hoard-d065953/src/
else
echo "*****************************************************************"
echo "******************Configure whitout ssl**************************"
echo "*****************************************************************"
sleep 5
sudo ./configure CFLAGS=-mtune=native --libdir=/usr/lib64 --disable-asteriskssl -with-hoard=$home_directory/$USER/src/emeryberger-Hoa
fi
#./configure CFLAGS=-mtune=native --libdir=/usr/lib64 -with-hoard=$home_directory/$USER/src/emeryberger-Hoard-d065953/src/
sudo make
sudo make all
sudo make install exec_prefix="$home_directory/$USER/usr/" prefix="$home_directory/$USER/usr/"
sudo make install-logrotate
cd $home_directory/$USER
mkdir -p usr/lib
if [ -d /usr/lib/asterisk ];then
echo "***************************************"
echo "********El drirectorio es 32 bits*******"
echo "***************************************"
sleep 5
cd $home_directory/$USER
mkdir -p usr/lib
sudo cp -R /usr/lib/asterisk $home_directory/$USER/usr/lib
sudo mv /usr/lib/asterisk /usr/lib/asterisk.old
sleep 5
echo "Create link symbolic $home_directory/$USER/usr/lib/asterisk"
sudo ln -s $home_directory/$USER/usr/lib/asterisk /usr/lib/asterisk
fi
if [ -d /usr/lib64/asterisk ];then
echo "***************************************"
echo "********El drirectorio es 64 bits*******"
echo "***************************************"
sleep 5
cd $home_directory/$USER
mkdir -p usr/lib64
sudo cp -R /usr/lib64/asterisk $home_directory/$USER/usr/lib64
sudo mv /usr/lib64/asterisk /usr/lib64/asterisk.old
sleep 5
echo "Create link symbolic $home_directory/$USER/usr/lib64/asterisk"
sudo ln -s $home_directory/$USER/usr/lib64/asterisk /usr/lib64/asterisk
fi
sudo /etc/init.d/asterisk start
sleep 10
sudo rm -rf $home_directory/$USER/src
sudo chown -R $USER.$group $home_directory
if [ -f "/var/run/asterisk/asterisk.pid" ];
then
echo "***************************************"
echo "********Asterisk install succefful*****"
echo "***************************************"
#$home_directory/$USER/usr/sbin/asterisk -rvvvvvv
else
echo "***************************************"
echo "ALERT: Asterisk instalation no succefull"
echo "***************************************"
fi
#case for determinate option for server type ASR, ACD, IVR, FULL.
case $type in
"full" )
source $install_directory/config/local.rc
if [ ! -d "/var/lib/jvm" ];
then
sudo mkdir -p /var/lib/jvm
cd /var/lib/jvm
else
cd /var/lib/jvm
fi
echo "Copy $install_directory/src/jdk-6u45-linux-x64.bin"
sudo cp $install_directory/src/jdk-6u45-linux-x64.bin .
sudo chmod +x jdk-6u45-linux-x64.bin
sudo ./jdk-6u45-linux-x64.bin
sudo rm -rf jdk-6u45-linux-x64.bin
echo "***************************************"
echo "******Set Default VM on System*********"
echo "***************************************"
sudo update-alternatives --install /usr/bin/java java /var/lib/jvm/jdk1.6.0_45/bin/java 20000
sudo update-alternatives --install /usr/bin/javac javac /var/lib/jvm/jdk1.6.0_45/bin/javac 20000
sudo cp -R $install_directory/src/ZTE-PIC /var/lib/asterisk/agi-bin
;;
"asr" )
;;
"ivr" )
source $install_directory/config/local.rc
if [ ! -d "/var/lib/jvm" ];
then
sudo mkdir -p /var/lib/jvm
cd /var/lib/jvm
else
cd /var/lib/jvm
fi
echo "Copy $install_directory/src/jdk-6u45-linux-x64.bin"
sudo cp $install_directory/src/jdk-6u45-linux-x64.bin .
sudo chmod +x jdk-6u45-linux-x64.bin
sudo ./jdk-6u45-linux-x64.bin
sudo rm -rf jdk-6u45-linux-x64.bin
echo "***************************************"
echo "******Set Default VM on System*********"
echo "***************************************"
sudo update-alternatives --install /usr/bin/java java /var/lib/jvm/jdk1.6.0_45/bin/java 20000
sudo update-alternatives --install /usr/bin/javac javac /var/lib/jvm/jdk1.6.0_45/bin/javac 20000
sudo cp -R $install_directory/src/ZTE-PIC /var/lib/asterisk/agi-bin
;;
"acd" )
source $install_directory/config/local.rc
if [ ! -d "/var/lib/jvm" ];
then
sudo mkdir -p /var/lib/jvm
cd /var/lib/jvm
else
cd /var/lib/jvm
fi
echo "Copy $install_directory/src/jdk-6u45-linux-x64.bin"
sudo cp $install_directory/src/jdk-6u45-linux-x64.bin .
sudo chmod +x jdk-6u45-linux-x64.bin
sudo ./jdk-6u45-linux-x64.bin
sudo rm -rf jdk-6u45-linux-x64.bin
echo "***************************************"
echo "******Set Default VM on System*********"
echo "***************************************"
sudo update-alternatives --install /usr/bin/java java /var/lib/jvm/jdk1.6.0_45/bin/java 20000
sudo update-alternatives --install /usr/bin/javac javac /var/lib/jvm/jdk1.6.0_45/bin/javac 20000
echo "****************************************************"
echo "*******Copy files /var/lib/asterisk/agi-bin*********"
echo "****************************************************"
sudo cp -r $install_directory/src/update-acd/agi-bin/* /var/lib/asterisk/agi-bin
cp $install_directory/src/update-acd/agi-bin/callcenter/src/DBConnection.java /var/tmp/DBConnection.java.ori
cd /var/tmp/
sed -e 's/connection = DriverManager.getConnection("jdbc:postgresql:\/\/xxx.xxx.xxx.xxx:port\/callcenter?user=user\&password=password");/connection = DriverManager.getConnection("jdbc:postgresql:\/\/'$IP_DATABASE:$PORT'\/'$DATABASE'?user='$USER_DATABASE'\&password='$PASSWORD_DATABASE'");/g' DBConnection.java.ori > DBConnection.java
sudo cp /var/tmp/DBConnection.java /var/lib/asterisk/agi-bin/callcenter/src/
cd $home_directory/$USER/var/lib/asterisk/agi-bin/callcenter/
sudo javac -cp lib/asterisk-java-1.0.0.M3.jar:lib/postgresql-9.1-903.jdbc4.jar:. -d . src/*.java
#sudo javac -cp /var/lib/asterisk/agi-bin/callcenter/lib/asterisk-java-1.0.0.M3.jar:/var/lib/asterisk/agi-bin/callcenter/lib/postgresql-9.1-903.jdbc4.jar:. -d . /var/lib/asterisk/agi-bin/callcenter/src/*.java
#sudo cp -r com/ /var/lib/asterisk/agi-bin/callcenter/
#sudo rm -rf com/
cat $install_directory/config/extensions.conf >> $home_directory/$USER/etc/asterisk/extensions.conf
cat $install_directory/config/sip.conf >> $home_directory/$USER/etc/asterisk/sip.conf
cat $install_directory/config/manager.conf >> $home_directory/$USER/etc/asterisk/manager.conf
cp $home_directory/$USER/etc/asterisk/manager.conf $home_directory/$USER/etc/asterisk/manager.conf.ori
sed -e 's/enabled = no/enabled = yes/g' $home_directory/$USER/etc/asterisk/manager.conf.ori > $home_directory/$USER/etc/asterisk/manager.conf
cp $home_directory/$USER/etc/asterisk/sip.conf $home_directory/$USER/etc/asterisk/sip.conf.ori
sed -e 's/context=public/context=ctx-calls/g' $home_directory/$USER/etc/asterisk/sip.conf.ori > $home_directory/$USER/etc/asterisk/sip.conf
cd $home_directory
sudo chown -R $USER.$group *
echo "****************************************************"
echo "****************Restart Asterisk*******************"
echo "****************************************************"
sudo /etc/init.d/asterisk restart
sleep 10
cd $home_directory/$USER/var/lib/asterisk/agi-bin/callcenter/
echo "****************************************************"
echo "***********Excute Presence screen*******************"
echo "****************************************************"
sudo screen -dmS Presence java -cp lib/asterisk-java-1.0.0.M3.jar:lib/postgresql-9.1-903.jdbc4.jar:. com.capanicus.callcenter.PresenceMonitor
sleep 10
cd $home_directory/$USER/var/lib/asterisk/agi-bin/callcenter/
echo "****************************************************"
echo "***********Excute Billing screen*******************"
echo "****************************************************"
sudo screen -dmS Billing java -cp lib/asterisk-java-1.0.0.M3.jar:lib/postgresql-9.1-903.jdbc4.jar:. com.capanicus.callcenter.LiveCallsMonitor
sleep 10
cd $home_directory/$USER/var/lib/asterisk/agi-bin/callcenter/
echo "****************************************************"
echo "***********Excute AGI screen*******************"
echo "****************************************************"
sudo screen -dmS AGI java -cp lib/asterisk-java-1.0.0.M3.jar:lib/postgresql-9.1-903.jdbc4.jar:fastagi-mapping.properties:. -Xms1000m -Xmx1000m org.asteriskjava.fastagi.DefaultAgiServer
sleep 10
touch $home_directory/$USER/etc/asterisk/sip_peers.conf
echo "****************************************************"
echo "**************Restart Asterisk**********************"
echo "****************************************************"
sudo /etc/init.d/asterisk restart
sleep 10
esac
;;
"uninstall" )
echo "estoy en unistall"
sudo /etc/init.d/asterisk stop
sudo rm -rf $home_directory/$USER/etc/asterisk /etc/asterisk
sudo rm -rf $home_directory/$USER/var/lib/asterisk /var/lib/asterisk
sudo rm -rf $home_directory/$USER/var/spool/asterisk /var/spool/asterisk
sudo rm -rf $home_directory/$USER/var/run/asterisk /var/run/asterisk
sudo rm -rf $home_directory/$USER/usr/sbin/asterisk /usr/sbin/asterisk
sudo rm -rf $home_directory/$USER/usr/sbin/astcanary /usr/sbin/astcanary
sudo rm -rf $home_directory/$USER/usr/sbin/astdb2bdb /usr/sbin/astdb2bdb
sudo rm -rf $home_directory/$USER/usr/sbin/astdb2sqlite3 /usr/sbin/astdb2sqlite3
sudo rm -rf $home_directory/$USER/usr/sbin/astgenkey /usr/sbin/astgenkey
sudo rm -rf $home_directory/logs/asterisk /var/log/asterisk
cd $home_directory/$USER
sudo rm -rf $home_directory/$USER/src
sudo rm -rf $home_directory/$USER/usr
sudo rm -rf $home_directory/$USER/var
sudo rm -rf $home_directory/$USER/etc
sudo rm -rf $home_directory/$USER/asterisk
sudo rm -rf $home_directory/logs
echo "UNINSTALING PACKAGES SNMP"
sudo apt-get -y purge $packages_snmp
echo "UNINSTALING PACKAGES ESSENTIALS"
sudo apt-get -y purge $packages_essential
echo "UNINSTALING PACKAGES POSTGRESQL"
sudo apt-get -y purge $packages_postgresql
sudo rm -rf /etc/asterisk.old
sudo rm -rf /var/lib/asterisk.old
sudo rm -rf /var/spool/asteisk.old
sudo rm -rf /var/run/asteisk.old
sudo rm -rf /usr/sbin/asterisk.old
sudo rm -rf /usr/sbin/astcanary.oldsip.conf
sudo rm -rf /usr/sbin/astdb2bdb.old
sudo rm -rf /usr/sbin/astdb2sqlite3.old
sudo rm -rf /usr/sbin/astgenkey.old
sudo rm -rf /var/log/asterisk.old
sudo rm -rf /etc/init.d/asterisk
sudo rm -rf /etc/asterisk.old
sudo rm -rf /var/lib/asterisk
sudo rm -rf /var/spool/asteisk
sudo rm -rf /var/run/asteisk
sudo rm -rf /usr/sbin/asterisk
sudo rm -rf /usr/sbin/astcanary
sudo rm -rf /usr/sbin/astdb2bdb
sudo rm -rf /usr/sbin/astdb2sqlite3
sudo rm -rf /usr/sbin/astgenkey
sudo rm -rf /var/log/asterisk
sudo rm -rf /etc/init.d/asterisk
if [ -d /usr/lib64/asterisk ];then
sudo rm -rf /usr/lib/asterisk
sudo rm -rf /usr/lib64/asterisk.old
else
sudo rm -rf /usr/lib64/asterisk
sudo rm -rf /usr/lib/asterisk.old
fi
sudo update-alternatives --remove java /var/lib/jvm/jdk1.6.0_45/bin/java
sudo update-alternatives --remove javac /var/lib/jvm/jdk1.6.0_45/bin/javac
sudo rm -rf /var/lib/jvm/jdk1.6.0_45/
if [ "$type" == "acd" ];then
echo "****************************************************"
echo "***********Remove screen***************************"
echo "****************************************************"
for i in `sudo screen -list | grep .Presence | awk '{print $1}'`; do sudo screen -X -S $i quit;done;
for i in `sudo screen -list | grep .Billing | awk '{print $1}'`; do sudo screen -X -S $i quit;done;
for i in `sudo screen -list | grep .AGI | awk '{print $1}'`; do sudo screen -X -S $i quit;done;
fi
;;
esac