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
|
# Maintainer: Brent Saner <r00t (at) square-r00t (dot) net>
# Contributor: TJ Vanderpoel <tj@rubyists.com>
## MAINTAINER NOTE BEGIN
# Most (like, ~80%) of this is taken verbatim from the freeswitch AUR package currently (as of 02.28.2014) maintained by bougyman.
# https://aur.archlinux.org/packages/freeswitch/
# However, it's horribly out of date and doesn't seem to be actively maintained anymore.
## MAINTAINER NOTE END
# This builds the FreeSWITCH open source telephone engine
# from the freeswitch git. It enables the following modules
# not enabled in the standard freeswitch build:
# * mod_callcenter
# * mod_xml_curl
# And disables the following standard modules:
# * mod_dialplan_asterisk
# * mod_say_ru
# * mod_spidermonkey
# * mod_lua
# You can modify this and other options in the BUILD CONFIGURATION section below
# BUILD CONFIGURATION BEGINS #
# SET THIS TO GET HIGHER QUALITY SOUNDFILES
# Value can be "hd-", "uhd-", or "cd-" to get 16k, 32k, or 48k sounds.
# By default we only download the 8k sounds. If you only use g711 or
# 8k codecs, leave this as-is
_sounds="cd-"
# ADDED MODULES
# If you don't need/want these modules remove them from _enabled_modules
# You can add any modules here you wish to add, make sure they're not
# in _disabled_modules, though
#
# xml_int/mod_xml_curl - Remote http dialplan lookups/control
# xml_int/mod_xml_cdr - Remote http dialplan lookups/control
# applications/mod_callcenter - Inbound call queueing system
_enabled_modules=(xml_int/mod_xml_curl
xml_int/mod_xml_cdr
formats/mod_shout
applications/mod_callcenter
languages/mod_lua)
# DISABLED MODULES
# Remove from _disabled_modules if you want to build these
#
# languages/mod_spidermonkey - server-side javascript
# languages/mod_lua - server-side lua
# say/mod_say_ru - Russian phrases
# dialplans/mod_dialplan_asterisk - Legacy dialplan
_disabled_modules=(languages/mod_spidermonkey
say/mod_say_ru
dialplans/mod_dialplan_asterisk)
# CONCURRENT BOOTSTRAP
# Uncomment this to enable backgrounded concurrent bootstrap operations.
# You will suffer a lot of autotools scroll from this, Fair Warning.
#_concurrent="-j"
# BUILD CONFIGURATION ENDS #
# #
# CHANGE ANYTHING BELOW HERE AT YOUR OWN RISK! #
# #
pkgname='freeswitch'
pkgver='1.6'
pkgrel='4'
pkgdesc="An opensource and free (libre, price) telephony system, similar to Asterisk."
arch=('i686'
'x86_64')
url="http://freeswitch.org/"
license=('MPL')
depends=('curl'
'xz'
'python'
'libtheora'
'unixodbc'
'libvorbis'
'speex'
'libjpeg-turbo'
'postgresql-libs')
# per https://wiki.freeswitch.org/wiki/FreeSwitch_Dependencies, dependencies are downloaded and built *from upstream*, so thankfully the deps are pretty minimal.
makedepends=('git'
'libjpeg'
'ldns'
'libedit'
'curl'
'python2'
'unixodbc'
'sed'
'make'
'libyuv-git')
# per https://aur.archlinux.org/packages/freeswitch-fixed/ 2014-08-13 14:02 comment, enable this when freetdm is packaged.
# freetdm will require libsangoma, wanpipe, libsng_isdn, libpri. see http://wiki.freeswitch.org/wiki/FreeTDM#Dependencies ; links below
# http://wiki.sangoma.com/wanpipe-linux-drivers
# http://downloads.asterisk.org/pub/telephony/libpri/releases
#optdepends=('freetdm: FreeTDM support for DAHDI etc.')
provides=('freeswitch')
conflicts=('freeswitch-git'
'freeswitch-fixed')
install=freeswitch.install
backup=('etc/freeswitch/private/passwords.xml'
'etc/freeswitch/vars.xml')
#source=("git+https://stash.freeswitch.org/scm/fs/freeswitch.git#tag=v${pkgver}"
source=("git+https://stash.freeswitch.org/scm/fs/freeswitch.git#branch=v${pkgver}"
'freeswitch.conf.d'
'README.freeswitch'
'run.freeswitch'
'run_log.freeswitch'
'conf_log.freeswitch'
'freeswitch.service')
changelog='ChangeLog'
_pkgname="freeswitch"
_pathorig=${PATH}
enable_module() {
_fs_mod=${1}
sed -i -e "s|^#${_fs_mod}|${_fs_mod}|" modules.conf
}
disable_module() {
_fs_mod=${1}
sed -i -e "s|^${_fs_mod}|#${_fs_mod}|" modules.conf
}
build() {
mkdir -p /var/tmp/bin
ln -sf /usr/bin/python2 /var/tmp/bin/python
PATH="/var/tmp/bin:${PATH}"
cd ${srcdir}/${_pkgname}
# BUILD BEGINS
msg "Bootstrapping..."
./bootstrap.sh ${_concurrent} > /dev/null
msg "Bootstrap Complete"
# MODULE ENABLE/DISABLE
for _mod in ${_enabled_modules[@]};do
msg "Enabling ${_mod}"
enable_module ${_mod}
done
for _mod in ${_disabled_modules[@]};do
msg "Disabling ${_mod}"
disable_module ${_mod}
done
msg "Module Configuration Complete, Stop Now with Ctrl-C if the above is not correct"
sleep 5
# SED FIXES
sed -i -e '/if\ test\ "\$ac_cv_gcc_supports_w_no_unused_result"\ =\ yes;\ then/,+2d' configure.ac
#sed -i -e '/\ _BSD_SOURCE$/d' src/include/switch.h
# CONFIGURE
./configure --prefix=/var/lib/freeswitch --with-python=/usr/bin/python2 \
--bindir=/usr/bin --sbindir=/usr/sbin --localstatedir=/var \
--sysconfdir=/etc/freeswitch --datarootdir=/usr/share \
--libexecdir=/usr/lib/freeswitch --libdir=/usr/lib/freeswitch \
--includedir=/usr/include/freeswitch --enable-core-odbc-support \
--with-recordingsdir=/var/spool/freeswitch/recordings \
--with-dbdir=/var/spool/freeswitch/db \
--with-pkgconfigdir=/usr/lib/pkgconfig \
--with-logfiledir=/var/log/freeswitch \
--with-modinstdir=/usr/lib/freeswitch/mod \
--with-rundir=/run/freeswitch
# COMPILE
make
PATH=${_pathorig}
rm -f /var/tmp/bin/python
rmdir /var/tmp/bin
}
enable_mod_xml() {
_fs_mod=$(basename $1)
if [ "x$(grep ${_fs_mod} ${pkgdir}/etc/freeswitch/autoload_configs/modules.conf.xml)" == "x" ];then
msg "Adding missing module ${_fs_mod} to modules.conf.xml"
sed -i -e "s|^\(\s*</modules>\)|\t\t<\!-- added by archlinux package -->\n\t\t<load module=\"${_fs_mod}\"/>\n\1|" \
"${pkgdir}/etc/freeswitch/autoload_configs/modules.conf.xml"
else
msg "Enabling module ${_fs_mod} in modules.conf.xml"
sed -i -e "s|^\(\s*\)<\!--\s*\(<load module=\"${_fs_mod}\"/>\)\s*-->|\1\2|" \
"${pkgdir}/etc/freeswitch/autoload_configs/modules.conf.xml"
fi
}
disable_mod_xml() {
_fs_mod=$(basename $1)
msg "Disabling module ${_fs_mod} in modules.conf.xml"
sed -i -e "s|^\(\s*\)\(<load module=\"${_fs_mod}\"/>\)|\1<\!-- \2 -->|" \
"${pkgdir}/etc/freeswitch/autoload_configs/modules.conf.xml"
}
package() {
mkdir -p /var/tmp/bin
ln -s /usr/bin/python2 /var/tmp/bin/python
PATH="/var/tmp/bin:${PATH}"
cd "${srcdir}/${_pkgname}"
make DESTDIR="${pkgdir}/" install
make DESTDIR="${pkgdir}/" ${_sounds}moh-install
make DESTDIR="${pkgdir}/" ${_sounds}sounds-install
PATH=${_pathorig}
rm -rf /var/tmp/bin/python
rmdir /var/tmp/bin
cd ${pkgdir} # MUY IMPORTANT, $PWD is $pkgdir from here on out
# Mangle freeswitch's installed dirs into a more compliant structure,
# leaving symlinks in their place so freeswitch doesn't notice.
ln -s /var/log/freeswitch var/lib/freeswitch/log
ln -s /var/spool/freeswitch/db var/lib/freeswitch/db
ln -s /var/spool/freeswitch/recordings var/lib/freeswitch/recordings
install -D -m 0755 -d var/spool/freeswitch/storage && \
ln -s /var/spool/freeswitch/storage var/lib/freeswitch/storage
rm usr/lib/freeswitch/mod/*.la 2>/dev/null|| true
rm usr/lib/freeswitch/*.la 2>/dev/null || true
ln -s /usr/lib/freeswitch/mod var/lib/freeswitch/mod
install -D -m 0644 ${srcdir}/freeswitch.service usr/lib/systemd/system/freeswitch.service
install -D -m 0644 "${srcdir}/freeswitch.conf.d" etc/conf.d/freeswitch
install -D -m 0644 "${srcdir}/README.freeswitch" usr/share/doc/freeswitch/README
cp -a "${srcdir}/${_pkgname}/docs" usr/share/doc/freeswitch
install -D -m 0755 -d usr/share/doc/freeswitch/support-d
cp -a "${srcdir}/${_pkgname}/support-d" usr/share/doc/freeswitch/
install -D -m 0755 -d usr/share/doc/freeswitch/scripts
cp -a "${srcdir}/${_pkgname}/scripts" usr/share/doc/freeswitch/
# Copy upstream confs
install -D -m 0755 -d usr/share/doc/freeswitch/examples/conf.default
install -D -m 0755 -d usr/share/doc/freeswitch/examples/conf.archlinux
mkdir etc/freeswitch/private
echo '<X-PRE-PROCESS cmd="include" data="private/passwords.xml"/>' >> etc/freeswitch/vars.xml
echo "<X-PRE-PROCESS cmd=\"set\" data=\"default_password=$(tr -dc 0-9 < /dev/urandom | head -c10)\"/>" > etc/freeswitch/private/passwords.xml
chmod 700 etc/freeswitch/private
chmod 600 etc/freeswitch/private/passwords.xml
ln -s /etc/freeswitch var/lib/freeswitch/conf
cp -a etc/freeswitch/* usr/share/doc/freeswitch/examples/conf.default/
for _mod in ${_enabled_modules[@]};do
enable_mod_xml $_mod
done
for _mod in ${_disabled_modules[@]};do
disable_mod_xml $_mod
done
mv etc/freeswitch/* usr/share/doc/freeswitch/examples/conf.archlinux/
rmdir etc/freeswitch
install -D -m0755 -d usr/share/freeswitch/conf
install -D -m 0755 "${srcdir}/run.freeswitch" usr/share/freeswitch/run
install -D -m 0755 "${srcdir}/run_log.freeswitch" usr/share/freeswitch/log/run
install -D -m 0644 "${srcdir}/conf_log.freeswitch" usr/share/freeswitch/log/conf
}
md5sums=('SKIP'
'f674b302edeb1895bbefcaf7bb8510ca'
'bfa0c6c70c8173bc78fd228bd42a98ef'
'4126dcbe4e1e4f689230a0fe40edcb68'
'e9f0bdde366bca6fd29a9202818f3591'
'e6411d793501c29ec4afd6d54018de1b'
'31cd89e02ec3cc52769489a30ccf6c9b')
|