Tue, 08 Jan 2013 20:08:32 +0100
Update to new vendor version (chan_capi as well) and adapt patch logic,
introducing a new variable to control build time SMS call centre channel.
1 ##
2 ## asterisk.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package version
25 %define V_opkg 1.8.19.1
26 %define V_asterisk 1.8.19.1
27 %define V_asterisk_fax_subdir 1.8.4
28 %define V_asterisk_fax_digium 1.8.4_1.3.1
29 %define V_asterisk_sounds_core 1.4.22
30 %define V_asterisk_sounds_extra 1.4.11
31 %define V_asterisk_sounds_amoogab 1.4
32 %define V_asterisk_sounds_amootts current
33 %define V_asterisk_sounds_custom 1.0
34 %define V_asterisk_sounds_mohop 2.03
35 %define V_asterisk_sounds_newpro july_2012
36 %define V_asterisk_addons_mp3dec 1
37 %define V_fswitch_sounds_en 1.0.20
38 %define V_fswitch_sounds_fr 1.0.16
39 %define V_fswitch_sounds_ru 1.0.13
40 %define V_fswitch_music 1.0.8
41 %define V_asterisk_codecs_ilbc 20110104
42 %define V_chan_capi 1.1.6
44 # package information
45 Name: asterisk
46 Summary: Private Branch Exchange (PBX)
47 URL: http://www.asterisk.org/
48 Vendor: Mark Spencer et al.
49 Packager: OpenPKG Foundation e.V.
50 Distribution: OpenPKG Community
51 Class: BASE
52 Group: VoIP
53 License: GPL
54 Version: %{V_opkg}
55 Release: 20120800
57 # package options
58 %option with_dahdi no
59 %option with_capi no
60 %option with_ogg no
61 %option with_mp3 no
62 %option with_fax no
63 %option with_avcodec no
64 %option with_ldap no
65 %option with_radius no
66 %option with_sqlite no
67 %option with_srtp no
68 %option with_pgsql no
69 %option with_lua no
70 %option with_gtalk no
71 %option with_jabber no
72 %option with_imap no
73 %option with_odbc no
74 %option with_libpri no
75 %option with_esounds no
76 %option with_xfersips yes
77 %option with_proxymwi yes
78 %option with_smdipoll 10
79 %option with_motxchan Local/17094009
81 # correct implicit interdependencies
82 %if "%{with_capi}" == "yes"
83 #%define with_motxchan CAPI/ISDN1/090032669002 # Materna (Anny Way)
84 %define with_motxchan CAPI/ISDN1/17094009
85 %endif
87 # list of sources
88 Source0: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz
89 Source1: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz
90 Source2: ftp://ftp.europalab.com/pub/sfw/machsnds/asterisk-moh-freeplay-sln16.tar.gz
91 Source3: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz
92 Source4: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-sln16-%{V_asterisk_sounds_core}.tar.gz
93 Source5: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-es-sln16-%{V_asterisk_sounds_core}.tar.gz
94 Source6: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en_AU-sln16-%{V_asterisk_sounds_core}.tar.gz
95 Source7: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-fr-sln16-%{V_asterisk_sounds_core}.tar.gz
96 Source8: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-ru-sln16-%{V_asterisk_sounds_core}.tar.gz
97 Source9: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-sln16-%{V_asterisk_sounds_extra}.tar.gz
98 Source10: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-fr-sln16-%{V_asterisk_sounds_extra}.tar.gz
99 Source11: http://www.asterisk.org/files/new_prompts_%{V_asterisk_sounds_newpro}.zip
100 Source12: http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz
101 Source13: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz
102 Source14: ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_asterisk_sounds_custom}.tar.bz2
103 Source15: ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2
104 Source16: ftp://ftp.europalab.com/pub/sfw/machsnds/msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2
105 Source17: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz
106 Source18: http://files.freeswitch.org/freeswitch-sounds-es-mx-maria-44100.tar.gz
107 Source19: http://files.freeswitch.org/freeswitch-sounds-fr-ca-june-48000-%{V_fswitch_sounds_fr}.tar.gz
108 Source20: http://files.freeswitch.org/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz
109 Source21: http://files.freeswitch.org/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz
110 Source22: http://svn.digium.com/svn/thirdparty/mp3/trunk/addons/mp3-%{V_asterisk_addons_mp3dec}.tar.gz
111 Source23: http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-%{V_asterisk_fax_subdir}/x86-64/res_fax_digium-%{V_asterisk_fax_digium}-generic_64.tar.gz
112 Source24: http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-%{V_asterisk_fax_subdir}/x86-32/res_fax_digium-%{V_asterisk_fax_digium}-generic_32.tar.gz
113 Source25: ilbc-%{V_asterisk_codecs_ilbc}.tar.gz
114 Source26: asterisk.txt
115 Source27: rc.asterisk
116 Source28: wakeup.agi
117 Patch0: asterisk.patch
118 Patch1: asterisk.patch.xfersips
119 Patch2: asterisk.patch.proxymwi
121 # build information
122 BuildPreReq: OpenPKG, openpkg >= 20100101, bison, gcc, make, grep, pkgconfig
123 PreReq: OpenPKG, openpkg >= 20100101, MTA
124 BuildPreReq: zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml
125 PreReq: zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml
126 %if "%{with_ogg}" == "yes"
127 BuildPreReq: vorbis-libs
128 PreReq: vorbis-libs
129 %endif
130 %if "%{with_mp3}" == "yes"
131 PreReq: mpg123
132 %endif
133 %if "%{with_imap}" == "yes"
134 BuildPreReq: imap
135 PreReq: imap
136 %endif
137 %if "%{with_sqlite}" == "yes"
138 BuildPreReq: sqlite
139 PreReq: sqlite
140 %endif
141 %if "%{with_srtp}" == "yes"
142 BuildPreReq: srtp
143 PreReq: srtp
144 %endif
145 %if "%{with_pgsql}" == "yes"
146 BuildPreReq: postgresql
147 PreReq: postgresql
148 %endif
149 %if "%{with_lua}" == "yes"
150 BuildPreReq: lua
151 PreReq: lua
152 %endif
153 %if "%{with_avcodec}" == "yes"
154 BuildPreReq: ffmpeg
155 PreReq: ffmpeg
156 %endif
157 %if "%{with_ldap}" == "yes"
158 BuildPreReq: openldap
159 PreReq: openldap
160 %endif
161 %if "%{with_radius}" == "yes"
162 BuildPreReq: radiusclient
163 PreReq: radiusclient
164 %endif
165 %if "%{with_gtalk}" == "yes"
166 %define with_jabber yes
167 %endif
168 %if "%{with_jabber}" == "yes"
169 BuildPreReq: iksemel
170 PreReq: iksemel
171 %endif
172 %if "%{with_odbc}" == "yes"
173 BuildPreReq: unixodbc, sqlite, sqlite::with_odbc = yes
174 PreReq: unixodbc, sqlite, sqlite::with_odbc = yes
175 %endif
176 %if "%{with_libpri}" == "yes"
177 BuildPreReq: libpri > 1.4.11.5
178 PreReq: libpri > 1.4.11.5
179 %endif
180 %if "%{with_esounds}" == "yes"
181 BuildPreReq: sox, infozip
182 %endif
184 %description
185 Asterisk is a complete Private Branch Exchange (PBX) in software.
186 It provides more than the features normally expected from a PBX,
187 and can transceive Voice over IP (VoIP) in many protocols. Asterisk
188 provides voicemail services with directory, call conferencing,
189 interactive voice response and call queuing as well. It has support
190 for three way calling, caller ID, ADSI, and SIP, and requires no
191 additional hardware for VoIP applications.
193 This copy of Asterisk is optionally patched to allow the asterisk
194 server to respond to SIP/TLS transfer requests using the Transfer()
195 application. Should this option be chosen, the asterisk server
196 successfully dispatches all transfer destinations using 'SIPS'
197 technology by means of the standard SIP/2.0 302 Moved Temporarily
198 message, with a URI resembling <sips:extension@hostname.tld:port>.
200 This copy of Asterisk is optionally patched as well to enclose the
201 correct user name in NOTIFY messages when MWI logic detects changes
202 in the state of Messages-Waiting. Asterisk will send NOTIFY messages
203 with the URI 'user@hostname' instead of simply 'hostname'. This can
204 be used by a external SIP proxy to route the MWI to the correct phone.
206 %track
207 prog asterisk = {
208 version = %{V_asterisk}
209 url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/
210 regex = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz
211 }
212 prog asterisk:fax_digium_32 = {
213 version = %{V_asterisk_fax_digium}
214 url = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-32/
215 regex = res_fax_digium-(__VER__)-generic_32.tar.gz\.tar\.gz
216 }
217 prog asterisk:fax_digium_64 = {
218 version = %{V_asterisk_fax_digium}
219 url = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-64/
220 regex = res_fax_digium-(__VER__)-generic_64.tar.gz\.tar\.gz
221 }
222 prog asterisk:sounds_core = {
223 version = %{V_asterisk_sounds_core}
224 url = http://downloads.asterisk.org/pub/telephony/sounds/releases/
225 regex = asterisk-core-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz
226 }
227 prog asterisk:sounds_newpro = {
228 version = %{V_asterisk_sounds_newpro}
229 url = http://www.asterisk.org/files/
230 regex = new_prompts_(__VER__)\.zip
231 }
232 prog asterisk:sounds_extra = {
233 version = %{V_asterisk_sounds_extra}
234 url = http://downloads.asterisk.org/pub/telephony/sounds/releases/
235 regex = asterisk-extra-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz
236 }
237 prog asterisk:sounds_amootts = {
238 version = %{V_asterisk_sounds_amootts}
239 url = http://www.amooma.de/asterisk/sprachbausteine/
240 regex = asterisk-core-sounds-de-gsm-(__VER__)\.tar\.gz
241 }
242 prog asterisk:sounds_amoogab = {
243 version = %{V_asterisk_sounds_amoogab}
244 url = http://www.amooma.de/asterisk/sprachbausteine/
245 regex = asterisk-(__VER__)-de-prompts\.tar\.gz
246 }
247 prog asterisk:sounds_digits = {
248 version = %{V_asterisk_sounds_custom}
249 url = ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/
250 regex = de-digits-(__VER__)\.tar\.bz2
251 }
252 prog asterisk:sounds_custom = {
253 version = %{V_asterisk_sounds_custom}
254 url = ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/
255 regex = astmultisnds-de-sln16-(__VER__)\.tar\.bz2
256 }
257 prog asterisk:sounds_mohop = {
258 version = %{V_asterisk_sounds_mohop}
259 url = http://downloads.asterisk.org/pub/telephony/sounds/releases/
260 regex = asterisk-moh-opsound-sln16-(__VER__)\.tar\.gz
261 }
262 prog asterisk:chan_capi = {
263 version = %{V_chan_capi}
264 url = ftp://ftp.chan-capi.org/chan-capi/
265 regex = chan_capi-(__VER__)\.tar\.gz
266 }
268 %prep
269 %if "%{with_capi}" == "yes"
270 ( echo "Note that the system header files capi20.h, capicmd.h, and capiutils.h might"
271 echo "need adjusting in accordance withthe CAPI hardware vendor's kernel driver."
272 ) | %{l_rpmtool} msg -b -t warn
273 %endif
274 %setup -q -n asterisk-%{V_asterisk}
275 %setup -q -n asterisk-%{V_asterisk} -D -T -a 1
276 %setup -q -n asterisk-%{V_asterisk} -D -T -a 2
277 %if "%{with_fax}" == "yes"
278 %setup -q -n asterisk-%{V_asterisk} -D -T -a 23
279 %setup -q -n asterisk-%{V_asterisk} -D -T -a 24
280 %endif
281 ( cd addons
282 %{l_tar} zxf %{_sourcedir}/mp3-%{V_asterisk_addons_mp3dec}.tar.gz
283 ) || exit $?
284 ( cd codecs
285 %{l_tar} zxf %{_sourcedir}/ilbc-%{V_asterisk_codecs_ilbc}.tar.gz
286 mv ilbc-%{V_asterisk_codecs_ilbc}/* ilbc/
287 rmdir ilbc-%{V_asterisk_codecs_ilbc}
288 ) || exit $?
289 %patch -p0
290 %if "%{with_xfersips}" == "yes"
291 %patch -p0 -P 1
292 %endif
293 %if "%{with_proxymwi}" == "yes"
294 %patch -p0 -P 2
295 %endif
296 %{l_shtool} subst \
297 -e 's;\(astdatadir=.*\)\${astvarlibdir};\1${datadir};' \
298 -e 's;\(astvarlibdir=.*\)/lib/asterisk;\1/asterisk/lib;' \
299 -e 's;\(astdbdir=.*\)\${astvarlibdir};\1${localstatedir}/asterisk/db;' \
300 -e 's;\(dir=.*{localstatedir}\)/\([^/][^/]*\)/asterisk;\1/asterisk/\2;g' \
301 configure
302 %{l_shtool} subst \
303 -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \
304 -e 's;\(sqlite\)\(_exec\);\13\2;g' \
305 -e 's;-lradiusclient-ng;-lradiusclient;g' \
306 -e 's;radiusclient-ng\.h;radiusclient.h;g' \
307 -e 's;lua5\.1;lua;g' \
308 -e 's;-I${IMAP_TK_DIR}/c-client;-DUSE_SYSTEM_IMAP -I${IMAP_TK_DIR}/include/imap;g' \
309 -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \
310 -e 's;LIBXML2_INCLUDE="-I\${LIBXML2_DIR}/include";echo "Removing really buggy hard coded LibXML include defs.";' \
311 -e 's;\(for ver in 2\.0 2\.2 2\.4\);\1 2.6;' \
312 -e 's;\(\-lpq.*\-lz.*\)";\1 ${PTHREAD_LIBS}";g'\
313 configure
314 %{l_shtool} subst \
315 -e 's;\(sh\) \(bash\) ksh sh5;\2 \1;' \
316 configure
317 %{l_shtool} subst \
318 -e 's/int foo2 = \(__sync_fetch_and_add(\&foo1, 1);\)/return \1/' \
319 configure
320 %{l_shtool} subst \
321 -e 's;^\(#define DEFAULT_DB .*\${ASTDBDIR}\)/astdb;\1/asterisk.db;' \
322 build_tools/make_defaults_h
323 %{l_shtool} subst \
324 -e 's;^\(_all:.* *\)cleantest *;\1;' \
325 -e 's; *-I/usr/local/ssl/include;;g' \
326 -e 's;/opt/ssl/include;%{l_prefix}/include;g' \
327 -e 's;/usr/local;%{l_prefix};g' \
328 Makefile
329 %{l_shtool} subst \
330 -e 's;\$(SUBMAKE);$(MAKE);g' \
331 -e 's;\$(SILENTMAKE);$(MAKE) --quiet --no-print-directory;g' \
332 -e 's;\$(MAKE_MENUSELECT); $(MAKE) -C menuselect;g' \
333 -e 's;-march=\$(PROC);-march=native;g' \
334 Makefile
335 %{l_shtool} subst \
336 -e 's; *-L/usr/local/ssl/lib;;g' \
337 -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \
338 -e 's;/usr/local;%{l_prefix};g' \
339 -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \
340 -e 's;\( CFLAGS=\)"[^"]+";"%{l_cflags -O}";g' \
341 main/Makefile
342 %{l_shtool} subst \
343 -e 's;\(<defaultenabled>\)no\(</defaultenabled>\);\1yes\2;g' \
344 apps/app_ivrdemo.c \
345 apps/app_saycounted.c \
346 utils/utils.xml \
347 agi/agi.xml
348 %{l_shtool} subst \
349 -e 's;\(\*motxchannel = "\)[^"][^"]*",;\1%{with_motxchan}",;' \
350 -e 's;\(\*spooldir = "\)[^"][^"]*",;\1%{l_prefix}/var/asterisk/spool",;' \
351 utils/smsq.c
352 %{l_shtool} subst \
353 -e 's;\(-DSOLARIS\);\1 -D__EXTENSIONS__=1;g' \
354 main/editline/Makefile.in \
355 main/db1-ast/Makefile
356 %{l_shtool} subst \
357 -e 's;^\(install:\).*;\1;' \
358 sounds/Makefile
359 %{l_shtool} subst \
360 -e 's;%s/astdb;%s/asterisk.db;g' \
361 main/asterisk.c
362 %{l_shtool} subst \
363 -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \
364 main/db1-ast/hash/hash.h
365 %{l_shtool} subst \
366 -e 's;if \(((tmp = strchr(name\);while \1;g' \
367 main/abstract_jb.c
368 %{l_shtool} subst \
369 -e 's;if.*SSL_CTX_use_certificate_file.*;if (SSL_CTX_use_certificate_chain_file(cfg->ssl_ctx, cfg->certfile) == 0) {;' \
370 main/tcptls.c
371 %{l_shtool} subst \
372 -e 's;ast_random();rand();' \
373 main/strcompat.c
374 %{l_shtool} subst \
375 -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \
376 -e 's;\(radiusclient\)-ng;\1;g' \
377 cdr/cdr_radius.c \
378 cel/cel_radius.c
379 %{l_shtool} subst \
380 -e 's;\(sqlite\)\(\.h\);\13\2;g' \
381 cdr/cdr_sqlite.c
382 %{l_shtool} subst \
383 -e 's;\(#define DEFAULT_POLLING_INTERVAL\) .*;\1 %{with_smdipoll};' \
384 res/res_smdi.c
385 %{l_shtool} subst \
386 -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \
387 -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \
388 -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \
389 -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \
390 -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \
391 -e 's;^\(USE_OWN_LIBCAPI\)=yes;\1=no;' \
392 chan_capi-%{V_chan_capi}/Makefile
393 %{l_shtool} subst \
394 -e 's;#ifdef CC_AST_HAS_VERSION_1_6$;#if (defined(CC_AST_HAS_VERSION_1_6) \&\& !defined(CC_AST_HAS_VERSION_1_8));g' \
395 chan_capi-%{V_chan_capi}/chan_capi_devstate.c
396 case "%{l_platform -t}" in
397 *-sunos* )
398 %{l_shtool} subst \
399 -e 's;SO_SUPPRESS_SYMBOLS=-Wl,--version-script,[a-zA-Z0-9@\-_,\.()\$ ][a-zA-Z0-9@\-_,\.()\$ ]*;LOCAL_NOOP=0;' \
400 -e 's;ASTLINK+=-Wl,--version-script,[a-zA-Z0-9\-_\.,][a-zA-Z0-9\-_\.,]*;LOCAL_NOOP=0;' \
401 -e 's;-Wl,--version-script=[^ ][^ ]* *;;' \
402 Makefile.rules \
403 main/Makefile \
404 main/db1-ast/Makefile
405 ;;
406 esac
408 %build
409 # sanity check operating system
410 %if "%{with_dahdi}" == "yes"
411 dahdi_prefix=""
412 case "%{l_platform -t}" in
413 *-linux* )
414 if [ ! -f /usr/include/dahdi/user.h ]; then
415 echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1
416 fi
417 dahdi_prefix=/usr
418 ;;
419 *-freebsd* )
420 if [ ! -f /usr/local/include/dahdi/user.h ]; then
421 echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1
422 fi
423 dahdi_prefix=/usr/local
424 ;;
425 * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;;
426 esac
427 %endif
428 # correct platform dependent build configuration
429 extflg=
430 loclibs="-lssl -lcrypto"
431 case "%{l_platform -t}" in
432 *-linux* )
433 pthlibflg='-lpthread'
434 ;;
435 *-sunos* )
436 loclibs="$loclibs -lsocket -lnsl"
437 ;;
438 esac
440 # adapt buildconf to find mpg123 (for music on hold)
441 %if "%{with_mp3}" == "yes"
442 mpg123="%{l_prefix}/bin/mpg123"
443 %else
444 mpg123="`which false`"
445 %endif
446 %{l_shtool} subst \
447 -e "s;/usr/local/bin/mpg123;$mpg123;" \
448 -e "s;/usr/bin/mpg123;$mpg123;" \
449 res/res_musiconhold.c apps/app_mp3.c
451 # configure program
452 cflags="%{l_cflags -O}"
453 cppflags="%{l_cppflags ncurses lua}"
454 ldflags="%{l_ldflags}"
455 cppflags="$cppflags"
456 ldflags="$ldflags"
457 %if "%{with_ogg}" == "yes"
458 loclibs="$loclibs -logg -lm"
459 %endif
460 %if "%{with_avcodec}" == "yes"
461 loclibs="$loclibs -lavcodec -lavutil"
462 %endif
463 %if "%{with_ldap}" == "yes"
464 loclibs="$loclibs -lldap -llber"
465 %endif
466 %if "%{with_dahdi}" == "yes"
467 cppflags="$cppflags -I$dahdi_prefix/include"
468 ldflags="$ldflags -L$dahdi_prefix/lib"
469 %endif
470 CC="%{l_cc}" \
471 CFLAGS="$cflags" \
472 CPPFLAGS="$cppflags" \
473 LDFLAGS="$ldflags" \
474 LIBS="$loclibs" \
475 INSTALL="%{l_shtool} install -c" \
476 PTHREAD_LIBS="$pthlibflg" \
477 ./configure \
478 --cache-file=./config.cache \
479 --prefix=%{l_prefix} \
480 --mandir=%{l_prefix}/man \
481 --sysconfdir=%{l_prefix}/etc \
482 --localstatedir=%{l_prefix}/var \
483 --datarootdir=%{l_prefix}/share/asterisk \
484 --with-crypto=%{l_prefix} \
485 --with-libcurl=%{l_prefix} \
486 --with-ncurses=%{l_prefix} \
487 --with-gsm="internal" \
488 --with-popt=%{l_prefix} \
489 %if "%{with_sqlite}" == "yes"
490 --with-sqlite3=%{l_prefix} \
491 %else
492 --without-sqlite3 \
493 %endif
494 %if "%{with_srtp}" == "yes"
495 --with-srtp=%{l_prefix} \
496 %else
497 --without-srtp \
498 %endif
499 %if "%{with_pgsql}" == "yes"
500 --with-postgres=%{l_prefix} \
501 %else
502 --with-postgres=no \
503 %endif
504 --with-speex=%{l_prefix} \
505 --with-speexdsp=%{l_prefix} \
506 --with-ssl=%{l_prefix} \
507 --with-gmime=%{l_prefix} \
508 --with-z=%{l_prefix} \
509 %if "%{with_ogg}" == "yes"
510 --with-ogg=%{l_prefix} \
511 --with-vorbis=%{l_prefix} \
512 %else
513 --without-ogg \
514 --without-vorbis \
515 %endif
516 %if "%{with_jabber}" == "yes"
517 --with-iksemel=%{l_prefix} \
518 %else
519 --without-iksemel \
520 %endif
521 %if "%{with_lua}" == "yes"
522 --with-lua=%{l_prefix} \
523 %else
524 --without-lua \
525 %endif
526 %if "%{with_dahdi}" == "yes"
527 --with-dahdi=$dahdi_prefix \
528 --with-tonezone=$dahdi_prefix \
529 %else
530 --without-dahdi \
531 --without-tonezone \
532 %endif
533 %if "%{with_avcodec}" == "yes"
534 --with-avcodec=%{l_prefix} \
535 %else
536 --without-avcodec \
537 %endif
538 %if "%{with_ldap}" == "yes"
539 --with-ldap=%{l_prefix} \
540 %else
541 --without-ldap \
542 %endif
543 %if "%{with_radius}" == "yes"
544 --with-radius=%{l_prefix} \
545 %else
546 --without-radius \
547 %endif
548 %if "%{with_imap}" == "yes"
549 --with-imap=%{l_prefix} \
550 --disable-largefile \
551 %else
552 --without-imap \
553 %endif
554 --without-iodbc \
555 %if "%{with_odbc}" == "yes"
556 --with-unixodbc=%{l_prefix} \
557 %else
558 --without-unixodbc \
559 %endif
560 %if "%{with_libpri}" == "yes"
561 --with-pri=%{l_prefix} \
562 %else
563 --without-pri \
564 %endif
565 --with-sounds-cache=%_sourcedir \
566 --with-libxml2=%{l_prefix} \
567 --without-netsnmp \
568 --without-isdnnet \
569 --without-misdn \
570 --without-nbs \
571 --without-newt \
572 --without-asound \
573 --without-oss \
574 --without-sqlite \
575 --without-tds \
576 --without-osptk \
577 --without-suppserv \
578 --without-vpb \
579 --without-sdl \
580 --without-x11 \
581 --without-gtk2
583 # build menuselect
584 %{l_make} %{l_mflags -O} menuselect.makeopts
585 menuselect/menuselect \
586 --enable format_mp3 --enable app_fax --enable codec_ilbc \
587 --enable RADIO_RELAX --enable G711_NEW_ALGORITHM \
588 --enable G711_REDUCED_BRANCHING --enable CORE-SOUNDS-EN-SLN16 \
589 --enable CORE-SOUNDS-ES-SLN16 --enable CORE-SOUNDS-FR-SLN16 \
590 --enable CORE-SOUNDS-EN_AU-SLN16 --enable CORE-SOUNDS-RU-SLN16 \
591 --enable MOH-OPSOUND-SLN16 --enable EXTRA-SOUNDS-EN-SLN16 \
592 --enable EXTRA-SOUNDS-FR-SLN16 \
593 menuselect.makeopts
594 menuselect/menuselect \
595 --disable CORE-SOUNDS-EN-GSM \
596 --disable MOH-OPSOUND-WAV \
597 menuselect.makeopts
598 %if "%{with_imap}" == "yes"
599 menuselect/menuselect --enable IMAP_STORAGE menuselect.makeopts
600 %endif
602 # build program
603 %{l_make} %{l_mflags -O} \
604 CC="%{l_cc} $cflags -I../include $cppflags" NOISY_BUILD=yes
606 %if "%{with_capi}" == "yes"
607 # build capi channel
608 ( cd chan_capi-*
609 ln -s ../include/asterisk .
610 ln -s ../include/asterisk.h .
611 %{l_make} %{l_mflags -O} V=1 \
612 INSTALL_PREFIX=%{l_prefix} \
613 ASTERISK_HEADER_DIR="`pwd`"
614 ) || exit $?
615 %endif
617 %install
618 # install program
619 %{l_make} %{l_mflags} install \
620 DESTDIR=$RPM_BUILD_ROOT \
621 INSTALL_PREFIX=%{l_prefix}
623 %if "%{with_capi}" == "yes"
624 # install capi channel
625 ( cd chan_capi-*
626 %{l_make} %{l_mflags} install \
627 INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
628 INSTALL="%{l_shtool} install -c" \
629 MODULES_DIR='$(INSTALL_PREFIX)/lib/asterisk/modules'
630 ) || exit $?
631 %endif
633 %if "%{with_fax}" == "yes"
634 # install fax support
635 case "%{l_platform -t}" in
636 amd64*-* )
637 %{l_shtool} install -c -m 755 \
638 res_fax_digium-%{V_asterisk_fax_digium}-generic_64/res_*.so \
639 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/
640 %{l_shtool} install -c -m 640 \
641 res_fax_digium-%{V_asterisk_fax_digium}-generic_64/*.conf \
642 $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
643 ;;
644 i?86-* )
645 %{l_shtool} install -c -m 755 \
646 res_fax_digium-%{V_asterisk_fax_digium}-generic_32/res_*.so \
647 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/
648 %{l_shtool} install -c -m 640 \
649 res_fax_digium-%{V_asterisk_fax_digium}-generic_32/*.conf \
650 $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
651 ;;
652 *-* )
653 echo "Error determining hardware architecture." \
654 | %{l_rpmtool} msg -b -t warn
655 exit 1;
656 ;;
657 esac
658 %endif
660 ( echo 'Start of sound installation block (OpenPKG)'
661 # create main sound directory hierarchy
662 ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
663 %{l_shtool} mkdir -f -p -m 755 en es fr en_AU
664 ) || exit $?
665 %if "%{with_esounds}" == "yes"
666 # create extra sound directory hierarchy
667 %{l_shtool} mkdir -f -p -m 755 \
668 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru
669 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/moh
671 # install humorous 'new' prompts
672 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en
673 %{l_prefix}/bin/unzip %{_sourcedir}/new_prompts_%{V_asterisk_sounds_newpro}.zip
675 # install freeswitch sound prompt files, expecting
676 # identical sound filenames to be overwritten later
677 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en
678 %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz
679 subs=`( cd en/us/callie && find * -type d -prune )`
680 for subdir in $subs; do
681 mkdir $subdir
682 mv -f en/us/callie/$subdir/*/* ${subdir}/
683 done
684 rm -rf en
685 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es
686 %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-es-mx-maria-44100.tar.gz
687 subs=`( cd es/mx/maria && find * -type d -prune )`
688 for subdir in $subs; do
689 mkdir $subdir
690 mv -f es/mx/maria/$subdir/*/* ${subdir}/
691 done
692 rm -rf es
693 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru
694 %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz
695 subs=`( cd ru/RU/elena && find * -type d -prune )`
696 for subdir in $subs; do
697 mkdir $subdir
698 mv -f ru/RU/elena/$subdir/*/* ${subdir}/
699 done
700 rm -rf ru
702 # install freeswitch music on hold files
703 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
704 %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz
705 mv -f music/48000/* . && rm -rf music
707 # convert freeswitch 48000 and 441000 KHz to 8000 Khz
708 # ffmpeg -i <in> -ar 8000 -ac 1 -acodec pcm_s16le -f s16le <out>
709 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk
710 for highfile in `find . -name '*.wav'`; do
711 lowfile=`echo $highfile | sed -e 's;\(.*\)\.wav;\1.sln16;'`
712 %{l_prefix}/bin/sox $highfile -t raw -r 16000 -s -2 -c 1 $lowfile
713 rm $highfile
714 done
715 %endif
717 # install main sound prompt files
718 #for codec in alaw ulaw g722 g729 gsm; do
719 for lang in en en_AU es fr; do
720 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
721 %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-sln16-%{V_asterisk_sounds_core}.tar.gz
722 done
723 for lang in en fr; do
724 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
725 %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-${lang}-sln16-%{V_asterisk_sounds_extra}.tar.gz
726 done
728 # install special case sound files
729 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
730 #%{l_tar} jxf %{SOURCE de-digits-%{V_asterisk_sounds_custom}.tar.bz2}
731 #( cd de && %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_amootts}.tar.gz} ) || exit $?
732 #%{l_tar} zxf %{SOURCE asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz}
733 #mv -f dictate/de/* de/dictate/ && rm -rf dictate/de
734 #mv -f digits/de/* de/digits/ && rm -rf digits/de
735 #mv -f letters/de/* de/letters/ && rm -rf letters/de
736 #mv -f phonetic/de/* de/phonetic/ && rm -rf phonetic/de
737 %{l_tar} jxf %{SOURCE astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2}
738 %{l_tar} jxf %{SOURCE msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2}
739 mv msvbsnds-sln16-%{V_asterisk_sounds_custom} msvb
741 # install additional asterisk music on hold
742 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
743 %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-sln16.tar.gz
744 %{l_tar} zxf %{_sourcedir}/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz
746 # correct sound permissions
747 find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type f \
748 | xargs chmod 644
749 find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type d \
750 | xargs chmod 755
752 # apply provisional workaround for bug 0016104
753 # https://issues.asterisk.org/view.php?id=16104
754 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
755 cd en && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
756 cd ../es && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
757 cd ../de && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
758 cd ../fr && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
760 # # install nonstandard voicemail prompts
761 # %{l_shtool} mkdir -f -p -m 755 \
762 # $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail
763 # %{l_shtool} install -c -m 660 \
764 # %{_sourcedir}/ansage-%{V_ansage}.wav} \
765 # $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav
766 ) || exit $? # End of sound installation block (RPM)
768 # strip down installation
769 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true
770 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true
771 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true
772 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true
773 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true
774 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/.asterisk* >/dev/null 2>&1 || true
775 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CREDIT* >/dev/null 2>&1 || true
776 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CHANGES* >/dev/null 2>&1 || true
777 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/LICENSE* >/dev/null 2>&1 || true
778 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CREDIT* >/dev/null 2>&1 || true
779 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CHANGES* >/dev/null 2>&1 || true
780 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/.asterisk* >/dev/null 2>&1 || true
782 # create additional directories
783 %{l_shtool} mkdir -f -p -m 755 \
784 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db \
785 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/facsimile/rx \
786 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/facsimile/tx \
787 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing \
788 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/licenses
790 # postadjust installation
791 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
792 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \
793 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \
794 >/dev/null 2>&1 || true
795 mv $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \
796 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin
798 # install AGI progs
799 ( cd agi
800 %{l_shtool} install -c -m 755 %{l_value -s -a} \
801 DialAnMp3.agi fastagi-test numeralize %{SOURCE wakeup.agi} \
802 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/
803 ) || exit $?
804 for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do
805 mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
806 done
808 # install default configuration
809 for name in `grep "^<file" %{SOURCE asterisk.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
810 %if "%{with_dahdi}" == "no"
811 [ ".$name" = ".chan_dahdi.conf" ] && continue
812 %endif
813 %if "%{with_capi}" == "no"
814 [ ".$name" = ".capi.conf" ] && continue
815 %endif
816 %if "%{with_gtalk}" == "no"
817 [ ".$name" = ".gtalk.conf" ] && continue
818 %endif
819 %if "%{with_jabber}" == "no"
820 [ ".$name" = ".jabber.conf" ] && continue
821 %endif
822 %if "%{with_sqlite}" == "no"
823 [ ".$name" = ".cdr_sqlite3_custom.conf" ] && continue
824 %endif
825 %if "%{with_odbc}" == "no"
826 [ ".$name" = ".res_odbc.conf" ] && continue
827 [ ".$name" = ".func_odbc.conf" ] && continue
828 %endif
829 (echo ""; cat %{SOURCE asterisk.txt}; echo "") |\
830 sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
831 %{l_shtool} install -c -m 644 %{l_value -s -a} \
832 $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
833 done
835 # install runcommand script
836 %{l_shtool} mkdir -f -p -m 755 \
837 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
838 %{l_shtool} install -c -m 755 %{l_value -s -a} \
839 %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
841 # determine installation files
842 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
843 %{l_files_std} \
844 '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
845 '%config %attr(-,%{l_mgrp},%{l_mgrp}) %{l_prefix}/share/asterisk/licenses' \
846 '%attr(750,%{l_rgrp},%{l_rgrp}) %{l_prefix}/var/asterisk/spool/facsimile' \
847 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk'
849 # '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/es/vm-Voicemail.sln16' \
850 # '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/de/vm-Voicemail.sln16' \
851 # '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/fr/vm-Voicemail.sln16' \
853 %files -f files
855 %clean
857 %post
858 %if "%{with_dahdi}" == "yes"
859 if [ $1 -eq 1 ]; then
860 case "%{l_platform -t}" in
861 *-freebsd* )
862 ( echo "To allow Asterisk to use the DAHDI /dev/dahdi/pseudo device(s)"
863 echo "you have add the following entry to /etc/devfs.rules:"
864 echo ""
865 echo "[openpkg_asterisk=10]"
866 echo "add path 'dahdi/pseudo*' mode 0664 user %{l_rusr} group %{l_rgrp}"
867 echo ""
868 ) | %{l_rpmtool} msg -b -t notice
869 ;;
870 esac
871 fi
872 %endif
873 %if "%{with_odbc}" == "yes"
874 # after install, optionally link into ODBC and create database
875 if $RPM_INSTALL_PREFIX/bin/odbcinst -q -s -n "asterisk-sqlite" >/dev/null 2>&1; then
876 :
877 else
878 ( echo "[asterisk-sqlite]"
879 echo "Description = Asterisk SQLite Database"
880 echo "Driver = SQLite3"
881 echo "Database = $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite"
882 echo "Timeout = 2000"
883 ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "asterisk-sqlite" -r >/dev/null 2>&1 || true
884 fi
885 if [ ! -f $RPM_INSTALL_PREFIX/var/asterisk/run/asterisk.db ]; then
886 ( umask 007
887 echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b
888 chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true
889 ) || exit $?
890 fi
891 %endif
892 %if "%{with_fax}" == "yes"
893 ( echo "Asterisk has been installed with proprietary Digium fax support."
894 echo "The responsible module is called res_fax_digium and requires a"
895 echo "valid license. The license must be found in the directory"
896 echo "'licenses' which in turn must be found in %{l_prefix}/share/asterisk"
897 echo "or wherever astvarlibdir has been configured in 'asterisk.conf'."
898 echo ""
899 echo "Please see http://downloads.digium.com/pub/telephony/fax/ for information."
900 ) | %{l_rpmtool} msg -b -t notice
901 %endif
902 # after upgrade, restart service
903 [ $1 -eq 2 ] || exit 0
904 eval `%{l_rc} asterisk status 2>/dev/null`
905 [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart
906 exit 0
908 %preun
909 # before erase, stop service and remove log files
910 [ $1 -eq 0 ] || exit 0
911 %{l_rc} asterisk stop 2>/dev/null
912 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/* >/dev/null 2>&1 || true
913 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
914 rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true
915 rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/* >/dev/null 2>&1 || true
916 rm -f $RPM_INSTALL_PREFIX/var/asterisk/lib/* >/dev/null 2>&1 || true
917 rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/* >/dev/null 2>&1 || true
918 %if "%{with_odbc}" == "yes"
919 # before erase, optionally unlink from ODBC and destroy database
920 $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true
921 %endif
922 exit 0