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