summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Vroon <chainsaw@gentoo.org>2009-10-22 14:47:55 +0000
committerTony Vroon <chainsaw@gentoo.org>2009-10-22 14:47:55 +0000
commit8f39e129f30a1c09ffc83eb2418a586685c8f9a2 (patch)
tree586c2070b50a938ba249b0cd5fde5804685855fb /net-misc/asterisk
parentMask new media-libs/x264 snapshot for testing. (diff)
downloadgentoo-2-8f39e129f30a1c09ffc83eb2418a586685c8f9a2.tar.gz
gentoo-2-8f39e129f30a1c09ffc83eb2418a586685c8f9a2.tar.bz2
gentoo-2-8f39e129f30a1c09ffc83eb2418a586685c8f9a2.zip
Revision bump. Init script now depends on dahdi, not zaptel (bug #279436). FXO ports can now carry outbound calls immediately, without requiring an inbound call first (bug #281467) and transferring queue calls no longer segfaults. With thanks to Jaco Kroon. Troublesome H323 support removed due to pwlib dependency in openh323 (bug #290065) and IMAP support removed as it never worked right (bug #265567). Bug reports on either only accepted with patches.
(Portage version: 2.1.7.1/cvs/Linux x86_64)
Diffstat (limited to 'net-misc/asterisk')
-rw-r--r--net-misc/asterisk/ChangeLog16
-rw-r--r--net-misc/asterisk/asterisk-1.2.32.ebuild407
-rw-r--r--net-misc/asterisk/asterisk-1.6.1.6-r1.ebuild417
-rw-r--r--net-misc/asterisk/files/1.6.1/asterisk-1.6.1.6-fxsks-hookstate.patch31
-rw-r--r--net-misc/asterisk/files/1.6.1/asterisk-1.6.1.6-transfer-segfault.patch23
-rw-r--r--net-misc/asterisk/files/1.6.1/asterisk.initd253
6 files changed, 739 insertions, 408 deletions
diff --git a/net-misc/asterisk/ChangeLog b/net-misc/asterisk/ChangeLog
index 15036a85d69e..5a14d09f47fd 100644
--- a/net-misc/asterisk/ChangeLog
+++ b/net-misc/asterisk/ChangeLog
@@ -1,6 +1,20 @@
# ChangeLog for net-misc/asterisk
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/ChangeLog,v 1.216 2009/10/01 17:20:34 armin76 Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/ChangeLog,v 1.217 2009/10/22 14:47:54 chainsaw Exp $
+
+*asterisk-1.6.1.6-r1 (22 Oct 2009)
+
+ 22 Oct 2009; <chainsaw@gentoo.org> +asterisk-1.6.1.6-r1.ebuild,
+ +files/1.6.1/asterisk-1.6.1.6-fxsks-hookstate.patch,
+ +files/1.6.1/asterisk.initd, -asterisk-1.2.32.ebuild,
+ +files/1.6.1/asterisk-1.6.1.6-transfer-segfault.patch:
+ Revision bump. Init script now depends on dahdi, not zaptel (bug #279436).
+ FXO ports can now carry outbound calls immediately, without requiring an
+ inbound call first (bug #281467) and transferring queue calls no longer
+ segfaults. With thanks to Jaco Kroon. Troublesome H323 support removed due
+ to pwlib dependency in openh323 (bug #290065) and IMAP support removed as
+ it never worked right (bug #265567). Bug reports on either only accepted
+ with patches.
01 Oct 2009; Raúl Porcel <armin76@gentoo.org> asterisk-1.2.35.ebuild:
sparc stable wrt #283624
diff --git a/net-misc/asterisk/asterisk-1.2.32.ebuild b/net-misc/asterisk/asterisk-1.2.32.ebuild
deleted file mode 100644
index 09667bc4b9ba..000000000000
--- a/net-misc/asterisk/asterisk-1.2.32.ebuild
+++ /dev/null
@@ -1,407 +0,0 @@
-# Copyright 1999-2009 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/asterisk-1.2.32.ebuild,v 1.6 2009/07/21 13:36:22 chainsaw Exp $
-
-EAPI=2
-inherit eutils multilib toolchain-funcs
-
-IUSE="alsa curl debug doc gtk h323 hardened lowmem mmx nosamples \
- odbc osp postgres pri sqlite ssl speex zaptel elibc_uclibc"
-
-AST_PATCHES="1.2.27-patches-1.0"
-
-MY_P="${P/_p/.}"
-
-DESCRIPTION="Asterisk: A Modular Open Source PBX System"
-HOMEPAGE="http://www.asterisk.org/"
-SRC_URI="http://downloads.digium.com/pub/asterisk/releases/${MY_P}.tar.gz
- mirror://gentoo/${PN}-${AST_PATCHES}.tar.bz2"
-
-S="${WORKDIR}/${MY_P}"
-
-SLOT="0"
-LICENSE="GPL-2"
-KEYWORDS="alpha amd64 ~hppa ppc sparc x86"
-
-RDEPEND="dev-libs/newt
- media-sound/sox
- ssl? ( dev-libs/openssl )
- gtk? ( =x11-libs/gtk+-1.2* )
- pri? ( >=net-libs/libpri-1.2.5[-bri] )
- h323? ( >=dev-libs/pwlib-1.8.3
- >=net-libs/openh323-1.15.0 )
- alsa? ( media-libs/alsa-lib )
- curl? ( net-misc/curl )
- odbc? ( dev-db/unixODBC )
- speex? ( media-libs/speex )
- sqlite? ( <dev-db/sqlite-3.0.0 )
- zaptel? ( >=net-misc/zaptel-1.2.16 )
- postgres? ( virtual/postgresql-base )
- osp? ( >=net-libs/osptoolkit-3.3.4 )"
-
-DEPEND="${RDEPEND}
- sys-devel/flex
- sys-devel/bison
- doc? ( app-doc/doxygen )
- virtual/logger"
-
-#asterisk uses special mpg123 functions and does not work with mpeg321, bug #42703
-PDEPEND="|| ( media-sound/mpg123 net-misc/asterisk-addons )"
-
-QA_TEXTRELS_x86="usr/lib/asterisk/modules/codec_gsm.so"
-QA_EXECSTACK_x86="usr/lib/asterisk/modules/codec_gsm.so"
-
-#
-# List of modules to ignore during scan (because they have been removed in 1.2.x)
-#
-SCAN_IGNORE_MODS="
- app_qcall
- chan_modem
- chan_modem_i4l
- chan_modem_bestdata
- chan_modme_aopen"
-
-#
-# shortcuts
-#
-is_ast10update() {
- return $(has_version "=net-misc/asterisk-1.0*")
-}
-
-is_astupdate() {
- if ! is_ast10update; then
- return $(has_version "<net-misc/asterisk-${PV}")
- fi
- return 0
-}
-
-#
-# Scan for asterisk-1.0.x modules that will have to be updated
-#
-scan_modules() {
- local modules_list=""
- local n
-
- for x in $(ls -1 "${ROOT}"usr/$(get_libdir)/asterisk/modules/*.so); do
- echo -en "Scanning.... $(basename ${x}) \r"
-
- # skip blacklisted modules
- hasq $(basename ${x//.so}) ${SCAN_IGNORE_MODS} && continue
-
- if $(readelf -s "${x}" | grep -q "\(ast_load\|ast_destroy\)$"); then
- modules_list="${modules_list} $(basename ${x//.so})"
- fi
- done
-
- if [[ -n "${modules_list}" ]]; then
- echo " ========================================================"
- ewarn "Please update or unmerge the following modules:"
- echo
-
- n=0
- for x in ${modules_list}; do
- ewarn " - ${x}"
- (( n++ ))
- done
-
- echo
- ewarn "Warning: $n outdated module(s) found!"
- ewarn "Warning: asterisk may not work if you don't update them!"
- echo " ========================================================"
- echo
- einfo "You can use the \"asterisk-updater\" script to update the modules"
- epause
- echo
- return 1
- else
- einfo "No asterisk-1.0.x modules found!"
- return 0
- fi
-}
-
-pkg_setup() {
- local checkfailed=0 waitaftermsg=0
-
- if is_ast10update; then
- ewarn " Asterisk UPGRADE Warning"
- ewarn ""
- ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.gz after the installation!"
- ewarn ""
- ewarn " Asterisk UPGRADE Warning"
- echo
- waitaftermsg=1
- fi
-
- #
- # Regular checks
- #
- einfo "Running some pre-flight checks..."
- echo
-
-}
-
-src_prepare() {
- #
- # gentoo patchset
- #
- for x in $(grep -v "^#\| \+" "${WORKDIR}"/patches/patches.list); do
- epatch "${WORKDIR}"/patches/${x}
- done
-
- if use mmx; then
- if ! use hardened; then
- einfo "Enabling mmx optimization"
- sed -i -e "s:^#\(K6OPT[\t ]\+= -DK6OPT\):\1:" \
- Makefile
- else
- ewarn "Hardened use-flag is set, not enabling mmx optimization for codec_gsm!"
- fi
- fi
-
- if ! use debug; then
- einfo "Disabling debug support"
- sed -i -e "s:^\(DEBUG=\):#\1:" \
- Makefile
- fi
-
- if ! use ssl; then
- einfo "Disabling crypto support"
- sed -i -e 's:^#\(NOCRYPTO=yes\):\1:' \
- -e '/^LIBS+=-lssl/d' Makefile || die
- fi
-
- epatch "${FILESDIR}/1.2.0/asterisk-1.2.21.1-h323-dumb-makefile.diff"
- epatch "${FILESDIR}/1.2.0/${P}-svn89254.diff"
- epatch "${FILESDIR}/1.2.0/${P}-comma-is-not-pipe.diff"
-
- #
- # uclibc patch
- #
- if use elibc_uclibc; then
- einfo "Patching asterisk for uclibc..."
- epatch "${FILESDIR}"/1.0.0/${PN}-1.0.5-uclibc-dns.diff
- epatch "${FILESDIR}"/1.2.0/${PN}-1.2.1-uclibc-getloadavg.diff
- fi
-
- #
- # Disable AEL, security bug #171884
- # Re-enable at your own risk (no USE since it can be critical)
- #
- sed -i -e 's/pbx_ael.so//' pbx/Makefile || die
-
- # codecs/Makefile does not add -lspeexdsp needed for speex 1.2, bug #206463
- if use speex && has_version ">=media-libs/speex-1.2"; then
- sed -i -e "s/-lspeex/-lspeex -lspeexdsp/" codecs/Makefile \
- || die "patching codecs/Makefile failed"
- fi
-}
-
-src_compile() {
- local myopts
-
- use lowmem && \
- myopts="-DLOW_MEMORY"
-
- if use h323; then
- einfo "Building H.323 wrapper lib..."
- make -C channels/h323 \
- NOTRACE=1 \
- PWLIBDIR=/usr/share/pwlib \
- OPENH323DIR=/usr/share/openh323 \
- libchanh323.a Makefile.ast || die "Make h323 failed"
- fi
-
- einfo "Building Asterisk..."
- make \
- CC=$(tc-getCC) \
- NOTRACE=1 \
- OPTIMIZE="${CFLAGS}" \
- PWLIBDIR=/usr/share/pwlib \
- OPENH323DIR=/usr/share/openh323 \
- OPTIONS="${myopts}" || die "Make failed"
-
- # create api docs
- use doc && \
- make progdocs
-}
-
-src_install() {
-
- # install asterisk
- make DESTDIR="${D}" ASTLIBDIR="\$(INSTALL_PREFIX)/usr/$(get_libdir)/asterisk" install || die "Make install failed"
- make DESTDIR="${D}" ASTLIBDIR="\$(INSTALL_PREFIX)/usr/$(get_libdir)/asterisk" samples || die "Failed to create sample files"
-
- # remove installed sample files if nosamples flag is set
- if use nosamples; then
- einfo "Skipping installation of sample files..."
- rm -rf "${D}"var/spool/asterisk/voicemail/default
- rm -f "${D}"var/lib/asterisk/mohmp3/*
- rm -f "${D}"var/lib/asterisk/sounds/demo-*
- rm -f "${D}"var/lib/asterisk/agi-bin/*
- else
- einfo "Sample files have been installed"
- keepdir /var/spool/asterisk/voicemail/default/1234/INBOX
- fi
-
- # move sample configuration files to doc directory
- if is_ast10update; then
- elog "Updating from old (pre-1.2) asterisk version, new configuration files have been installed"
- elog "into "${ROOT}"etc/asterisk, use etc-update or dispatch-conf to update them"
- elif has_version "net-misc/asterisk"; then
- elog "Configuration samples have been moved to: $ROOT/usr/share/doc/${PF}/conf"
- insinto /usr/share/doc/${PF}/conf
- doins "${D}"etc/asterisk/*.conf*
- rm -f "${D}"etc/asterisk/*.conf* 2>/dev/null
- fi
-
- # don't delete these directories, even if they are empty
- for x in voicemail meetme system dictate monitor tmp; do
- keepdir /var/spool/asterisk/${x}
- done
- keepdir /var/lib/asterisk/sounds/priv-callerintros
- keepdir /var/lib/asterisk/mohmp3
- keepdir /var/lib/asterisk/agi-bin
- keepdir /var/log/asterisk/cdr-csv
- keepdir /var/log/asterisk/cdr-custom
- keepdir /var/run/asterisk
-
- # install astxs
- dobin contrib/scripts/astxs
-
- newinitd "${FILESDIR}"/1.2.0/asterisk.rc6 asterisk
- newconfd "${FILESDIR}"/1.2.0/asterisk.confd asterisk
-
- # install standard docs...
- dodoc BUGS CREDITS ChangeLog HARDWARE README README.fpm
- dodoc SECURITY doc/CODING-GUIDELINES doc/linkedlists.README UPGRADE.txt
- dodoc doc/README.*
- dodoc doc/*.txt
-
- docinto scripts
- dodoc contrib/scripts/*
-
- docinto utils
- dodoc contrib/utils/*
-
- docinto configs
- dodoc configs/*
-
- # install api docs
- if use doc; then
- insinto /usr/share/doc/${PF}/api/html
- doins doc/api/html/*
- fi
-
- insinto /usr/share/doc/${PF}/cgi
- doins contrib/scripts/vmail.cgi
- doins images/*.gif
-
- # install asterisk-updater
- dosbin "${FILESDIR}"/1.2.0/asterisk-updater
-
- # install asterisk.h, a lot of external modules need this
- insinto /usr/include/asterisk
- doins include/asterisk.h
-
- # make sure misdn/capi stuff is not installed, provided by asterisk-chan_..
- rm -f "${D}"/etc/asterisk/misdn.conf "${D}"/usr/lib/asterisk/modules/chan_misdn.so \
- "${D}"/usr/share/doc/${PF}/{conf/misdn.conf,configs/misdn.conf.sample.gz,README.misdn.gz}
- rm -f "${D}"/usr/include/asterisk/chan_capi{,_app}.h \
- "${D}"/usr/share/doc/${PF}/{conf/capi.conf,configs/capi.conf.sample.gz}
-
- # make sure the broken speex support does not keep Asterisk from starting up
- # bug #206463 if you care about this. solution needs to work with --as-needed
-# rm -f "${D}"usr/$(get_libdir)/asterisk/modules/codec_speex.so 2>/dev/null
- rm -f "${D}"usr/$(get_libdir)/asterisk/modules/codec_speex.so || die "BROKEN"
-}
-
-pkg_preinst() {
- enewgroup asterisk
- enewuser asterisk -1 -1 /var/lib/asterisk "asterisk,dialout"
-}
-
-pkg_postinst() {
- einfo "Fixing permissions"
- chown -R asterisk:asterisk "${ROOT}"var/log/asterisk
- chmod -R u=rwX,g=rX,o= "${ROOT}"var/log/asterisk
-
- for x in lib run spool; do
- chown -R asterisk:asterisk "${ROOT}"var/${x}/asterisk
- chmod -R u=rwX,g=rwX,o= "${ROOT}"var/${x}/asterisk
- done
-
- chown asterisk:asterisk "${ROOT}"etc/asterisk/
- chown asterisk:asterisk "${ROOT}"etc/asterisk/*.adsi
- chown asterisk:asterisk "${ROOT}"etc/asterisk/extensions.ael
- chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/
- chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/*.adsi
- chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/extensions.ael
- echo
-
- #
- # Announcements, warnings, reminders...
- #
- einfo "Asterisk has been installed"
- einfo ""
- elog "If you want to know more about asterisk, visit these sites:"
- elog "http://www.asteriskdocs.org/"
- elog "http://www.voip-info.org/wiki-Asterisk"
- elog
- elog "http://www.automated.it/guidetoasterisk.htm"
- elog
- elog "Gentoo VoIP IRC Channel:"
- elog "#gentoo-voip @ irc.freenode.net"
- elog
- elog "Please note that AEL is no longer built because of security bugs"
- elog "See http://bugs.gentoo.org/show_bug.cgi?id=171884"
- elog
- echo
- echo
-
- #
- # Warning about 1.0 -> 1.2 changes...
- #
- if is_ast10update; then
- ewarn ""
- ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.gz before continuing"
- ewarn ""
- fi
-
- if is_astupdate; then
- ewarn ""
- ewarn " - The initgroups patch has been dropped, please update your"
- ewarn " \"conf.d/asterisk\" and \"init.d/asterisk\" file!"
- ewarn ""
- fi
-
- # scan for old modules
- if is_ast10update; then
- einfo "Asterisk has been updated from pre-1.2.x, scanning for old modules"
- scan_modules
- fi
-}
-
-pkg_config() {
- einfo "Do you want to reset file permissions and ownerships (y/N)?"
-
- read tmp
- tmp="$(echo $tmp | tr [:upper:] [:lower:])"
-
- if [[ "$tmp" = "y" ]] ||\
- [[ "$tmp" = "yes" ]]
- then
- einfo "Resetting permissions to defaults..."
-
- for x in spool run lib log; do
- chown -R asterisk:asterisk "${ROOT}"var/${x}/asterisk
- chmod -R u=rwX,g=rX,o= "${ROOT}"var/${x}/asterisk
- done
-
- chown -R root:asterisk "${ROOT}"etc/asterisk
- chmod -R u=rwX,g=rX,o= "${ROOT}"etc/asterisk
-
- einfo "done"
- else
- einfo "skipping"
- fi
-}
diff --git a/net-misc/asterisk/asterisk-1.6.1.6-r1.ebuild b/net-misc/asterisk/asterisk-1.6.1.6-r1.ebuild
new file mode 100644
index 000000000000..65501dbe7980
--- /dev/null
+++ b/net-misc/asterisk/asterisk-1.6.1.6-r1.ebuild
@@ -0,0 +1,417 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/asterisk-1.6.1.6-r1.ebuild,v 1.1 2009/10/22 14:47:54 chainsaw Exp $
+
+EAPI=1
+inherit eutils autotools
+
+MY_P="${PN}-${PV/_/-}"
+
+DESCRIPTION="Asterisk: A Modular Open Source PBX System"
+HOMEPAGE="http://www.asterisk.org/"
+SRC_URI="http://downloads.digium.com/pub/asterisk/releases/${MY_P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="alsa +caps curl dahdi debug freetds iconv jabber ldap keepsrc misdn newt nosamples odbc oss postgres radius snmp span speex ssl sqlite static vorbis"
+
+RDEPEND="sys-libs/ncurses
+ dev-libs/popt
+ sys-libs/zlib
+ alsa? ( media-libs/alsa-lib )
+ caps? ( sys-libs/libcap )
+ curl? ( net-misc/curl )
+ dahdi? ( >=net-libs/libpri-1.4.7
+ net-misc/dahdi-tools )
+ freetds? ( dev-db/freetds )
+ iconv? ( virtual/libiconv )
+ jabber? ( dev-libs/iksemel )
+ ldap? ( net-nds/openldap )
+ misdn? ( net-dialup/misdnuser )
+ newt? ( dev-libs/newt )
+ odbc? ( dev-db/unixODBC )
+ postgres? ( virtual/postgresql-base )
+ radius? ( net-dialup/radiusclient-ng )
+ snmp? ( net-analyzer/net-snmp )
+ span? ( media-libs/spandsp )
+ speex? ( media-libs/speex )
+ sqlite? ( dev-db/sqlite )
+ ssl? ( dev-libs/openssl )
+ vorbis? ( media-libs/libvorbis )"
+
+DEPEND="${RDEPEND}
+ !<net-misc/asterisk-addons-1.6"
+
+S="${WORKDIR}/${MY_P}"
+
+#
+# shortcuts
+#
+
+# update from asterisk-1.0.x
+is_ast10update() {
+ return $(has_version "=net-misc/asterisk-1.0*")
+}
+
+# update from asterisk-1.2.x
+is_ast12update() {
+ return $(has_version "=net-misc/asterisk-1.2*")
+}
+
+# update from asterisk 1.4.x
+is_ast14update() {
+ return $(has_version "=net-misc/asterisk-1.4*")
+}
+
+# update in the asterisk-1.6.x line
+is_astupdate() {
+ if ! is_ast10update && ! is_ast12update && !is_ast14update; then
+ return $(has_version "<net-misc/asterisk-${PV}")
+ fi
+ return 0
+}
+
+get_available_modules() {
+ local modules mod x
+
+ # build list of available modules...
+ for x in app cdr codec format func pbx res; do
+
+ for mod in $(find "${S}" -type f -name "${x}_*.c*" -print)
+ do
+ modules="${modules} $(basename ${mod/%.c*})"
+ done
+ done
+
+ echo "${modules}"
+}
+
+pkg_setup() {
+ local checkfailed=0 waitaftermsg=0
+
+ if is_ast10update || is_ast12update || is_ast14update ; then
+ ewarn " Asterisk UPGRADE Warning"
+ ewarn ""
+ ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.bz2 after the installation!"
+ ewarn ""
+ ewarn " Asterisk UPGRADE Warning"
+ echo
+ waitaftermsg=1
+ fi
+
+ if [[ $waitaftermsg -eq 1 ]]; then
+ einfo "Press Ctrl+C to abort"
+ echo
+ ebeep 10
+ fi
+
+ #
+ # Regular checks
+ #
+ einfo "Running some pre-flight checks..."
+ echo
+
+ if [[ -n "${ASTERISK_MODULES}" ]] ; then
+ ewarn "You are overriding ASTERISK_MODULES. We will assume you know what you are doing. There is no support for this option, try without if you see breakage."
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ #
+ # put pid file(s) into /var/run/asterisk
+ #
+ epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-var_rundir.patch || die "patch failed"
+
+ #
+ # fix gsm codec cflags (e.g. i586 core epias) and disable
+ # assembler optimizations
+ #
+ epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-gsm-pic.patch || die "patch failed"
+
+ #
+ # add missing LIBS for uclibc
+ #
+ epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-uclibc.patch || die "patch failed"
+
+ #
+ # compensate for non-standard LUA header paths in Gentoo
+ #
+ epatch "${FILESDIR}"/1.6.1/asterisk-1.6.1.6-lua-includes.patch || die "patch failed"
+
+ #
+ # make sure FXO ports are usable immediately, without requiring an inbound call first
+ # https://issues.asterisk.org/view.php?id=14577
+ #
+ epatch "${FILESDIR}"/1.6.1/asterisk-1.6.1.6-fxsks-hookstate.patch || die "patch failed"
+
+ #
+ # avoid segmentation fault when transferring a queue call
+ # https://issues.asterisk.org/view.php?id=15848
+ #
+ epatch "${FILESDIR}"/1.6.1/asterisk-1.6.1.6-transfer-segfault.patch || die "patch failed"
+
+ AT_M4DIR=autoconf eautoreconf
+
+ # parse modules list
+ if [[ -n "${ASTERISK_MODULES}" ]]; then
+ local x modules="$(get_available_modules)"
+
+ einfo "Custom list of modules specified, checking..."
+
+ use debug && {
+ einfo "Available modules: ${modules}"
+ einfo " Selected modules: ${ASTERISK_MODULES}"
+ }
+
+ for x in ${ASTERISK_MODULES}; do
+ if [[ "${x}" = "-*" ]]; then
+ MODULES_LIST=""
+ else
+ if has ${x} ${modules}
+ then
+ MODULES_LIST="${MODULES_LIST} ${x}"
+ else
+ eerror "Unknown module: ${x}"
+ fi
+ fi
+ done
+
+ export MODULES_LIST
+ fi
+}
+
+src_compile() {
+ #
+ # start with configure
+ #
+ econf \
+ --libdir="/usr/$(get_libdir)" \
+ --localstatedir="/var" \
+ --with-gsm=internal \
+ --with-popt \
+ --with-z \
+ $(use_with alsa asound) \
+ $(use_with caps cap) \
+ $(use_with curl) \
+ $(use_with dahdi pri) \
+ $(use_with dahdi tonezone) \
+ $(use_with dahdi) \
+ $(use_with freetds tds) \
+ $(use_with iconv) \
+ $(use_with jabber iksemel) \
+ $(use_with misdn isdnnet) \
+ $(use_with misdn suppserv) \
+ $(use_with misdn) \
+ $(use_with newt) \
+ $(use_with odbc) \
+ $(use_with oss) \
+ $(use_with postgres) \
+ $(use_with radius) \
+ $(use_with snmp netsnmp) \
+ $(use_with span spandsp) \
+ $(use_with speex) \
+ $(use_with speex speexdsp) \
+ $(use_with sqlite sqlite3) \
+ $(use_with ssl crypto) \
+ $(use_with ssl) \
+ $(use_with vorbis ogg) \
+ $(use_with vorbis) || die "econf failed"
+
+ #
+ # custom module filter
+ # run menuselect to evaluate the list of modules
+ # and rewrite the list afterwards
+ #
+ if [[ -n "${MODULES_LIST}" ]]
+ then
+ local mod category tmp_list failed_list
+
+ ###
+ # run menuselect
+
+ emake menuselect.makeopts || die "emake menuselect.makeopts failed"
+
+ ###
+ # get list of modules with failed dependencies
+
+ failed_list="$(awk -F= '/^MENUSELECT_DEPSFAILED=/{ print $3 }' menuselect.makeopts)"
+
+ ###
+ # traverse our list of modules
+
+ for category in app cdr codec format func pbx res; do
+ tmp_list=""
+
+ # search list of modules for matching ones first...
+ for mod in ${MODULES_LIST}; do
+ # module is from current category?
+ if [[ "${mod/%_*}" = "${category}" ]]
+ then
+ # check menuselect thinks the dependencies are met
+ if has ${mod} ${failed_list}
+ then
+ eerror "${mod}: dependencies required to build this module are not met, NOT BUILDING!"
+ else
+ tmp_list="${tmp_list} ${mod}"
+ fi
+ fi
+ done
+
+ use debug && echo "${category} tmp: ${tmp_list}"
+
+ # replace the module list for $category with our custom one
+ if [[ -n "${tmp_list}" ]]
+ then
+ category="$(echo ${category} | tr '[:lower:]' '[:upper:]')"
+ sed -i -e "s:^\(MENUSELECT_${category}S?\):\1=${tmp_list}:" \
+ menuselect.makeopts || die "failed to set list of ${category} applications"
+ fi
+ done
+ fi
+
+ emake || die "emake failed"
+}
+
+src_install() {
+ # setup directory structure
+ #
+ mkdir -p "${D}"usr/lib/pkgconfig
+
+ emake DESTDIR="${D}" install || die "emake install failed"
+ emake DESTDIR="${D}" samples || die "emake samples failed"
+
+ # remove installed sample files if nosamples flag is set
+ if use nosamples; then
+ einfo "Skipping installation of sample files..."
+ rm -f "${D}"var/lib/asterisk/mohmp3/*
+ rm -f "${D}"var/lib/asterisk/sounds/demo-*
+ rm -f "${D}"var/lib/asterisk/agi-bin/*
+ else
+ einfo "Sample files have been installed"
+ fi
+ rm -rf "${D}"var/spool/asterisk/voicemail/default
+
+ # move sample configuration files to doc directory
+ if is_ast10update || is_ast12update || is_ast14update; then
+ einfo "Updating from old (pre-1.6) asterisk version, new configuration files have been installed"
+ einfo "into "${ROOT}"etc/asterisk, use etc-update or dispatch-conf to update them"
+ fi
+
+ einfo "Configuration samples have been moved to: "${ROOT}"/usr/share/doc/${PF}/conf"
+ insinto /usr/share/doc/${PF}/conf
+ doins "${D}"etc/asterisk/*.conf*
+
+ # keep directories
+ diropts -m 0770 -o asterisk -g asterisk
+ keepdir /etc/asterisk
+ keepdir /var/lib/asterisk
+ keepdir /var/run/asterisk
+ keepdir /var/spool/asterisk
+ keepdir /var/spool/asterisk/{system,tmp,meetme,monitor,dictate,voicemail}
+ diropts -m 0750 -o asterisk -g asterisk
+ keepdir /var/log/asterisk/{cdr-csv,cdr-custom}
+
+ newinitd "${FILESDIR}"/1.6.1/asterisk.initd asterisk
+ newconfd "${FILESDIR}"/1.6.0/asterisk.confd asterisk
+
+ # some people like to keep the sources around for custom patching
+ # copy the whole source tree to /usr/src/asterisk-${PVF} and run make clean there
+ if use keepsrc
+ then
+ einfo "keepsrc useflag enabled, copying source..."
+ dodir /usr/src
+
+ cp -dPR "${S}" "${D}"/usr/src/${PF} || die "copying source tree failed"
+
+ ebegin "running make clean..."
+ emake -C "${D}"/usr/src/${PF} clean >/dev/null || die "make clean failed"
+ eend $?
+
+ einfo "Source files have been saved to "${ROOT}"usr/src/${PF}"
+ fi
+
+ # install the upgrade documentation
+ #
+ dodoc README UPGRADE* BUGS CREDITS
+
+ # install snmp mib files
+ #
+ if use snmp
+ then
+ insinto /usr/share/snmp/mibs/
+ doins doc/digium-mib.txt doc/asterisk-mib.txt
+ fi
+}
+
+pkg_preinst() {
+ enewgroup asterisk
+ enewuser asterisk -1 -1 /var/lib/asterisk "asterisk,dialout"
+}
+
+pkg_postinst() {
+ ebegin "Fixing up permissions"
+ chown -R asterisk:asterisk "${ROOT}"var/log/asterisk
+ chmod -R u=rwX,g=rX,o= "${ROOT}"var/log/asterisk
+
+ chown asterisk:asterisk "${ROOT}"etc/asterisk/
+ chown asterisk:asterisk "${ROOT}"etc/asterisk/*.adsi
+ chown asterisk:asterisk "${ROOT}"etc/asterisk/extensions.ael
+ chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/
+ chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/*.adsi
+ chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/extensions.ael
+ eend $?
+
+ #
+ # Announcements, warnings, reminders...
+ #
+ einfo "Asterisk has been installed"
+ echo
+ elog "If you want to know more about asterisk, visit these sites:"
+ elog "http://www.asteriskdocs.org/"
+ elog "http://www.voip-info.org/wiki-Asterisk"
+ echo
+ elog "http://www.automated.it/guidetoasterisk.htm"
+ echo
+ elog "Gentoo VoIP IRC Channel:"
+ elog "#gentoo-voip @ irc.freenode.net"
+ echo
+ echo
+
+ #
+ # Warning about 1.x -> 1.6 changes...
+ #
+ if is_ast10update || is_ast12update || is_ast14update; then
+ ewarn ""
+ ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.bz2 before continuing"
+ ewarn ""
+ fi
+}
+
+pkg_config() {
+ einfo "Do you want to reset file permissions and ownerships (y/N)?"
+
+ read tmp
+ tmp="$(echo $tmp | tr '[:upper:]' '[:lower:]')"
+
+ if [[ "$tmp" = "y" ]] ||\
+ [[ "$tmp" = "yes" ]]
+ then
+ einfo "Resetting permissions to defaults..."
+
+ for x in spool run lib log; do
+ chown -R asterisk:asterisk "${ROOT}"var/${x}/asterisk
+ chmod -R u=rwX,g=rwX,o= "${ROOT}"var/${x}/asterisk
+ done
+
+ chown -R root:asterisk "${ROOT}"etc/asterisk
+ chmod -R u=rwX,g=rwX,o= "${ROOT}"etc/asterisk
+
+ einfo "done"
+ else
+ einfo "skipping"
+ fi
+}
diff --git a/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.6-fxsks-hookstate.patch b/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.6-fxsks-hookstate.patch
new file mode 100644
index 000000000000..98cd9adf1ce7
--- /dev/null
+++ b/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.6-fxsks-hookstate.patch
@@ -0,0 +1,31 @@
+Allow FXO channels to send out calls even before someone calls in through
+them.
+
+This rxisoffhook does not work. Before 1.6.0 it was wrapped in a #ifdef
+DAHDI_CHECK_HOOKSTATE (or rather: ZAP_CHECK_HOOKSTATE). In 1.6 it is
+accidentally enabled by default.
+
+On DAHDI (the kernel) this field is not properly initialized at startup.
+And thus it will only work after an incoming ring.
+
+Upstream issue: http://issues.asterisk.org/view.php?id=14577
+
+--- a/channels/chan_dahdi.c
++++ b/channels/chan_dahdi.c
+@@ -9295,12 +9295,16 @@ static inline int available(struct dahdi
+ /* When "onhook" that means no battery on the line, and thus
+ it is out of service..., if it's on a TDM card... If it's a channel
+ bank, there is no telling... */
++#ifdef DAHDI_CHECK_HOOKSTATE
+ if (par.rxbits > -1)
+ return 1;
+ if (par.rxisoffhook)
+ return 1;
+ else
+ return 0;
++#else
++ return 1;
++#endif
+ } else if (par.rxisoffhook) {
+ ast_debug(1, "Channel %d off hook, can't use\n", p->channel);
+ /* Not available when the other end is off hook */
diff --git a/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.6-transfer-segfault.patch b/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.6-transfer-segfault.patch
new file mode 100644
index 000000000000..0a0985b03cf9
--- /dev/null
+++ b/net-misc/asterisk/files/1.6.1/asterisk-1.6.1.6-transfer-segfault.patch
@@ -0,0 +1,23 @@
+Index: asterisk-1.6.1.0~dfsg_devel/channels/chan_sip.c
+===================================================================
+--- asterisk-1.6.1.0~dfsg_devel.orig/channels/chan_sip.c 2009-10-14 12:03:08.000000000 +0200
++++ asterisk-1.6.1.0~dfsg_devel/channels/chan_sip.c 2009-10-14 12:03:11.000000000 +0200
+@@ -5333,15 +5333,12 @@
+ * to lock the bridge. This may get hairy...
+ */
+ while (bridge && ast_channel_trylock(bridge)) {
+- struct ast_channel *chan = p->owner;
+ sip_pvt_unlock(p);
+ do {
+- /* Use chan since p->owner could go NULL on us
+- * while p is unlocked
+- */
+- CHANNEL_DEADLOCK_AVOIDANCE(chan);
++ /* Use oldowner since p->owner is already NULL */
++ CHANNEL_DEADLOCK_AVOIDANCE(oldowner);
+ } while (sip_pvt_trylock(p));
+- bridge = p->owner ? ast_bridged_channel(p->owner) : NULL;
++ bridge = ast_bridged_channel(oldowner);
+ }
+
+ if (p->rtp)
diff --git a/net-misc/asterisk/files/1.6.1/asterisk.initd b/net-misc/asterisk/files/1.6.1/asterisk.initd
new file mode 100644
index 000000000000..dc6a14e365f1
--- /dev/null
+++ b/net-misc/asterisk/files/1.6.1/asterisk.initd
@@ -0,0 +1,253 @@
+#!/sbin/runscript
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/files/1.6.1/asterisk.initd,v 1.1 2009/10/22 14:47:55 chainsaw Exp $
+
+opts="${opts} forcestop reload"
+
+depend() {
+ need net
+ use nscd dns dahdi mysql postgresql slapd capi
+}
+
+is_running() {
+ if [ -z "$(pidof asterisk)" ]; then
+ return 1
+ else
+ PID="$(cat /var/run/asterisk/asterisk.pid)"
+ for x in $(pidof asterisk); do
+ if [ "${x}" = "${PID}" ]; then
+ return 0
+ fi
+ done
+ fi
+
+ return 1
+}
+
+asterisk_run_loop() {
+ local OPTS ARGS MSG NICE=""
+ local result=0 signal=0
+
+ # default options
+ OPTS="-f" # don't fork / detach breaks wrapper script...
+
+ # filter (redundant) arguments
+ ARGS="$(echo "${@}" | sed -e "s:-c\|-f::g")"
+
+ # mangle yes/no options
+ ASTERISK_CONSOLE="$(echo ${ASTERISK_CONSOLE} | tr '[:lower:]' '[:upper:]')"
+
+ if [ -n "${ASTERISK_CORE_SIZE}" ] &&
+ [ "${ASTERISK_CORE_SIZE}" != "0" ]; then
+ ulimit -c ${ASTERISK_CORE_SIZE}
+
+ if [ -n "${ASTERISK_CORE_DIR}" ] && \
+ [ ! -d "${ASTERISK_CORE_DIR}" ]
+ then
+ mkdir -m750 -p "${ASTERISK_CORE_DIR}"
+
+ if [ -n "${ASTERISK_USER}" ]; then
+ chown -R "${ASTERISK_USER}" "${ASTERISK_CORE_DIR}"
+ fi
+ fi
+ ASTERISK_CORE_DIR="${ASTERISK_CORE_DIR:-/tmp}"
+
+ cd "${ASTERISK_CORE_DIR}"
+ echo " Core dump size : ${ASTERISK_CORE_SIZE}"
+ echo " Core dump location : ${ASTERISK_CORE_DIR}"
+ fi
+
+ if [ -n "${ASTERISK_MAX_FD}" ]; then
+ ulimit -n ${ASTERISK_MAX_FD}
+ echo " Max open filedescriptors : ${ASTERISK_MAX_FD}"
+ fi
+
+ if [ -n "${ASTERISK_NICE}" ]; then
+ echo " Nice level : ${ASTERISK_NICE}"
+ NICE="nice -n ${ASTERISK_NICE} --"
+ fi
+
+ if [ -n "${ASTERISK_NOTIFY_EMAIL}" ]; then
+ if [ -x /usr/sbin/sendmail ]; then
+ echo " Email notifications go to : ${ASTERISK_NOTIFY_EMAIL}"
+ else
+ echo " Notifications disabled, /usr/sbin/sendmail doesn't exist or is not executable!"
+ unset ASTERISK_NOTIFY_EMAIL
+ fi
+ fi
+
+ if [ -n "${ASTERISK_TTY}" ]; then
+ for x in ${ASTERISK_TTY} \
+ /dev/tty${ASTERISK_TTY} \
+ /dev/vc/${ASTERISK_TTY}
+ do
+ if [ -c "${x}" ]; then
+ TTY="${x}"
+ fi
+ done
+ [ -n "${TTY}" ] && \
+ echo " Messages are sent to : ${TTY}"
+ fi
+
+ if [ "${ASTERISK_CONSOLE}" = "YES" ] && [ -n "${TTY}" ]; then
+ echo " Starting Asterisk console : ${ASTERISK_CONSOLE}"
+ OPTS="${OPTS} -c"
+ fi
+
+ OPTS="${OPTS} ${ARGS}"
+
+ while :; do
+
+ if [ -n "${TTY}" ]; then
+ /usr/bin/stty -F ${TTY} sane
+ ${NICE} /usr/sbin/asterisk ${OPTS} >${TTY} 2>&1 <${TTY}
+ result=$?
+ else
+ ${NICE} /usr/sbin/asterisk ${OPTS} &>/dev/null
+ result=$?
+ fi
+
+ if [ $result -eq 0 ]; then
+ echo "Asterisk terminated normally"
+ break
+ else
+ if [ $result -gt 128 ]; then
+ signal=$((result - 128))
+ MSG="Asterisk terminated with Signal: $signal"
+
+ CORE_TARGET="core-$(date "+%Y%m%d-%h%M%s")"
+
+ local CORE_DUMPED=0
+ if [ -f "${ASTERISK_CORE_DIR}/core" ]; then
+ mv "${ASTERISK_CORE_DIR}/core" \
+ "${ASTERISK_CORE_DIR}/${CORE_TARGET}"
+ CORE_DUMPED=1
+
+ elif [ -f "${ASTERISK_CORE_DIR}/core.${PID}" ]; then
+ mv "${ASTERISK_CORE_DIR}/core.${PID}" \
+ "${ASTERISK_CORE_DIR}/${CORE_TARGET}"
+ CORE_DUMPED=1
+
+ fi
+
+ [ $CORE_DUMPED -eq 1 ] && \
+ MSG="${MSG}\n\rCore dumped: ${ASTERISK_CORE_DIR}/${CORE_TARGET}"
+ else
+ MSG="Asterisk terminated with return code: $result"
+ fi
+
+ # kill left-over tasks
+ for X in ${ASTERISK_CLEANUP_ON_CRASH}; do
+ kill -9 $(pidof ${X});
+ done
+ fi
+
+ [ -n "${TTY}" ] \
+ && echo "${MSG}" >${TTY} \
+ || echo "${MSG}"
+
+
+ if [ -n "${ASTERISK_NOTIFY_EMAIL}" ] && \
+ [ -x /usr/sbin/sendmail ]; then
+ echo -e -n "Subject: Asterisk crashed\n\r${MSG}\n\r" |\
+ /usr/sbin/sendmail "${ASTERISK_NOTIFY_EMAIL}"
+ fi
+ sleep 5
+ echo "Restarting Asterisk..."
+ done
+ return 0
+}
+
+start() {
+ local OPTS USER GROUP PID
+ local tmp x
+
+ if [ -n "${ASTERISK_NICE}" ]; then
+ if [ ${ASTERISK_NICE} -ge -20 ] && \
+ [ ${ASTERISK_NICE} -le 19 ]; then
+ OPTS="--nicelevel ${ASTERISK_NICE}"
+ else
+ eerror "Nice value must be between -20 and 19"
+ return 1
+ fi
+ fi
+
+ if [ -n "${ASTERISK_USER}" ]; then
+ USER=$(echo $ASTERISK_USER | sed 's/:.*//')
+ GROUP=$(echo $ASTERISK_USER | awk -F: '/.*:.*/ { print $2 }')
+ if [ -n "${USER}" ]; then
+ ASTERISK_OPTS="${ASTERISK_OPTS} -U ${USER}"
+ fi
+ if [ -n "${GROUP}" ]; then
+ ASTERISK_OPTS="${ASTERISK_OPTS} -G ${GROUP}"
+ GROUP=":${GROUP}" # make it look nice...
+ fi
+ ebegin "Starting asterisk PBX (as ${USER}${GROUP})"
+ else
+ ebegin "Starting asterisk PBX (as root)"
+ fi
+
+ if [ "$(echo ${ASTERISK_WRAPPER} | tr '[:upper:]' '[:lower:]')" != "yes" ]; then
+ start-stop-daemon --start --exec /usr/sbin/asterisk \
+ ${OPTS} -- ${ASTERISK_OPTS}
+ result=$?
+ else
+ asterisk_run_loop ${ASTERISK_OPTS} 2>/dev/null &
+ result=$?
+ fi
+
+ if [ $result -eq 0 ]; then
+ # 2 seconds should be enough for asterisk to start
+ sleep 2
+ is_running
+ result=$?
+ fi
+
+ eend $result
+}
+
+forcestop() {
+ ebegin "Stopping asterisk PBX"
+ start-stop-daemon --stop --pidfile /var/run/asterisk/asterisk.pid
+ eend $?
+}
+
+stop() {
+ if ! is_running; then
+ eerror "Asterisk is not running!"
+ return 0
+ fi
+
+ ebegin "Stopping asterisk PBX gracefully"
+ /usr/sbin/asterisk -r -x "core stop gracefully" &>/dev/null
+ # Now we have to wait until asterisk has _really_ stopped.
+ sleep 1
+ if is_running; then
+ einfon "Waiting for asterisk to shutdown ."
+ local cnt=0
+ while is_running; do
+ cnt=`expr $cnt + 1`
+ if [ $cnt -gt 60 ] ; then
+ # Waited 120 seconds now. Fail.
+ echo
+ eend 1 "Failed."
+ return
+ fi
+ sleep 2
+ echo -n "."
+ done
+ echo
+ fi
+ eend 0
+}
+
+reload() {
+ if is_running; then
+ ebegin "Forcing asterisk to reload configuration"
+ /usr/sbin/asterisk -r -x "reload" &>/dev/null
+ eend $?
+ else
+ eerror "Asterisk is not running!"
+ fi
+}