-
Notifications
You must be signed in to change notification settings - Fork 19
/
install-dahdi-on-proxmox.sh
221 lines (171 loc) · 7.23 KB
/
install-dahdi-on-proxmox.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
#/bin/sh
#Install Dahdi on Proxmox version 1.3
#Copyright (C) 2009-2011 Jonathan Roper [email protected]
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
apt-get -y update
apt-get -y upgrade
dpkg-reconfigure locales
#install asterisk dependencies
apt-get -y --fix-missing install build-essential make libncurses5-dev libcurl4-openssl-dev pve-headers-`uname -r`
echo "Please reboot and re-run this script"
echo "CTRL-C to exit or Enter to continue"
read TEMP
cd /usr/src/
wget http://downloads.digium.com/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
tar zxfv dahdi-linux-complete-current.tar.gz
rm -rf *.tar.gz
rm -rf dahdi-linux-complete
mv dahdi-linux-complete* dahdi-linux-complete
#Install Dahdi
cd dahdi-linux-complete
make all
make install
make config
#fix startup problems
sed -i 's/modprobe dahdi/modprobe -f dahdi/g' /etc/init.d/dahdi
/etc/init.d/dahdi restart
touch /usr/local/sbin/pabx-enable-conference
echo '
#/bin/sh
#Enable conference on Proxmox version 1.3 - Dahdi Version
#Copyright (C) 2009 Jonathan Roper [email protected]
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
clear
echo "This script enables call conferencing in the VE"
echo "please enter the VE number"
read VENUMBER
vzctl set $VENUMBER --devnodes dahdi/pseudo:rw --save
vzctl exec $VENUMBER chown -R asterisk /dev/dahdi /lib/udev/devices/dahdi
vzctl exec $VENUMBER chgrp -R asterisk /dev/dahdi /lib/udev/devices/dahdi
echo "Job Done - Now reload asterisk in VE-"$VENUMBER
' > /usr/local/sbin/pabx-enable-conference
chmod +x /usr/local/sbin/pabx-enable-conference
#Create Template script
touch /usr/local/sbin/pabx-create-template
echo '
#/bin/sh
#Creates template.
#Copyright (C) 2009-2011 Jonathan Roper [email protected]
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#!/bin/bash
#Create Template script - Joe Roper 2009-2011
clear
echo "Creates a template"
echo "please enter the VE number"
read VENUMBER
vzctl stop $VENUMBER
vzctl set $VENUMBER --ipdel all --save
echo "Create a name for your template"
echo "This must be in form OS-version-ASINGLEWORD_Vers_arch"
echo "eg centos-5-pabx-1_x86 or centos-5-pabx-1_amd64"
read TEMPLATENAME
cd /var/lib/vz/private/$VENUMBER
echo > "" /etc/resolv.conf
echo > "" /root/.bash-history
tar czfv /var/lib/vz/template/cache/$TEMPLATENAME.tar.gz *
echo "Job Done - Now install from the GUI"
' > /usr/local/sbin/pabx-create-template
chmod +x /usr/local/sbin/pabx-create-template
/etc/init.d/dahdi restart
#Add Eth0 for G729 and asterisk registrations.
touch /usr/local/sbin/pabx-create-eth0
echo '
#/bin/sh
#Creates Eth0 for Digium registration.
#Copyright (C) 2009-2011 Jonathan Roper [email protected]
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#!/bin/bash
#Create Eth0 script - Joe Roper 2009
clear
echo "Creates an eth0 on the container - Do not run this more than once"
echo "please enter the VE number"
read VENUMBER
vzctl set $VENUMBER --netif_add eth0 --save
"
echo "Please restart container $VENUMBER"
' > /usr/local/sbin/pabx-create-eth0
chmod +x /usr/local/sbin/pabx-create-eth0
#Allow IPtables to work on the VE
sed -i 's|ipt_REJECT ipt_tos ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length|ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp|' /etc/vz/vz.conf
/etc/init.d/vz restart
echo "Now correct /usr/local/sbin/pabx-create-eth0"
echo " There may be other problems to correct
#If you get this error:
#FATAL: Error inserting dahdi (/lib/modules/2.6.18.8-linode19/dahdi/dahdi.ko): Invalid module format
#FATAL: Error inserting dahdi (/ lib/modules/2.6.18.8-linode19/dahdi/dahdi.ko): Invalid module format
#Tenemos que modificar el script del arranque de DAHDI
#We have to modify the startup script DAHDI
#nano /etc/init.d/dahdi
#nano / etc / init.d / dahdi
#modificar estas dos l�neas:
#modify these two lines:
#modprobe dahdi
#modprobe dahdi
#modprobe dahdi_dummy 2> /dev/null
#dahdi_dummy modprobe 2> / dev / null
#para que queden
#to make them
#modprobe �f dahdi
#modprobe-f dahdi
#modprobe �f dahdi_dummy 2> /dev/null
#dahdi_dummy modprobe-f 2> / dev / null
#Volvemos a arrancar DAHDI
#Restart DAHDI
#/etc/init.d/dahdi start
#/ etc / init.d / dahdi start"
INSTALLWEBMIN=2
until [ $INSTALLWEBMIN -lt 2 ] ; do
clear
echo "Do you want to install Webmin Y/n"
echo "Press 0 for Yes or 1 for No"
read INSTALLWEBMIN < /dev/tty
echo $INSTALLWEBMIN
done
if [ $INSTALLWEBMIN = 0 ]; then
rm -rf webmin-1*.deb
cd /usr/src
apt-get -y install libio-pty-perl libmd5-perl libnet-ssleay-perl libauthen-pam-perl
wget http://www.webmin.com/download/deb/webmin-current.deb
dpkg --install webmin*
rm -rf webmin-1*.deb
fi