summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Vroon <chainsaw@gentoo.org>2010-12-01 17:54:28 +0000
committerTony Vroon <chainsaw@gentoo.org>2010-12-01 17:54:28 +0000
commit8823baeb22cf4b33c81d407cb789907d1cc77e8e (patch)
treefef2b1f20f8356fa6fbc6e3c703cbc7917cd6a68 /net-misc/asterisk
parentremoved bash replacement part in S= (diff)
downloadhistorical-8823baeb22cf4b33c81d407cb789907d1cc77e8e.tar.gz
historical-8823baeb22cf4b33c81d407cb789907d1cc77e8e.tar.bz2
historical-8823baeb22cf4b33c81d407cb789907d1cc77e8e.zip
Add 1.4 branch ebuild & patchset by Kerin Millar, who will be proxy maintaining.
Package-Manager: portage-2.1.9.25/cvs/Linux x86_64
Diffstat (limited to 'net-misc/asterisk')
-rw-r--r--net-misc/asterisk/ChangeLog14
-rw-r--r--net-misc/asterisk/Manifest20
-rw-r--r--net-misc/asterisk/asterisk-1.4.37.ebuild304
-rw-r--r--net-misc/asterisk/files/1.4.0/asterisk-1.4.0-uclibc.patch13
-rw-r--r--net-misc/asterisk/files/1.4.0/asterisk-1.4.0-var_rundir.patch11
-rw-r--r--net-misc/asterisk/files/1.4.0/asterisk-1.4.33-gsm-pic.patch59
-rw-r--r--net-misc/asterisk/files/1.4.0/asterisk-1.4.33-inband-indications.patch20
-rw-r--r--net-misc/asterisk/files/1.4.0/asterisk-1.4.37-imap-libs.patch11
-rw-r--r--net-misc/asterisk/files/1.4.0/asterisk.confd98
-rw-r--r--net-misc/asterisk/files/1.4.0/asterisk.initd273
-rw-r--r--net-misc/asterisk/files/1.4.0/asterisk.logrotate25
-rw-r--r--net-misc/asterisk/files/1.4.0/func_devstate-r6.c228
-rw-r--r--net-misc/asterisk/files/1.4.0/func_volume.c160
13 files changed, 1231 insertions, 5 deletions
diff --git a/net-misc/asterisk/ChangeLog b/net-misc/asterisk/ChangeLog
index 18dfc042bd1a..2129701dfbbd 100644
--- a/net-misc/asterisk/ChangeLog
+++ b/net-misc/asterisk/ChangeLog
@@ -1,6 +1,18 @@
# ChangeLog for net-misc/asterisk
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/ChangeLog,v 1.274 2010/10/27 22:57:59 chainsaw Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/ChangeLog,v 1.275 2010/12/01 17:54:28 chainsaw Exp $
+
+*asterisk-1.4.37 (01 Dec 2010)
+
+ 01 Dec 2010; <chainsaw@gentoo.org> +files/1.4.0/asterisk-1.4.0-uclibc.patch,
+ +files/1.4.0/asterisk-1.4.0-var_rundir.patch,
+ +files/1.4.0/asterisk-1.4.33-inband-indications.patch,
+ +files/1.4.0/asterisk-1.4.37-imap-libs.patch, +files/1.4.0/asterisk.confd,
+ +files/1.4.0/asterisk.initd, +files/1.4.0/asterisk-1.4.33-gsm-pic.patch,
+ +files/1.4.0/asterisk.logrotate, +asterisk-1.4.37.ebuild,
+ +files/1.4.0/func_devstate-r6.c, +files/1.4.0/func_volume.c:
+ Add 1.4 branch ebuild & patchset by Kerin Millar, who will be proxy
+ maintaining.
27 Oct 2010; <chainsaw@gentoo.org> asterisk-1.8.0.ebuild:
Apparently production releases can now depend on beta code. Notch up
diff --git a/net-misc/asterisk/Manifest b/net-misc/asterisk/Manifest
index 6fcda92eb367..5232b65cbb62 100644
--- a/net-misc/asterisk/Manifest
+++ b/net-misc/asterisk/Manifest
@@ -9,6 +9,16 @@ AUX 1.2.0/asterisk-1.2.35-lpc10-prototypes.diff 500 RMD160 66abbc99cdb18ed82908f
AUX 1.2.0/asterisk-updater 3127 RMD160 41ea584081c3e565205e59771e24a8715d7e2042 SHA1 1c11d9ce286972b6f98c15a16cbb7f1c943414eb SHA256 93e6862361a320c7f7f30525b4209366190dd2bc21eedbd3654ffb4b991af5fd
AUX 1.2.0/asterisk.confd 2200 RMD160 f26ac9b18e8c1db86c54839d9b4a816cfe45c61f SHA1 2baee139893fd9c413d140db843831da1917f05f SHA256 b94a59f36a46362622acd2ccc811e1e9dd0abf928104285c7098d7c17a324379
AUX 1.2.0/asterisk.rc6 5891 RMD160 d14da5d703cdd9bedf9986e0e49a93d8031876ee SHA1 3e28003ecd2d0659266644bffe463fd25efddbcc SHA256 d2bbd0e335f7f2f399780778501df3fd2026ba27dfe48db3ab282430fb215531
+AUX 1.4.0/asterisk-1.4.0-uclibc.patch 343 RMD160 4019c00d9bb5882a7f48c0b39368a819aa28b1e5 SHA1 ff6d9e8ca112438416d3344356926f8c9c20685d SHA256 72077008343b453107e4a1a361944d2ccd64443006d6d9015dc0d9714baaa4d5
+AUX 1.4.0/asterisk-1.4.0-var_rundir.patch 441 RMD160 55869a82a01be38e80da9a31faac6d2d03f0fc58 SHA1 5bf2a8ed9778623f611330fcc4ea75c50f642680 SHA256 f75156feb6a6e421fc83e2d518b4b9204e4ae11e802440576a54de226ffd8064
+AUX 1.4.0/asterisk-1.4.33-gsm-pic.patch 2188 RMD160 c72dd6707a3ba41a0c67e0a65e7e1613a7b48d5c SHA1 bbad605e72355c351918b5a43040eee8b9957191 SHA256 fa85509d50aec3d428b37a6b26c11f23bb876625e98f86c64de29846f3ad13df
+AUX 1.4.0/asterisk-1.4.33-inband-indications.patch 548 RMD160 4f8b37cd1e55b8aa2871a1be2c9c957d58022538 SHA1 7f77ad3f31b1aa4958c83ecf60b53d81f441fad1 SHA256 aecabadcd5810273ee232c8f365711c8b4450febe9f0da989410471b5b31b00c
+AUX 1.4.0/asterisk-1.4.37-imap-libs.patch 467 RMD160 a551d89bfd096f759bc28da6c7e7a39875a533e5 SHA1 e5abd1fde12f9b32c269f30f414b2f6e8f9bfeab SHA256 cb5ce2954a162a9237714b042464053e02389f862f598a29f5fab2bcba04651f
+AUX 1.4.0/asterisk.confd 2204 RMD160 128eca6297ca6ab4817750f1432be4fdb90d486c SHA1 f26348908a7a622afd21011fdcc38abbced87200 SHA256 69fb5e338e9ff73459e5f788297b57d833f2a15cf764514dff94a42e145a5df5
+AUX 1.4.0/asterisk.initd 6652 RMD160 51a757b75b0a2b923b082a93a82fddac21d0e966 SHA1 111717a594d3a246f596e4c1c43bfdcaebe4e3a0 SHA256 082ba1ecc03b75cfb310a87a1374fdf9cfeb8e0d09e8225a7126f80269403fa2
+AUX 1.4.0/asterisk.logrotate 436 RMD160 06a98d2a908464a951e3386a2681f5829dcb0220 SHA1 31331f8fabc643f722a1c12cee0557e0268019ea SHA256 675705506d1adf7ec8c278581412a7ed69eed2735fea6c5f2faf368fb4ad9a26
+AUX 1.4.0/func_devstate-r6.c 6070 RMD160 5c9c299b486a001e6f871d5177b5405521faf5d0 SHA1 a6b320bfc514fcfe7c396d848a17eb702ab194fd SHA256 50ca3794824f6772fce23d40b868a9bf6451e84765de44b8aa96b334c1d2967d
+AUX 1.4.0/func_volume.c 4503 RMD160 7cdd1b570a3cc4ee8f7d49139ab50fe80f33d8bb SHA1 f34e4bb5d75fc9589b27ccd6555c0db5a0d27dbf SHA256 28c8040837ce9cf1c86fdc1d043685723a9f56a2398140d751b85c609248b698
AUX 1.6.0/asterisk.confd 2204 RMD160 31bceebfa535e97cb2634e313678cc42186d4750 SHA1 748c623cea238cd9b322672d5ebcfe214a4f0463 SHA256 daec84c58e0ef6cbd71a6fc62cb83129b1bcffdfdd619ebbd62a642f0cd1eee7
AUX 1.6.1/asterisk-1.6.1-uclibc.patch 373 RMD160 08f18dd2af3736497995ebcbea84939ae4c4cc98 SHA1 b10884d4b9123800f62b4aabac5a93b1a110e3da SHA256 b6fe54def0ab3f90058c2ed7bd288dd21c96aaf88b9028f12d223fb31d7e41c5
AUX 1.6.2/asterisk-1.6.2.11-strip-noapi.patch 742 RMD160 d9a176bc9bfed14adc3e59881c04932070cb98c3 SHA1 4d40de82f27bbeb8a0b62fa17d864b9629ba29a3 SHA256 c874f28eb895b0c87a0bbf9b60ec7cd7dfe2599faa1920d1f1a20c983be3bca8
@@ -42,20 +52,22 @@ AUX 1.8.0/asterisk-1.8.0-uclibc.patch 471 RMD160 305b41a818f6a59d44d7fa414282e3e
DIST asterisk-1.2.27-patches-1.0.tar.bz2 6653 RMD160 18f1d7fc4497466050ed4f517ff5732eb448ff2e SHA1 2aecd3e91cde38dbb0fd591e8a49db221f44b94e SHA256 a4da0570fca2df3c508f072be62722879956fe8c454027fbb8dafb7a6095384c
DIST asterisk-1.2.37.tar.gz 29899629 RMD160 1de7ff96d3b1fd8d89f3ef7b3bb9e35bedccfb33 SHA1 c9a3c4684e021f62b4d19f6e0c8fc11f64db19d6 SHA256 9f3ec67efe0e4d45434621cd358e8e7d64e1b05df04d66e2390c9420acd2aeaa
DIST asterisk-1.2.40.tar.gz 29903514 RMD160 dc3da60756c82c98a055e49b068eb6760a01948e SHA1 4b4b794e858a3436bc35bdd2f4edf824c2885b68 SHA256 61dc745b12f6dc2998404e77747a964db56df8efae84a666c4ccddf016c9c06d
+DIST asterisk-1.4.37.tar.gz 21666828 RMD160 0918c251f4f1045a65a3276afbbe78525cc09e74 SHA1 c56758e0e39970eacf2d1d081e960f44d4efdb0e SHA256 0168cc552eb5c3758a447d22c6d08a8cba0509b0be4036e253f895066facf3f6
DIST asterisk-1.6.2.13.tar.gz 23679304 RMD160 ebdd776da2e76a247a621748d8aea0c1f0cffc63 SHA1 b412d4a8589b5b58bd64e2b7f277712b7cbbfabd SHA256 28bb18e988d22557ee77220cb33209212af1e618348c3d42666f785da517c01e
DIST asterisk-1.8.0.tar.gz 26035124 RMD160 b2892a5718618d8fbd88147b8fc0c278ecb6b4ed SHA1 9e39d6678a5c09f2a145f04e492d3aadb63e2006 SHA256 8f1edbc8fab23596a6f6ee2881d67c22b4a6cb20bfad84125fcdcb3ff2e1de1b
EBUILD asterisk-1.2.37.ebuild 10738 RMD160 0f409319cb82c2c92cde0ab6436e44dd214c0cf3 SHA1 6cce3c94e5ace2f1f9fa7e6a621b358e3921cbec SHA256 fc6ed3447de3400e74fcffeee457adc59a4433047655f4190b55a9dfbec8c18b
EBUILD asterisk-1.2.40.ebuild 10743 RMD160 f3db358e4776aef3dfb196f5e182f6f588030f60 SHA1 ae80355f7aa6e84c413f83c20028209e2908e3f9 SHA256 f67e2a7c507315feffdeb5950f9225c9edb038bb915f5402102dbd4da693c35d
+EBUILD asterisk-1.4.37.ebuild 8182 RMD160 cba2a7b76e5e85af081628c93ce8bca08578b585 SHA1 865eb1c2338b82863c4a37c24afc74997251c9c5 SHA256 bb18a3f8e15aa66c1f8ec6171d7228a10d9a0e9a89fa5908fe008e2a5bb81ffd
EBUILD asterisk-1.6.2.13-r1.ebuild 7196 RMD160 d3221cfedab5310159b25b323ab716dd7d35aef8 SHA1 2a0473f809211060631e657c05601863930a9cba SHA256 7ed79b0b458daa23990ecae9069ba3d65ab01521819928222b65eca99af40f87
EBUILD asterisk-1.6.2.13-r2.ebuild 7377 RMD160 12c080a61d7c345fcebb6bc148baf0396f2db8f9 SHA1 4df6a0218d162724e759d9d11660d623a7c314ce SHA256 40a5be578f62de21c53f4d312d743796746705a5d27deccefb5e0504add00c75
EBUILD asterisk-1.6.2.13.ebuild 6868 RMD160 d889222a63df46edc27a70bffa0339a717acb889 SHA1 5d048c74b3a4f603f4d900a61263138b3ef2b518 SHA256 7727121819199291f91a485af0868df5790b6449fab6324e3f15863868c35115
EBUILD asterisk-1.8.0.ebuild 8206 RMD160 3120b6ff9de7a75fa78f7060eb47cbf5cc839af3 SHA1 04296cdd77a2d55a2fc15b2359f08b83be316b5e SHA256 e1d17452162bd0d97ef34686ada271bcba9751d60941990304c1060b03cccdc0
-MISC ChangeLog 65105 RMD160 7dea17cb7487f6c108644958dea42f0eda8b896c SHA1 4012e44733a6945bf12b38c646db81faad487882 SHA256 20d33aea146c78b350c35f6d21d10ad32b13d732ccfc29cb6cfe12d1c4b70936
+MISC ChangeLog 65682 RMD160 cb15f458a2d1e196ac110147d077686bd9dcdaeb SHA1 dd744aa5275030bd9f2e7b13e835085359a982bc SHA256 bc2fa5d288c162484398e999876862a91e02bb78c7657e02c622da06b75080da
MISC metadata.xml 1773 RMD160 42bd30a0749acec6c954d6a12a63138876aa9e6c SHA1 1516741f8181e5fffa11222b29872110ac0d7928 SHA256 e5f6bae7a2ec088d102398005ffe5d409f38b698887c333a7c4afc9c30a1008e
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
-iEYEARECAAYFAkzIr1gACgkQp5vW4rUFj5pa/wCfcx8fCVhREXKBFsQBkCXJqw+j
-4r8An2epxr8eRmFOVxwcIuFKBxLe3NfO
-=RZXZ
+iEYEARECAAYFAkz2i+kACgkQp5vW4rUFj5pwkgCfc/gB7IAYcBrLZQWjoow9yEUA
+rM4An2uX5z0Ass7AXpQuD7FRNfV/gw8z
+=aXJg
-----END PGP SIGNATURE-----
diff --git a/net-misc/asterisk/asterisk-1.4.37.ebuild b/net-misc/asterisk/asterisk-1.4.37.ebuild
new file mode 100644
index 000000000000..3a1bfbbb1291
--- /dev/null
+++ b/net-misc/asterisk/asterisk-1.4.37.ebuild
@@ -0,0 +1,304 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/asterisk-1.4.37.ebuild,v 1.1 2010/12/01 17:54:28 chainsaw Exp $
+
+EAPI=3
+inherit autotools base eutils flag-o-matic linux-info multilib
+
+MY_P="${PN}-${PV/_/-}"
+
+DESCRIPTION="Asterisk: A Modular Open Source PBX System"
+HOMEPAGE="http://www.asterisk.org/"
+SRC_URI="http://downloads.asterisk.org/pub/telephony/asterisk/releases/${MY_P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64"
+
+IUSE="alsa +caps dahdi debug doc freetds imap jabber keepsrc misdn newt +samples odbc oss postgres radius snmp speex ssl sqlite static vanilla vorbis"
+
+RDEPEND="sys-libs/ncurses
+ dev-libs/popt
+ sys-libs/zlib
+ alsa? ( media-libs/alsa-lib )
+ caps? ( sys-libs/libcap )
+ dahdi? ( >=net-libs/libpri-1.4.7
+ net-misc/dahdi-tools )
+ freetds? ( dev-db/freetds )
+ imap? ( >=net-libs/c-client-2007[ssl=] )
+ jabber? ( dev-libs/iksemel )
+ misdn? ( net-dialup/misdnuser )
+ newt? ( dev-libs/newt )
+ odbc? ( dev-db/unixODBC )
+ postgres? ( dev-db/postgresql-base )
+ radius? ( net-dialup/radiusclient-ng )
+ snmp? ( net-analyzer/net-snmp )
+ speex? ( media-libs/speex )
+ sqlite? ( dev-db/sqlite )
+ ssl? ( dev-libs/openssl )
+ vorbis? ( media-libs/libvorbis )"
+
+DEPEND="${RDEPEND}
+ !<net-misc/asterisk-addons-1.4
+ !>=net-misc/asterisk-addons-1.6
+ !net-misc/zaptel"
+
+PDEPEND="net-misc/asterisk-core-sounds
+ net-misc/asterisk-extra-sounds
+ net-misc/asterisk-moh-opsound"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+ "${FILESDIR}/1.4.0/${PN}-1.4.0-var_rundir.patch"
+ "${FILESDIR}/1.4.0/${PN}-1.4.33-gsm-pic.patch"
+ "${FILESDIR}/1.4.0/${PN}-1.4.0-uclibc.patch"
+ "${FILESDIR}/1.4.0/${PN}-1.4.33-inband-indications.patch"
+ "${FILESDIR}/1.4.0/${P}-imap-libs.patch"
+)
+
+pkg_setup() {
+ CONFIG_CHECK="~!NF_CONNTRACK_SIP"
+ local WARNING_NF_CONNTRACK_SIP="SIP (NAT) connection tracking is enabled. Some users
+ have reported that this module dropped critical SIP packets in their deployments. You
+ may want to disable it if you see such problems."
+ check_extra_config
+}
+
+src_prepare() {
+ base_src_prepare
+ AT_M4DIR=autoconf eautoreconf
+
+ # add custom device state function (func_devstate)
+ #
+ # http://asterisk.org/node/48360
+ # http://svncommunity.digium.com/svn/russell/func_devstate-1.4/README.txt
+ #
+ cp "${FILESDIR}"/1.4.0/func_devstate-r6.c "${S}"/funcs/func_devstate.c
+
+ # Add technology-independent volume control function
+ #
+ cp "${FILESDIR}"/1.4.0/func_volume.c "${S}"/funcs/func_volume.c
+
+ # Custom menuselect options are defined in this file (it may remain empty)
+ #
+ >"${S}"/gentoo.makeopts
+
+ # Enable various debugging options if requested
+ #
+ if use debug; then
+ local debug_opts="DEBUG_CHANNEL_LOCKS DEBUG_THREADS DEBUG_FD_LEAKS"
+ einfo "Enabling debugging options: ${debug_opts}"
+ echo "MENUSELECT_CFLAGS=${debug_opts}" >> "${S}"/gentoo.makeopts
+ fi
+
+ # Enable IMAP storage in app_voicemail if requested
+ #
+ use imap && echo "MENUSELECT_OPTS_app_voicemail=IMAP_STORAGE" >> "${S}"/gentoo.makeopts
+}
+
+src_configure() {
+ if use debug; then
+ # Tone down the compiler flags somewhat. This should be less aggressive
+ # than the DONT_OPTIMIZE option whilst still producing useful results.
+ #
+ strip-flags
+ replace-flags -O? -O0
+ fi
+
+ if use imap; then
+ local imap_libs
+ has_version net-libs/c-client[pam] && imap_libs="-lpam"
+ has_version net-libs/c-client[ssl] && imap_libs="${imap_libs} -lssl"
+ export IMAP_LIBS="${imap_libs}"
+ fi
+
+ econf \
+ --libdir="/usr/$(get_libdir)" \
+ --localstatedir="/var" \
+ --with-gsm=internal \
+ --with-ncurses \
+ --with-popt \
+ --with-z \
+ --without-curses \
+ --without-h323 \
+ --without-nbs \
+ --without-osptk \
+ --without-pwlib \
+ --without-kde \
+ --without-usb \
+ --without-vpb \
+ --without-zaptel \
+ $(use_with alsa asound) \
+ $(use_with caps cap) \
+ $(use_with dahdi pri) \
+ $(use_with dahdi tonezone) \
+ $(use_with dahdi) \
+ $(use_with freetds tds) \
+ $(use_with imap imap system) \
+ $(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 speex) \
+ $(use_with speex speexdsp) \
+ $(use_with sqlite) \
+ $(use_with ssl) \
+ $(use_with vorbis ogg) \
+ $(use_with vorbis) || die "econf failed"
+
+ #
+ # blank out sounds/sounds.xml file to prevent
+ # asterisk from installing sounds files (we pull them in via
+ # asterisk-{core,extra}-sounds and asterisk-moh-opsound.
+ #
+ >"${S}"/sounds/sounds.xml
+}
+
+src_compile() {
+ ASTLDFLAGS="${LDFLAGS}" emake USER_MAKEOPTS="${S}"/gentoo.makeopts || die "emake failed"
+}
+
+src_install() {
+ # setup directory structure
+ #
+ mkdir -p "${D}"usr/$(get_libdir)/pkgconfig
+
+ emake DESTDIR="${D}" install || die "emake install failed"
+
+ if use samples; then
+ emake DESTDIR="${D}" samples || die "emake samples failed"
+ for conffile in "${D}"etc/asterisk/*.*
+ do
+ chown asterisk:asterisk $conffile
+ chmod 0660 $conffile
+ done
+ einfo "Sample files have been installed"
+ else
+ 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/*
+ rm -f "${D}"etc/asterisk/*
+ fi
+ rm -rf "${D}"var/spool/asterisk/voicemail/default
+
+ # 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.4.0/asterisk.initd asterisk
+ newconfd "${FILESDIR}"/1.4.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
+ dodir /usr/src
+
+ ebegin "Copying sources into /usr/src"
+ cp -dPR "${S}" "${D}"/usr/src/${PF} || die "Unable to copy sources"
+ eend $?
+
+ ebegin "Cleaning source tree"
+ emake -C "${D}"/usr/src/${PF} clean &>/dev/null || die "Unable to clean sources"
+ eend $?
+
+ einfo "Clean sources are available in "${ROOT}"usr/src/${PF}"
+ fi
+
+ # install the upgrade documentation
+ #
+ dodoc README UPGRADE* BUGS CREDITS
+
+ # install extra documentation
+ #
+ if use doc
+ then
+ dodoc doc/*.txt
+ dodoc doc/*.pdf
+ dodoc doc/PEERING
+ dodoc doc/CODING-GUIDELINES
+ dodoc doc/tex/*.pdf
+ fi
+
+ # install snmp mib files
+ #
+ if use snmp
+ then
+ insinto /usr/share/snmp/mibs/
+ doins doc/digium-mib.txt doc/asterisk-mib.txt
+ fi
+
+ # install SIP scripts; bug #300832
+ #
+ dodoc "${FILESDIR}/1.6.2/sip_calc_auth"
+ dodoc "${FILESDIR}/1.6.2/find_call_sip_trace.sh"
+ dodoc "${FILESDIR}/1.6.2/find_call_ids.sh"
+ dodoc "${FILESDIR}/1.6.2/call_data.txt"
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/1.4.0/asterisk.logrotate" asterisk
+}
+
+pkg_preinst() {
+ enewgroup asterisk
+ enewuser asterisk -1 -1 /var/lib/asterisk "asterisk,dialout"
+}
+
+pkg_postinst() {
+ #
+ # 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
+ if has_version "=net-misc/asterisk-1.2*"; then
+ ewarn "Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.bz2 before continuing"
+ 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.4.0/asterisk-1.4.0-uclibc.patch b/net-misc/asterisk/files/1.4.0/asterisk-1.4.0-uclibc.patch
new file mode 100644
index 000000000000..476fcf90c198
--- /dev/null
+++ b/net-misc/asterisk/files/1.4.0/asterisk-1.4.0-uclibc.patch
@@ -0,0 +1,13 @@
+--- Makefile.old 2007-01-05 10:12:48 +0000
++++ Makefile 2007-01-05 10:21:52 +0000
+@@ -216,6 +216,10 @@
+ ASTCFLAGS+=-pthread
+ endif
+
++ifeq ($(OSARCH),linux-uclibc)
++ AST_LIBS+=-lpthread -ldl
++endif
++
+ ifeq ($(OSARCH),SunOS)
+ ASTCFLAGS+=-Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
+ endif
diff --git a/net-misc/asterisk/files/1.4.0/asterisk-1.4.0-var_rundir.patch b/net-misc/asterisk/files/1.4.0/asterisk-1.4.0-var_rundir.patch
new file mode 100644
index 000000000000..367dc7163f54
--- /dev/null
+++ b/net-misc/asterisk/files/1.4.0/asterisk-1.4.0-var_rundir.patch
@@ -0,0 +1,11 @@
+--- asterisk-1.4.0/Makefile.orig 2006-12-24 03:07:19.000000000 +0000
++++ asterisk-1.4.0/Makefile 2006-12-24 03:07:57.000000000 +0000
+@@ -109,7 +109,7 @@
+ ASTSBINDIR=$(sbindir)
+ ASTSPOOLDIR=$(localstatedir)/spool/asterisk
+ ASTLOGDIR=$(localstatedir)/log/asterisk
+- ASTVARRUNDIR=$(localstatedir)/run
++ ASTVARRUNDIR=$(localstatedir)/run/asterisk
+ ASTMANDIR=$(mandir)
+ ifeq ($(OSARCH),FreeBSD)
+ ASTVARLIBDIR=$(prefix)/share/asterisk
diff --git a/net-misc/asterisk/files/1.4.0/asterisk-1.4.33-gsm-pic.patch b/net-misc/asterisk/files/1.4.0/asterisk-1.4.33-gsm-pic.patch
new file mode 100644
index 000000000000..208eb125d7b0
--- /dev/null
+++ b/net-misc/asterisk/files/1.4.0/asterisk-1.4.33-gsm-pic.patch
@@ -0,0 +1,59 @@
+--- asterisk-1.4.33.orig/codecs/gsm/Makefile 2010-03-16 20:47:15.000000000 +0000
++++ asterisk-1.4.33/codecs/gsm/Makefile 2010-06-20 18:21:56.576515592 +0100
+@@ -37,30 +37,6 @@
+ ######### ppro's, etc, as well as the AMD K6 and K7. The compile will
+ ######### probably require gcc.
+
+-ifeq (,$(findstring $(shell uname -s),Darwin SunOS))
+- ifeq (,$(findstring $(PROC),x86_64 amd64 ultrasparc sparc64 arm armv5b armeb hppa2.0 ppc powerpc ppc64 ia64 s390 bfin mipsel mips))
+- ifeq (,$(findstring $(shell uname -m),ppc ppc64 alpha armv4l s390))
+- OPTIMIZE+=-march=$(PROC)
+- endif
+- endif
+-else
+- ifneq (,$(findstring $(OSARCH),Darwin))
+- ifeq ($(shell /usr/bin/sw_vers -productVersion | cut -c1-4),10.6)
+- # Snow Leopard reports i386, even though it's really x86_64
+- OPTIMIZE+=-mtune=native
+- endif
+- endif
+-endif
+-
+-#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
+-#This works for even old (2.96) versions of gcc and provides a small boost either way.
+-#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
+-#So we go lowest common available by gcc and go a step down, still a step up from
+-#the default as we now have a better instruction set to work with. - Belgarath
+-ifeq ($(PROC),ultrasparc)
+-OPTIMIZE+=-mcpu=v8 -mtune=$(PROC) -O3
+-endif
+-
+ PG =
+ #PG = -g -pg
+ ######### Profiling flags. If you don't know what that means, leave it blank.
+@@ -217,10 +193,12 @@
+ ifeq ($(OSARCH),linux-gnu)
+ ifeq (,$(findstring $(shell uname -m) , x86_64 amd64 ppc ppc64 alpha armv4l sparc64 parisc s390 ))
+ ifeq (,$(findstring $(PROC) , arm armv5b armeb powerpc ia64 s390 bfin mipsel mips ))
++ifneq ($(K6OPT),)
+ GSM_SOURCES+= $(SRC)/k6opt.s
+ endif
+ endif
+ endif
++endif
+
+ TOAST_SOURCES = $(SRC)/toast.c \
+ $(SRC)/toast_lin.c \
+@@ -269,10 +247,12 @@
+ ifeq ($(OSARCH),linux-gnu)
+ ifeq (,$(findstring $(shell uname -m) , x86_64 amd64 ppc ppc64 alpha armv4l sparc64 parisc ))
+ ifeq (,$(findstring $(PROC) , arm armv5b armeb powerpc ia64 bfin mipsel mips ))
++ifneq ($(K6OPT),)
+ GSM_OBJECTS+= $(SRC)/k6opt.o
+ endif
+ endif
+ endif
++endif
+
+ TOAST_OBJECTS = $(SRC)/toast.o \
+ $(SRC)/toast_lin.o \
diff --git a/net-misc/asterisk/files/1.4.0/asterisk-1.4.33-inband-indications.patch b/net-misc/asterisk/files/1.4.0/asterisk-1.4.33-inband-indications.patch
new file mode 100644
index 000000000000..60b3ead00cce
--- /dev/null
+++ b/net-misc/asterisk/files/1.4.0/asterisk-1.4.33-inband-indications.patch
@@ -0,0 +1,20 @@
+--- asterisk-1.4.33.orig/main/channel.c 2010-05-24 20:37:55.000000000 +0100
++++ asterisk-1.4.33/main/channel.c 2010-06-23 15:06:44.949805705 +0100
+@@ -1767,6 +1767,8 @@ int ast_activate_generator(struct ast_ch
+ chan->generator->release(chan, chan->generatordata);
+ chan->generatordata = NULL;
+ }
++
++ ast_prod(chan);
+ if (gen->alloc && !(chan->generatordata = gen->alloc(chan, params))) {
+ res = -1;
+ }
+@@ -1776,8 +1778,6 @@ int ast_activate_generator(struct ast_ch
+ }
+ ast_channel_unlock(chan);
+
+- ast_prod(chan);
+-
+ return res;
+ }
+
diff --git a/net-misc/asterisk/files/1.4.0/asterisk-1.4.37-imap-libs.patch b/net-misc/asterisk/files/1.4.0/asterisk-1.4.37-imap-libs.patch
new file mode 100644
index 000000000000..ede088579b41
--- /dev/null
+++ b/net-misc/asterisk/files/1.4.0/asterisk-1.4.37-imap-libs.patch
@@ -0,0 +1,11 @@
+--- asterisk-1.4.37.orig/configure.ac 2010-09-10 01:13:45.000000000 +0100
++++ asterisk-1.4.37/configure.ac 2010-11-27 14:37:29.379718734 +0000
+@@ -1032,7 +1032,7 @@
+ CPPFLAGS="${saved_cppflags}"
+ LIBS="${saved_libs}"
+ imap_ldflags=""
+- imap_libs="-lc-client"
++ imap_libs="-lc-client ${IMAP_LIBS}"
+ imap_include="-DUSE_SYSTEM_IMAP" #Try the imap directory first
+ CPPFLAGS="${CPPFLAGS} ${imap_include}"
+ LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
diff --git a/net-misc/asterisk/files/1.4.0/asterisk.confd b/net-misc/asterisk/files/1.4.0/asterisk.confd
new file mode 100644
index 000000000000..4a4ef3f554ce
--- /dev/null
+++ b/net-misc/asterisk/files/1.4.0/asterisk.confd
@@ -0,0 +1,98 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk.confd,v 1.1 2010/12/01 17:54:28 chainsaw Exp $
+
+#
+# Additional options for asterisk
+#
+# see "asterisk -h" for a list of options
+#
+ASTERISK_OPTS=""
+
+#
+# User and group to run asterisk as
+#
+# Value: double-colon separated list of user and group, or empty to run as root:
+#
+#
+# "asterisk:asterisk" to run as user "asterisk" and group "asterisk"
+#
+# "asterisk" to run as user "asterisk" and all groups that user "asterisk" is a member of
+#
+# ":asterisk" to run as user "root" and group "asterisk"
+#
+# "" to run as user "root" and group "root"
+#
+ASTERISK_USER="asterisk"
+
+#
+# Nicelevel
+#
+# Set the priority of the asterisk process
+#
+# Value: (highest) -20..19 (lowest)
+#
+#ASTERISK_NICE="19"
+
+#
+# Wrapper script
+#
+# Value: yes or no/empty
+#
+ASTERISK_WRAPPER="no"
+
+############# Wrapper script settings #############
+
+#
+# Send crash notifications emails to this address
+# (needs a working mail service and /usr/sbin/sendmail to do so (e.g. ssmtp))
+#
+# Value: Email address or empty to disable
+#
+#ASTERISK_NOTIFY_EMAIL="root"
+
+#
+# Send asterisk's output to this terminal
+#
+# Value: Full path to device node or a number
+#
+#ASTERISK_TTY="/dev/tty9"
+
+#
+# Start an asterisk console on the terminal specified by ASTERISK_TTY
+#
+# Warning! Use only for debugging, this is a potential security issue!
+#
+# Value: yes or no/empty
+#
+ASTERISK_CONSOLE="no"
+
+#
+# Maximum size of core files.
+#
+# Value: Size in bytes, unlimited for no limit or empty to disable.
+#
+#ASTERISK_CORE_SIZE="unlimited"
+
+#
+# ASTERISK_CORE_DIR
+#
+# Value: Directory (will be created if non-existant), default is /tmp
+#
+ASTERISK_CORE_DIR="/var/lib/asterisk/coredump"
+
+#
+# Max number of filedescriptors
+#
+# Value: Number of descriptors
+#
+#ASTERISK_MAX_FD="1024"
+
+#
+# Kill these tasks after asterisk crashed (ASTERISK_WRAPPER=yes only!)
+#
+# Warning! This will kill _ALL_ tasks with the specified names!
+#
+# Value: Space separated list of names in double quotes (e.g. "mpg123 mad")
+#
+#ASTERISK_CLEANUP_ON_CRASH="mpg123 asterisk-mpg123 mad"
diff --git a/net-misc/asterisk/files/1.4.0/asterisk.initd b/net-misc/asterisk/files/1.4.0/asterisk.initd
new file mode 100644
index 000000000000..ab1f017ef362
--- /dev/null
+++ b/net-misc/asterisk/files/1.4.0/asterisk.initd
@@ -0,0 +1,273 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/files/1.4.0/asterisk.initd,v 1.1 2010/12/01 17:54:28 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() {
+ logger -t asterisk_wrapper "Initializing asterisk wrapper"
+
+ 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}"
+
+ trap "rm /var/run/asterisk/wrapper_loop.pid" EXIT
+ cut -f4 -d' ' < /proc/self/stat > /var/run/asterisk/wrapper_loop.pid
+
+ while :; do
+ if [ -n "${TTY}" ]; then
+ /usr/bin/stty -F ${TTY} sane
+ ${NICE} /usr/sbin/asterisk ${OPTS} >${TTY} 2>&1 <${TTY}
+ result=$?
+ else
+ set -o pipefail
+ ${NICE} /usr/sbin/asterisk ${OPTS} 2>&1 >/dev/null | logger -t asterisk_wrapper
+ result=$?
+ set +o pipefail
+ fi
+
+ if [ $result -eq 0 ]; then
+ logger -t asterisk_wrapper "Asterisk terminated normally"
+ break
+ else
+ if [ $result -gt 128 ]; then
+ signal=`expr $signal - 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} \
+ || logger -t asterisk_wrapper "${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
+ logger -t asterisk_wrapper "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
+ for element in `find /var/{log,run}/asterisk`; do
+ if [ `stat -c %U $element` != "${USER}" ]; then
+ ewarn "${USER} is not the owner of $element, fixing."
+ chown -R ${USER} /var/{log,run}/asterisk
+ chmod -R u+r /var/{log,run}/asterisk
+ chmod u+x /var/{log,run}/asterisk
+ fi;
+ done;
+ 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
+
+ if [ -r /var/run/asterisk/wrapper_loop.pid ]; then
+ ebegin "Killing wrapper script"
+ kill `cat /var/run/asterisk/wrapper_loop.pid`
+ eend $?
+ fi
+
+ ebegin "Stopping asterisk PBX gracefully"
+ /usr/sbin/asterisk -r -x "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
+}
diff --git a/net-misc/asterisk/files/1.4.0/asterisk.logrotate b/net-misc/asterisk/files/1.4.0/asterisk.logrotate
new file mode 100644
index 000000000000..69296c99e66d
--- /dev/null
+++ b/net-misc/asterisk/files/1.4.0/asterisk.logrotate
@@ -0,0 +1,25 @@
+/var/log/asterisk/messages /var/log/asterisk/queue_log {
+ missingok
+ notifempty
+
+ postrotate
+ /usr/sbin/asterisk -rnx "logger reload" || /bin/true
+ endscript
+}
+
+/var/log/asterisk/debug /var/log/asterisk/full {
+ missingok
+ notifempty
+ daily
+
+ postrotate
+ /usr/sbin/asterisk -rnx "logger reload" || /bin/true
+ endscript
+}
+
+/var/log/asterisk/cdr-csv/*.csv /var/log/asterisk/cdr-custom/*.csv {
+ missingok
+ notifempty
+ weekly
+ rotate 52
+}
diff --git a/net-misc/asterisk/files/1.4.0/func_devstate-r6.c b/net-misc/asterisk/files/1.4.0/func_devstate-r6.c
new file mode 100644
index 000000000000..bee18aa0eea5
--- /dev/null
+++ b/net-misc/asterisk/files/1.4.0/func_devstate-r6.c
@@ -0,0 +1,228 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2007, Digium, Inc.
+ *
+ * Russell Bryant <russell@digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief Manually controlled blinky lights
+ *
+ * \author Russell Bryant <russell@digium.com>
+ *
+ * \ingroup functions
+ *
+ * \note Props go out to Ahrimanes in #asterisk for requesting this at 4:30 AM
+ * when I couldn't sleep. :)
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.1 $")
+
+#include <stdlib.h>
+
+#include "asterisk/module.h"
+#include "asterisk/channel.h"
+#include "asterisk/pbx.h"
+#include "asterisk/utils.h"
+#include "asterisk/linkedlists.h"
+#include "asterisk/devicestate.h"
+#include "asterisk/cli.h"
+#include "asterisk/astdb.h"
+
+static const char astdb_family[] = "CustomDevstate";
+
+static const char *ast_devstate_str(int state)
+{
+ const char *res = "UNKNOWN";
+
+ switch (state) {
+ case AST_DEVICE_UNKNOWN:
+ break;
+ case AST_DEVICE_NOT_INUSE:
+ res = "NOT_INUSE";
+ break;
+ case AST_DEVICE_INUSE:
+ res = "INUSE";
+ break;
+ case AST_DEVICE_BUSY:
+ res = "BUSY";
+ break;
+ case AST_DEVICE_INVALID:
+ res = "INVALID";
+ break;
+ case AST_DEVICE_UNAVAILABLE:
+ res = "UNAVAILABLE";
+ break;
+ case AST_DEVICE_RINGING:
+ res = "RINGING";
+ break;
+ case AST_DEVICE_RINGINUSE:
+ res = "RINGINUSE";
+ break;
+ case AST_DEVICE_ONHOLD:
+ res = "ONHOLD";
+ break;
+ }
+
+ return res;
+}
+
+static int ast_devstate_val(const char *val)
+{
+ if (!strcasecmp(val, "NOT_INUSE"))
+ return AST_DEVICE_NOT_INUSE;
+ else if (!strcasecmp(val, "INUSE"))
+ return AST_DEVICE_INUSE;
+ else if (!strcasecmp(val, "BUSY"))
+ return AST_DEVICE_BUSY;
+ else if (!strcasecmp(val, "INVALID"))
+ return AST_DEVICE_INVALID;
+ else if (!strcasecmp(val, "UNAVAILABLE"))
+ return AST_DEVICE_UNAVAILABLE;
+ else if (!strcasecmp(val, "RINGING"))
+ return AST_DEVICE_RINGING;
+ else if (!strcasecmp(val, "RINGINUSE"))
+ return AST_DEVICE_RINGINUSE;
+ else if (!strcasecmp(val, "ONHOLD"))
+ return AST_DEVICE_ONHOLD;
+
+ return AST_DEVICE_UNKNOWN;
+}
+
+static int devstate_read(struct ast_channel *chan, char *cmd, char *data,
+ char *buf, size_t len)
+{
+ ast_copy_string(buf, ast_devstate_str(ast_device_state(data)), len);
+
+ return 0;
+}
+
+static int devstate_write(struct ast_channel *chan, char *function,
+ char *data, const char *value)
+{
+ size_t len = strlen("Custom:");
+
+ if (strncasecmp(data, "Custom:", len)) {
+ ast_log(LOG_WARNING, "The DEVSTATE function can only be used to set 'Custom:' device state!\n");
+ return -1;
+ }
+ data += len;
+ if (ast_strlen_zero(data)) {
+ ast_log(LOG_WARNING, "DEVSTATE function called with no custom device name!\n");
+ return -1;
+ }
+
+ ast_db_put(astdb_family, data, (char *) value);
+
+ ast_device_state_changed("Custom:%s", data);
+
+ return 0;
+}
+
+static int custom_devstate_callback(const char *data)
+{
+ char buf[256] = "";
+
+ ast_db_get(astdb_family, data, buf, sizeof(buf));
+
+ return ast_devstate_val(buf);
+}
+
+static int cli_funcdevstate_list(int fd, int argc, char *argv[])
+{
+ struct ast_db_entry *db_entry, *db_tree;
+
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+
+ ast_cli(fd, "\n"
+ "---------------------------------------------------------------------\n"
+ "--- Custom Device States --------------------------------------------\n"
+ "---------------------------------------------------------------------\n"
+ "---\n");
+
+ db_entry = db_tree = ast_db_gettree(astdb_family, NULL);
+ for (; db_entry; db_entry = db_entry->next) {
+ const char *dev_name = strrchr(db_entry->key, '/') + 1;
+ if (dev_name <= (const char *) 1)
+ continue;
+ ast_cli(fd, "--- name: 'custom:%s' state: '%s'\n"
+ "---\n", dev_name, db_entry->data);
+ }
+ ast_db_freetree(db_tree);
+ db_tree = NULL;
+
+ ast_cli(fd,
+ "---------------------------------------------------------------------\n"
+ "---------------------------------------------------------------------\n"
+ "\n");
+
+ return RESULT_SUCCESS;
+}
+
+static struct ast_cli_entry cli_funcdevstate[] = {
+ { { "funcdevstate", "list", }, cli_funcdevstate_list, NULL, NULL },
+};
+
+static struct ast_custom_function devstate_function = {
+ .name = "DEVSTATE",
+ .synopsis = "Get or Set a device state",
+ .syntax = "DEVSTATE(device)",
+ .desc =
+ " The DEVSTATE function can be used to retrieve the device state from any\n"
+ "device state provider. For example:\n"
+ " NoOp(SIP/mypeer has state ${DEVSTATE(SIP/mypeer)})\n"
+ " NoOp(Conference number 1234 has state ${DEVSTATE(MeetMe:1234)})\n"
+ "\n"
+ " The DEVSTATE function can also be used to set custom device state from\n"
+ "the dialplan. The \"Custom:\" prefix must be used. For example:\n"
+ " Set(DEVSTATE(Custom:lamp1)=BUSY)\n"
+ " Set(DEVSTATE(Custom:lamp2)=NOT_INUSE)\n"
+ "You can subscribe to the status of a custom device state using a hint in\n"
+ "the dialplan:\n"
+ " exten => 1234,hint,Custom:lamp1\n"
+ "\n"
+ " The possible values for both uses of this function are:\n"
+ "UNKNOWN | NOT_INUSE | INUSE | BUSY | INVALID | UNAVAILABLE | RINGING\n"
+ "RINGINUSE | ONHOLD\n",
+ .read = devstate_read,
+ .write = devstate_write,
+};
+
+static int unload_module(void)
+{
+ int res = 0;
+
+ res |= ast_custom_function_unregister(&devstate_function);
+ ast_devstate_prov_del("Custom");
+ ast_cli_unregister_multiple(cli_funcdevstate, ARRAY_LEN(cli_funcdevstate));
+
+ return res;
+}
+
+static int load_module(void)
+{
+ int res = 0;
+
+ res |= ast_custom_function_register(&devstate_function);
+ res |= ast_devstate_prov_add("Custom", custom_devstate_callback);
+ ast_cli_register_multiple(cli_funcdevstate, ARRAY_LEN(cli_funcdevstate));
+
+ return res;
+}
+
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Gets or sets a device state in the dialplan");
diff --git a/net-misc/asterisk/files/1.4.0/func_volume.c b/net-misc/asterisk/files/1.4.0/func_volume.c
new file mode 100644
index 000000000000..4591e62f24e5
--- /dev/null
+++ b/net-misc/asterisk/files/1.4.0/func_volume.c
@@ -0,0 +1,160 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2007, Digium, Inc.
+ *
+ * Joshua Colp <jcolp@digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief Technology independent volume control
+ *
+ * \author Joshua Colp <jcolp@digium.com>
+ *
+ * \ingroup functions
+ *
+ */
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.1 $")
+
+#include "asterisk/module.h"
+#include "asterisk/channel.h"
+#include "asterisk/pbx.h"
+#include "asterisk/utils.h"
+#include "asterisk/audiohook.h"
+
+struct volume_information {
+ struct ast_audiohook audiohook;
+ int tx_gain;
+ int rx_gain;
+};
+
+static void destroy_callback(void *data)
+{
+ struct volume_information *vi = data;
+
+ /* Destroy the audiohook, and destroy ourselves */
+ ast_audiohook_destroy(&vi->audiohook);
+ free(vi);
+
+ return;
+}
+
+/*! \brief Static structure for datastore information */
+static const struct ast_datastore_info volume_datastore = {
+ .type = "volume",
+ .destroy = destroy_callback
+};
+
+static int volume_callback(struct ast_audiohook *audiohook, struct ast_channel *chan, struct ast_frame *frame, enum ast_audiohook_direction direction)
+{
+ struct ast_datastore *datastore = NULL;
+ struct volume_information *vi = NULL;
+ int *gain = NULL;
+
+ /* If the audiohook is stopping it means the channel is shutting down.... but we let the datastore destroy take care of it */
+ if (audiohook->status == AST_AUDIOHOOK_STATUS_DONE)
+ return 0;
+
+ /* Grab datastore which contains our gain information */
+ if (!(datastore = ast_channel_datastore_find(chan, &volume_datastore, NULL)))
+ return 0;
+
+ vi = datastore->data;
+
+ /* If this is DTMF then allow them to increase/decrease the gains */
+ if (frame->frametype == AST_FRAME_DTMF) {
+ /* Only use DTMF coming from the source... not going to it */
+ if (direction != AST_AUDIOHOOK_DIRECTION_READ)
+ return 0;
+ if (frame->subclass == '*') {
+ vi->tx_gain += 1;
+ vi->rx_gain += 1;
+ } else if (frame->subclass == '#') {
+ vi->tx_gain -= 1;
+ vi->rx_gain -= 1;
+ }
+ } else if (frame->frametype == AST_FRAME_VOICE) {
+ /* Based on direction of frame grab the gain, and confirm it is applicable */
+ if (!(gain = (direction == AST_AUDIOHOOK_DIRECTION_READ) ? &vi->rx_gain : &vi->tx_gain) || !*gain)
+ return 0;
+ /* Apply gain to frame... easy as pi */
+ ast_frame_adjust_volume(frame, *gain);
+ }
+
+ return 0;
+}
+
+static int volume_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
+{
+ struct ast_datastore *datastore = NULL;
+ struct volume_information *vi = NULL;
+ int is_new = 0;
+
+ if (!(datastore = ast_channel_datastore_find(chan, &volume_datastore, NULL))) {
+ /* Allocate a new datastore to hold the reference to this volume and audiohook information */
+ if (!(datastore = ast_channel_datastore_alloc(&volume_datastore, NULL)))
+ return 0;
+ if (!(vi = ast_calloc(1, sizeof(*vi)))) {
+ ast_channel_datastore_free(datastore);
+ return 0;
+ }
+ ast_audiohook_init(&vi->audiohook, AST_AUDIOHOOK_TYPE_MANIPULATE, "Volume");
+ vi->audiohook.manipulate_callback = volume_callback;
+ ast_set_flag(&vi->audiohook, AST_AUDIOHOOK_WANTS_DTMF);
+ is_new = 1;
+ } else {
+ vi = datastore->data;
+ }
+
+ /* Adjust gain on volume information structure */
+ if (!strcasecmp(data, "tx"))
+ vi->tx_gain = atoi(value);
+ else if (!strcasecmp(data, "rx"))
+ vi->rx_gain = atoi(value);
+
+ if (is_new) {
+ datastore->data = vi;
+ ast_channel_datastore_add(chan, datastore);
+ ast_audiohook_attach(chan, &vi->audiohook);
+ }
+
+ return 0;
+}
+
+static struct ast_custom_function volume_function = {
+ .name = "VOLUME",
+ .synopsis = "Set the TX or RX volume of a channel",
+ .syntax = "VOLUME(TX|RX)",
+ .desc =
+ " The VOLUME function can be used to increase or decrease the tx or\n"
+ "rx gain of any channel. For example:\n"
+ " Set(VOLUME(TX)=3)\n"
+ " Set(VOLUME(RX)=2)\n",
+ .write = volume_write,
+};
+
+static int unload_module(void)
+{
+ return ast_custom_function_unregister(&volume_function);
+}
+
+static int load_module(void)
+{
+ return ast_custom_function_register(&volume_function);
+}
+
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Technology independent volume control");