diff -r 73d852a30c9a -r 263143ec0fb2 asterisk/asterisk.spec --- a/asterisk/asterisk.spec Sun Mar 20 20:00:02 2011 +0100 +++ b/asterisk/asterisk.spec Sun Mar 20 20:03:11 2011 +0100 @@ -1,6 +1,6 @@ ## ## asterisk.spec -- OpenPKG RPM Package Specification -## Copyright (c) 2000-2010 OpenPKG Foundation e.V. +## Copyright (c) 2000-2009 OpenPKG Foundation e.V. ## ## Permission to use, copy, modify, and distribute this software for ## any purpose with or without fee is hereby granted, provided that @@ -22,13 +22,21 @@ ## # package version -%define V_opkg 1.6.2.13 -%define V_asterisk 1.6.2.13 -%define V_asterisk_addons 1.6.2.2 -%define V_asterisk_sounds_core_en 1.4.20 -%define V_asterisk_sounds_core_de current -%define V_asterisk_sounds_extra_en 1.4.11 -%define V_chan_capi 1.1.5 +%define V_opkg 1.8.3.2 +%define V_asterisk 1.8.3.2 +%define V_asterisk_fax_digium 1.8.0_1.3.0 +%define V_asterisk_sounds_core 1.4.20 +%define V_asterisk_sounds_extra 1.4.11 +%define V_asterisk_sounds_amoogab 1.4 +%define V_asterisk_sounds_amootts current +%define V_asterisk_sounds_custom 1.0 +%define V_asterisk_sounds_mohop 2.03 +%define V_asterisk_addons_mp3dec 1 +%define V_fswitch_sounds_en 1.0.14 +%define V_fswitch_sounds_ru 1.0.12 +%define V_fswitch_music 1.0.8 +%define V_asterisk_codecs_ilbc 20110104 +%define V_chan_capi 1.1.5.919 # package information Name: asterisk @@ -41,7 +49,7 @@ Group: VoIP License: GPL Version: %{V_opkg} -Release: 20101019 +Release: 20110314 # package options %option with_dahdi no @@ -53,27 +61,56 @@ %option with_ldap no %option with_radius no %option with_sqlite no +%option with_srtp no +%option with_pgsql no %option with_lua no %option with_jabber no %option with_imap no %option with_odbc no +%option with_libpri no +%option with_esounds no +%option with_xfersips yes +%option with_proxymwi yes +%option with_smdipoll 10 # list of sources Source0: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz -Source1: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-addons-%{V_asterisk_addons}.tar.gz -Source2: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_asterisk_sounds_core_en}.tar.gz -Source3: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_asterisk_sounds_extra_en}.tar.gz -Source4: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_core_de}.tar.gz -Source5: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz -Source6: asterisk.txt -Source7: rc.asterisk +Source1: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz +Source2: ftp://ftp.europalab.com/pub/sfw/machsnds/asterisk-moh-freeplay-sln16.tar.gz +Source3: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz +Source4: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-sln16-%{V_asterisk_sounds_core}.tar.gz +Source5: http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_AU-sln16-current.tar.gz +Source6: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-es-sln16-%{V_asterisk_sounds_core}.tar.gz +Source7: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-fr-sln16-%{V_asterisk_sounds_core}.tar.gz +Source8: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-sln16-%{V_asterisk_sounds_extra}.tar.gz +Source9: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-fr-sln16-%{V_asterisk_sounds_extra}.tar.gz +Source10: http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz +Source11: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz +Source12: ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_asterisk_sounds_custom}.tar.bz2 +Source13: ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2 +Source14: ftp://ftp.europalab.com/pub/sfw/machsnds/msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2 +Source15: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz +Source16: http://files.freeswitch.org/freeswitch-sounds-es-mx-maria-44100.tar.gz +Source17: http://files.freeswitch.org/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz +Source18: http://files.freeswitch.org/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz +Source19: http://svn.digium.com/svn/thirdparty/mp3/trunk/addons/mp3-%{V_asterisk_addons_mp3dec}.tar.gz +Source20: http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-64/res_fax_digium-%{V_asterisk_fax_digium}-generic_64.tar.gz +Source21: http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-32/res_fax_digium-%{V_asterisk_fax_digium}-generic_32.tar.gz +Source22: ilbc-20110104.tar.gz +Source23: asterisk.txt +Source24: rc.asterisk +Source25: wakeup.agi Patch0: asterisk.patch +Patch1: asterisk.patch.xfersips +Patch2: asterisk.patch.proxymwi # build information -BuildPreReq: OpenPKG, openpkg >= 20100101, bison, gcc, make, grep -PreReq: OpenPKG, openpkg >= 20100101, MTA -BuildPreReq: zlib, curl, openssl, ncurses, speex, popt, gmime22 -PreReq: zlib, curl, openssl, ncurses, speex, popt, gmime22 +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20040130, bison, gcc, make, grep +PreReq: OpenPKG, openpkg >= 20040130, MTA +BuildPreReq: zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml +PreReq: zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml %if "%{with_ogg}" == "yes" BuildPreReq: vorbis-libs PreReq: vorbis-libs @@ -89,14 +126,18 @@ BuildPreReq: sqlite PreReq: sqlite %endif +%if "%{with_srtp}" == "yes" +BuildPreReq: srtp +PreReq: srtp +%endif +%if "%{with_pgsql}" == "yes" +BuildPreReq: postgresql +PreReq: postgresql +%endif %if "%{with_lua}" == "yes" BuildPreReq: lua PreReq: lua %endif -%if "%{with_fax}" == "yes" -BuildPreReq: spandsp, tiff, jpeg, zlib -PreReq: spandsp, tiff, jpeg, zlib -%endif %if "%{with_avcodec}" == "yes" BuildPreReq: ffmpeg PreReq: ffmpeg @@ -117,15 +158,37 @@ BuildPreReq: unixodbc, sqlite, sqlite::with_odbc = yes PreReq: unixodbc, sqlite, sqlite::with_odbc = yes %endif +%if "%{with_libpri}" == "yes" +BuildPreReq: libpri > 1.4.11.5 +PreReq: libpri > 1.4.11.5 +%endif +%if "%{with_esounds}" == "yes" +BuildPreReq: sox +%endif +AutoReq: no +AutoReqProv: no %description Asterisk is a complete Private Branch Exchange (PBX) in software. - It provides all of the features you would expect from a PBX and - more. Asterisk does Voice over IP (VoIP) in many protocols. Asterisk - provides Voicemail services with Directory, Call Conferencing, - Interactive Voice Response and Call Queuing. It has support for - three-way calling, caller ID services, ADSI, SIP, etc. Asterisk - needs no additional hardware for VoIP. + It provides more than the features normally expected from a PBX, + and can transceive Voice over IP (VoIP) in many protocols. Asterisk + provides voicemail services with directory, call conferencing, + interactive voice response and call queuing as well. It has support + for three way calling, caller ID, ADSI, and SIP, and requires no + additional hardware for VoIP applications. + + This copy of Asterisk is optionally patched to allow the asterisk + server to respond to SIP/TLS transfer requests using the Transfer() + application. Should this option be chosen, the asterisk server + successfully dispatches all transfer destinations using 'SIPS' + technology by means of the standard SIP/2.0 302 Moved Temporarily + message, with a URI resembling . + + This copy of Asterisk is optionally patched as well to enclose the + correct user name in NOTIFY messages when MWI logic detects changes + in the state of Messages-Waiting. Asterisk will send NOTIFY messages + with the URI 'user@hostname' instead of simply 'hostname'. This can + be used by a external SIP proxy to route the MWI to the correct phone. %track prog asterisk = { @@ -133,26 +196,51 @@ url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/ regex = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz } - prog asterisk:addons = { - version = %{V_asterisk_addons} - url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/ - regex = asterisk-addons-(\d+\.\d+(\.\d+)+)\.tar\.gz + prog asterisk:fax_digium_32 = { + version = %{V_asterisk_fax_digium} + url = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-32/ + regex = res_fax_digium-(__VER__)-generic_32.tar.gz\.tar\.gz } - prog asterisk:sounds_core_en = { - version = %{V_asterisk_sounds_core_en} + prog asterisk:fax_digium_64 = { + version = %{V_asterisk_fax_digium} + url = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-64/ + regex = res_fax_digium-(__VER__)-generic_64.tar.gz\.tar\.gz + } + prog asterisk:sounds_core = { + version = %{V_asterisk_sounds_core} url = http://downloads.asterisk.org/pub/telephony/sounds/releases/ - regex = asterisk-core-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz + regex = asterisk-core-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz } - prog asterisk:sounds_extra_en = { - version = %{V_asterisk_sounds_extra_en} + prog asterisk:sounds_extra = { + version = %{V_asterisk_sounds_extra} url = http://downloads.asterisk.org/pub/telephony/sounds/releases/ - regex = asterisk-extra-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz + regex = asterisk-extra-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz } - prog asterisk:sounds_core_de = { - version = %{V_asterisk_sounds_core_de} + prog asterisk:sounds_amootts = { + version = %{V_asterisk_sounds_amootts} url = http://www.amooma.de/asterisk/sprachbausteine/ regex = asterisk-core-sounds-de-gsm-(__VER__)\.tar\.gz } + prog asterisk:sounds_amoogab = { + version = %{V_asterisk_sounds_amoogab} + url = http://www.amooma.de/asterisk/sprachbausteine/ + regex = asterisk-(__VER__)-de-prompts\.tar\.gz + } + prog asterisk:sounds_digits = { + version = %{V_asterisk_sounds_custom} + url = ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/ + regex = de-digits-(__VER__)\.tar\.bz2 + } + prog asterisk:sounds_custom = { + version = %{V_asterisk_sounds_custom} + url = ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/ + regex = astmultisnds-de-sln16-(__VER__)\.tar\.bz2 + } + prog asterisk:sounds_mohop = { + version = %{V_asterisk_sounds_mohop} + url = http://downloads.asterisk.org/pub/telephony/sounds/releases/ + regex = asterisk-moh-opsound-sln16-(__VER__)\.tar\.gz + } prog asterisk:chan_capi = { version = %{V_chan_capi} url = ftp://ftp.chan-capi.org/chan-capi/ @@ -162,32 +250,126 @@ %prep %setup -q -n asterisk-%{V_asterisk} %setup -q -n asterisk-%{V_asterisk} -D -T -a 1 - %setup -q -n asterisk-%{V_asterisk} -D -T -a 5 + %setup -q -n asterisk-%{V_asterisk} -D -T -a 2 +%if "%{with_fax}" == "yes" + %setup -q -n asterisk-%{V_asterisk} -D -T -a 20 + %setup -q -n asterisk-%{V_asterisk} -D -T -a 21 +%endif + ( cd addons + %{l_tar} zxf %{_sourcedir}/mp3-%{V_asterisk_addons_mp3dec}.tar.gz + ) || exit $? + ( cd codecs + %{l_tar} zxf %{_sourcedir}/ilbc-%{V_asterisk_codecs_ilbc}.tar.gz + mv ilbc-%{V_asterisk_codecs_ilbc}/* ilbc/ + rmdir ilbc-%{V_asterisk_codecs_ilbc} + ) || exit $? %patch -p0 - exit 0 - cp %{SOURCE2} %{SOURCE3} sounds/ +%if "%{with_xfersips}" == "yes" + %patch -p0 -P 1 +%endif +%if "%{with_proxymwi}" == "yes" + %patch -p0 -P 2 +%endif %{l_shtool} subst \ - -e 's;\(CORE_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_core_en};' \ - -e 's;\(EXTRA_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_extra_en};' \ + -e 's;\(astdatadir=.*\)\${astvarlibdir};\1${datadir};' \ + -e 's;\(astvarlibdir=.*\)/lib/asterisk;\1/asterisk/lib;' \ + -e 's;\(dir=.*{localstatedir}\)/\([^/][^/]*\)/asterisk;\1/asterisk/\2;g' \ + configure + %{l_shtool} subst \ + -e 's;-llua5\.1;-llua;' \ + -e 's;lua5\.1/lua\.h;lua/lua.h;' \ + -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \ + -e 's;\(sqlite\)\(_exec\);\13\2;g' \ + -e 's;-lradiusclient-ng;-lradiusclient;g' \ + -e 's;radiusclient-ng\.h;radiusclient.h;g' \ + -e 's;-I${IMAP_TK_DIR}/c-client;-DUSE_SYSTEM_IMAP -I${IMAP_TK_DIR}/include/imap;g' \ + -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \ + configure + %{l_shtool} subst \ + -e 's;\(sh\) \(bash\) ksh sh5;\2 \1;' \ + configure + %{l_shtool} subst \ + -e 's;^\(#define DEFAULT_DB .*\${ASTDBDIR}\)/astdb;\1/asterisk.db;' \ + build_tools/make_defaults_h + %{l_shtool} subst \ + -e 's; *-I/usr/local/ssl/include;;g' \ + -e 's;/opt/ssl/include;%{l_prefix}/include;g' \ + -e 's;/usr/local;%{l_prefix};g' \ + Makefile + %{l_shtool} subst \ + -e 's;\$(SUBMAKE);$(MAKE);g' \ + -e 's;\$(SILENTMAKE);$(MAKE) --quiet --no-print-directory;g' \ + -e 's;\$(MAKE_MENUSELECT); $(MAKE) -C menuselect;g' \ + Makefile + %{l_shtool} subst \ + -e 's; *-L/usr/local/ssl/lib;;g' \ + -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \ + -e 's;/usr/local;%{l_prefix};g' \ + -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \ + -e 's;\( CFLAGS=\)"[^"]+";"%{l_cflags -O}";g' \ + main/Makefile + %{l_shtool} subst \ + -e 's;\(\)no\(\);\1yes\2;g' \ + addons/.*.moduleinfo \ + apps/.app_ivrdemo.moduleinfo \ + apps/.app_saycounted.moduleinfo \ + apps/.app_rpt.moduleinfo \ + codecs/.moduleinfo \ + utils/utils.xml \ + agi/agi.xml + %{l_shtool} subst \ + -e 's;check_expr2;check_expr;g' \ + utils/utils.xml + %{l_shtool} subst \ + -e 's;\(-DSOLARIS\);\1 -D__EXTENSIONS__=1;g' \ + main/editline/Makefile.in \ + main/db1-ast/Makefile + %{l_shtool} subst \ + -e 's;%s/astdb;%s/asterisk.db;g' \ + main/asterisk.c + %{l_shtool} subst \ + -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \ + main/db1-ast/hash/hash.h + %{l_shtool} subst \ + -e 's;if \(((tmp = strchr(name\);while \1;g' \ + main/abstract_jb.c + %{l_shtool} subst \ + -e 's;\(CORE_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_core};' \ + -e 's;\(EXTRA_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_extra};' \ sounds/Makefile %{l_shtool} subst \ - -e 's;-lradiusclient-ng;-lradiusclient;g' \ - -e 's;radiusclient-ng\.h;radiusclient.h;g' \ - configure cdr/cdr_radius.c + -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \ + -e 's;\(radiusclient\)-ng;\1;g' \ + cdr/cdr_radius.c \ + cel/cel_radius.c + %{l_shtool} subst \ + -e 's;\(sqlite\)\(\.h\);\13\2;g' \ + cdr/cdr_sqlite.c + %{l_shtool} subst \ + -e 's;\(#define DEFAULT_POLLING_INTERVAL\) .*;\1 %{with_smdipoll};' \ + res/res_smdi.c + %{l_shtool} subst \ + -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \ + -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \ + -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \ + -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \ + -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \ + -e 's;^\(USE_OWN_LIBCAPI\)=yes;\1=no;' \ + chan_capi-%{V_chan_capi}/Makefile %build - # sanity check + # sanity check operating system %if "%{with_dahdi}" == "yes" dahdi_prefix="" case "%{l_platform -t}" in *-linux* ) - if [ ! -f /usr/include/linux/dahdi.h ]; then + if [ ! -f /usr/include/dahdi/user.h ]; then echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1 fi dahdi_prefix=/usr ;; *-freebsd* ) - if [ ! -f /usr/local/include/dahdi/dahdi.h ]; then + if [ ! -f /usr/local/include/dahdi/user.h ]; then echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1 fi dahdi_prefix=/usr/local @@ -195,8 +377,15 @@ * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;; esac %endif + # correct platform dependent build configuration + extflg= + case "%{l_platform -t}" in + *-linux* ) + pthlibflg='-lpthread' + ;; + esac - # re-configure music-on-hold to find mpg123 + # adapt buildconf to find mpg123 (for music on hold) %if "%{with_mp3}" == "yes" mpg123="%{l_prefix}/bin/mpg123" %else @@ -207,21 +396,16 @@ -e "s;/usr/bin/mpg123;$mpg123;" \ res/res_musiconhold.c apps/app_mp3.c - # build program - %{l_shtool} subst \ - -e 's;-llua5\.1;-llua;' \ - -e 's;lua5\.1/lua\.h;lua/lua.h;' \ - -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \ - configure + # configure program ( echo "ac_cv_prog_CONFIG_GMIME=%{l_prefix}/bin/gmime-config" ) >config.cache cflags="%{l_cflags -O}" - cppflags="%{l_cppflags ncurses lua .}" + cppflags="%{l_cppflags ncurses lua}" ldflags="%{l_ldflags}" libs="" - cppflags="$cppflags `pkg-config gmime-2.0 --cflags-only-I`" - ldflags="$ldflags `pkg-config gmime-2.0 --libs-only-L`" - libs="$libs `pkg-config gmime-2.0 --libs-only-l`" + cppflags="$cppflags `pkg-config gmime-2.4 --cflags-only-I`" + ldflags="$ldflags `pkg-config gmime-2.4 --libs-only-L`" + libs="$libs `pkg-config gmime-2.4 --libs-only-l` -lssl -lcrypto" %if "%{with_ogg}" == "yes" libs="$libs -logg -lm" %endif @@ -229,7 +413,7 @@ libs="$libs -lavcodec -lavutil" %endif %if "%{with_ldap}" == "yes" - libs="$libs -lldap -llber -lssl -lcrypto" + libs="$libs -lldap -llber" %endif %if "%{with_dahdi}" == "yes" cppflags="$cppflags -I$dahdi_prefix/include" @@ -240,14 +424,18 @@ CPPFLAGS="$cppflags" \ LDFLAGS="$ldflags" \ LIBS="$libs" \ + INSTALL="%{l_shtool} install -c" \ + PTHREAD_LIBS="$pthlibflg" \ ./configure \ --cache-file=./config.cache \ --prefix=%{l_prefix} \ --mandir=%{l_prefix}/man \ --sysconfdir=%{l_prefix}/etc \ - --localstatedir=%{l_prefix}/var/asterisk \ + --localstatedir=%{l_prefix}/var \ + --datarootdir=%{l_prefix}/share/asterisk \ + --with-crypto=%{l_prefix} \ --with-curl=%{l_prefix} \ - --with-ncurses \ + --with-ncurses=%{l_prefix} \ --with-gsm="internal" \ --with-popt=%{l_prefix} \ %if "%{with_sqlite}" == "yes" @@ -255,6 +443,16 @@ %else --without-sqlite3 \ %endif +%if "%{with_srtp}" == "yes" + --with-srtp=%{l_prefix} \ +%else + --without-srtp \ +%endif +%if "%{with_pgsql}" == "yes" + --with-postgres=%{l_prefix} \ +%else + --with-postgres=no \ +%endif --with-speex=%{l_prefix} \ --with-speexdsp=%{l_prefix} \ --with-ssl=%{l_prefix} \ @@ -301,6 +499,7 @@ %endif %if "%{with_imap}" == "yes" --with-imap=%{l_prefix} \ + --disable-largefile \ %else --without-imap \ %endif @@ -309,80 +508,83 @@ %else --without-odbc \ %endif +%if "%{with_libpri}" == "yes" + --with-pri=%{l_prefix} \ +%else + --without-pri \ +%endif + --with-sounds-cache=no \ --without-netsnmp \ --without-isdnnet \ --without-misdn \ - --without-kde \ --without-nbs \ --without-newt \ --without-asound \ --without-oss \ - --without-qt \ --without-sqlite \ - --without-postgres \ --without-tds \ --without-osptk \ - --without-pri \ --without-suppserv \ --without-vpb \ --without-sdl \ --without-x11 \ --without-gtk \ --without-gtk2 - %{l_make} %{l_mflags} \ - CC="%{l_cc} $cflags -I. -I./include -I../include -I../../include $cppflags" + + # build menuselect + %{l_make} %{l_mflags -O} menuselect.makeopts + %{l_shtool} subst \ + -e 's;\(MENUSELECT_MOH=\).*;\1;' \ + -e 's;\(MENUSELECT_CORE_SOUNDS=\).*;\1;' \ + -e 's;\(MENUSELECT_EXTRA_SOUNDS=\).*;\1;' \ + menuselect.makeopts +%if "%{with_imap}" == "yes" + %{l_shtool} subst \ + -e 's;\(MENUSELECT_OPTS_app_voicemail=\).*;\1IMAP_STORAGE;' \ + menuselect.makeopts +%endif + + # build program + %{l_make} %{l_mflags -O} \ + CC="%{l_cc} $cflags -I../include -I../../include $cppflags" NOISY_BUILD=yes # build addon modules - ( cd asterisk-addons-* - ASTERISK_DIR="`pwd`/.." \ - CC="%{l_cc}" \ - CFLAGS="%{l_cflags -O}" \ - CPPFLAGS="%{l_cppflags ncurses tiff .}" \ - LDFLAGS="%{l_ldflags}" \ -%if "%{with_fax}" == "yes" - LIBS="-ltiff -ljpeg -lz -lm" \ -%else - LIBS="-lm" \ -%endif - ./configure \ - --prefix=%{l_prefix} \ - --mandir=%{l_prefix}/man \ - --sysconfdir=%{l_prefix}/etc \ - --localstatedir=%{l_prefix}/var/asterisk \ - --with-ncurses \ - --with-asterisk \ - --without-mysqlclient \ -%if "%{with_fax}" == "yes" - --with-spandsp=%{l_prefix} -%else - --without-spandsp -%endif - %{l_make} %{l_mflags} \ - CC="%{l_cc} %{l_cflags -O} -I. %{l_cppflags ncurses tiff .}" + ( cd addons + %{l_make} %{l_mflags -O} \ + CC="%{l_cc} %{l_cflags -O} -I../../include %{l_cppflags ncurses}" NOISY_BUILD=yes ASTTOPDIR=.. ) || exit $? + + # build agi programs + ( cd agi && %{l_make} %{l_mflags -O}) || exit $? + %if "%{with_capi}" == "yes" + # build capi channel ( cd chan_capi-* ln -s ../include/asterisk . ln -s ../include/asterisk.h . - %{l_make} %{l_mflags} \ + %{l_make} %{l_mflags -O} V=1 \ INSTALL_PREFIX=%{l_prefix} \ - ASTERISK_HEADER_DIR="`pwd`" + ASTERISK_HEADER_DIR="`pwd`" \ ) || exit $? %endif %install # install program + rm -rf $RPM_BUILD_ROOT %{l_make} %{l_mflags} install \ DESTDIR=$RPM_BUILD_ROOT \ INSTALL_PREFIX=%{l_prefix} # install addon modules - ( cd asterisk-addons-* + ( cd addons %{l_make} %{l_mflags} install \ + ASTTOPDIR=.. \ DESTDIR=$RPM_BUILD_ROOT \ INSTALL_PREFIX=%{l_prefix} ) || exit $? + %if "%{with_capi}" == "yes" + # install capi channel ( cd chan_capi-* %{l_make} %{l_mflags} install \ INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \ @@ -391,34 +593,163 @@ ) || exit $? %endif - # install addon sounds - %{l_shtool} mkdir -f -p -m 755 \ - $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de - ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de - %{l_gzip} -d -c %{SOURCE4} | %{l_tar} xf - - ) || exit $? +%if "%{with_fax}" == "yes" + # install fax support + case "%{l_platform -t}" in + amd64*-* ) + %{l_shtool} install -c -m 755 \ + res_fax_digium-%{V_asterisk_fax_digium}-generic_64/res_*.so \ + $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/ + %{l_shtool} install -c -m 640 \ + res_fax_digium-%{V_asterisk_fax_digium}-generic_64/*.conf \ + $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/ + ;; + i?86-* ) + %{l_shtool} install -c -m 755 \ + res_fax_digium-%{V_asterisk_fax_digium}-generic_32/res_*.so \ + $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/ + %{l_shtool} install -c -m 640 \ + res_fax_digium-%{V_asterisk_fax_digium}-generic_32/*.conf \ + $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/ + ;; + *-* ) + echo "Error determining hardware architecture." \ + | %{l_rpmtool} msg -b -t warn + exit 1; + ;; + esac +%endif + + ( echo 'Start of sound installation block (RPM)' +%if "%{with_esounds}" == "yes" + # install freeswitch sound prompt files, expecting + # identical sound filenames to be overwritten later + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en + %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz + subs=`( cd en/us/callie && find * -type d -prune )` + for subdir in $subs; do + mkdir $subdir + mv -f en/us/callie/$subdir/*/* ${subdir}/ + done + rm -rf en + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es + %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-es-mx-maria-44100.tar.gz + subs=`( cd es/mx/maria && find * -type d -prune )` + for subdir in $subs; do + mkdir $subdir + mv -f es/mx/maria/$subdir/*/* ${subdir}/ + done + rm -rf es + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru + %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz + subs=`( cd ru/RU/elena && find * -type d -prune )` + for subdir in $subs; do + mkdir $subdir + mv -f ru/RU/elena/$subdir/*/* ${subdir}/ + done + rm -rf ru + + # install freeswitch music on hold files + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh + %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz + mv -f music/48000/* . && rm -rf music + + # convert freeswitch 48000 and 441000 KHz to 8000 Khz + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk + for highfile in `find . -name '*.wav'`; do + lowfile=`echo $highfile | sed -e 's;\(.*\)\.wav;\1.sln16;'` + %{l_prefix}/bin/sox $highfile -t raw -r 16000 -s -2 -c 1 $lowfile + rm $highfile + done +%endif + + # install australian nonversioned sound prompt files + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en_AU + %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-en_AU-current.tar.gz + + # install main sound prompt files + #for codec in alaw ulaw g722 g729 gsm; do + for lang in en es fr; do + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang} + %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-sln16-%{V_asterisk_sounds_core}.tar.gz + done + for lang in en fr; do + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang} + %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-${lang}-sln16-%{V_asterisk_sounds_extra}.tar.gz + done + + # install special case sound files + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds + #%{l_tar} jxf %{SOURCE de-digits-%{V_asterisk_sounds_custom}.tar.bz2} + #( cd de && %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_amootts}.tar.gz} ) || exit $? + #%{l_tar} zxf %{SOURCE asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz} + #mv -f dictate/de/* de/dictate/ && rm -rf dictate/de + #mv -f digits/de/* de/digits/ && rm -rf digits/de + #mv -f letters/de/* de/letters/ && rm -rf letters/de + #mv -f phonetic/de/* de/phonetic/ && rm -rf phonetic/de + %{l_tar} jxf %{SOURCE astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2} + %{l_tar} jxf %{SOURCE msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2} + + # install additional asterisk music on hold + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh + %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-sln16.tar.gz + %{l_tar} zxf %{_sourcedir}/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz + + # correct sound permissions + find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type f \ + | xargs chmod 644 + find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type d \ + | xargs chmod 755 + + # apply provisional workaround for bug 0016104 + # https://issues.asterisk.org/view.php?id=16104 + cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds + cd en && ln -s vm-INBOX.sln16 vm-Voicemail.sln16 + cd ../es && ln -s vm-INBOX.sln16 vm-Voicemail.sln16 + cd ../de && ln -s vm-INBOX.sln16 vm-Voicemail.sln16 + cd ../fr && ln -s vm-INBOX.sln16 vm-Voicemail.sln16 + +# # install nonstandard voicemail prompts +# %{l_shtool} mkdir -f -p -m 755 \ +# $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail +# %{l_shtool} install -c -m 660 \ +# %{_sourcedir}/ansage-%{V_ansage}.wav} \ +# $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav + ) || exit $? # End of sound installation block (RPM) # strip down installation rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true - rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/firmware >/dev/null 2>&1 || true rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true - rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/.asterisk* >/dev/null 2>&1 || true - rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CREDIT* >/dev/null 2>&1 || true - rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CHANGES* >/dev/null 2>&1 || true - rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es >/dev/null 2>&1 || true - rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/fr >/dev/null 2>&1 || true + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CREDIT* >/dev/null 2>&1 || true + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CHANGES* >/dev/null 2>&1 || true + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CREDIT* >/dev/null 2>&1 || true + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CHANGES* >/dev/null 2>&1 || true # create additional directories %{l_shtool} mkdir -f -p -m 755 \ - $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db + $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db \ + $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/lib/licenses \ + $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing - # post-adjust installation - strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true + # postadjust installation + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* \ + $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \ + $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \ + >/dev/null 2>&1 || true mv $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \ $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin + + # install AGI progs + ( cd agi + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + DialAnMp3.agi fastagi-test numeralize %{SOURCE wakeup.agi} \ + $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/ + ) || exit $? for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'` done @@ -444,7 +775,7 @@ $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/ done - # install run-command script + # install runcommand script %{l_shtool} mkdir -f -p -m 755 \ $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d %{l_shtool} install -c -m 755 %{l_value -s -a} \ @@ -453,12 +784,18 @@ # determine installation files %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ %{l_files_std} \ + '%config %{l_prefix}/var/asterisk/lib/licenses' \ '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \ '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk' +# '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/es/vm-Voicemail.sln16' \ +# '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/de/vm-Voicemail.sln16' \ +# '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/fr/vm-Voicemail.sln16' \ + %files -f files %clean + rm -rf $RPM_BUILD_ROOT %post %if "%{with_dahdi}" == "yes" @@ -495,6 +832,16 @@ ) || exit $? fi %endif +%if "%{with_fax}" == "yes" + ( echo "Asterisk has been installed with proprietary Digium fax support." + echo "The responsible module is called res_fax_digium and requires a" + echo "valid license. The license must be found in the directory" + echo "'licenses' which in turn must be found in $prefix/var/asterisk/lib" + echo "or wherever astvarlibdir has been configured in 'asterisk.conf'." + echo "" + echo "Please see http://downloads.digium.com/pub/telephony/fax/ for information." + ) | %{l_rpmtool} msg -b -t notice +%endif # after upgrade, restart service [ $1 -eq 2 ] || exit 0 eval `%{l_rc} asterisk status 2>/dev/null` @@ -509,6 +856,7 @@ rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/asterisk/lib/* >/dev/null 2>&1 || true rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/* >/dev/null 2>&1 || true %if "%{with_odbc}" == "yes" # before erase, optionally unlink from ODBC and destroy database