diff options
author | Sven Schwyn <gentoo@bitcetera.com> | 2008-12-13 17:46:24 +0000 |
---|---|---|
committer | Sven Schwyn <gentoo@bitcetera.com> | 2008-12-13 17:46:24 +0000 |
commit | 216f1601d22cd6d71fd027449989853d214a1f2d (patch) | |
tree | 32a0cba103c4649bcc4f7a399b1d38bdbdf790cc /net-misc | |
parent | net-libs/vale: streaming media lib required by CallWeaver (diff) | |
download | voip-216f1601d22cd6d71fd027449989853d214a1f2d.tar.gz voip-216f1601d22cd6d71fd027449989853d214a1f2d.tar.bz2 voip-216f1601d22cd6d71fd027449989853d214a1f2d.zip |
net-misc/callweaver-svn: bleeding edge CallWeaver with support for net-misc/dahdi
svn path=/trunk/; revision=744
Diffstat (limited to 'net-misc')
-rw-r--r-- | net-misc/callweaver-svn/ChangeLog | 9 | ||||
-rw-r--r-- | net-misc/callweaver-svn/Manifest | 5 | ||||
-rw-r--r-- | net-misc/callweaver-svn/callweaver-svn-9999.ebuild | 155 | ||||
-rw-r--r-- | net-misc/callweaver-svn/files/callweaver.conf | 98 | ||||
-rw-r--r-- | net-misc/callweaver-svn/files/callweaver.init | 237 | ||||
-rw-r--r-- | net-misc/callweaver-svn/metadata.xml | 21 |
6 files changed, 525 insertions, 0 deletions
diff --git a/net-misc/callweaver-svn/ChangeLog b/net-misc/callweaver-svn/ChangeLog new file mode 100644 index 0000000..c02c989 --- /dev/null +++ b/net-misc/callweaver-svn/ChangeLog @@ -0,0 +1,9 @@ +# ChangeLog for net-misc/callweaver-svn +# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 +# $Header: $ + + 13 Dec 2008; Sven Schwyn (svoop) <gentoo@bitcetera.com> + +files/callweaver.conf, +files/callweaver.init, +metadata.xml, + +callweaver-svn-9999.ebuild: + initial ebuild + diff --git a/net-misc/callweaver-svn/Manifest b/net-misc/callweaver-svn/Manifest new file mode 100644 index 0000000..e27baa2 --- /dev/null +++ b/net-misc/callweaver-svn/Manifest @@ -0,0 +1,5 @@ +AUX callweaver.conf 2145 RMD160 2a934bf23ca4a1ec75a9c001197f33f432afc239 SHA1 c0547df1a34b3361e17c7095e53f11d7ff3f1260 SHA256 9869cc70f8ede237cbdce6a15775489f59300b1518dc3453a43968ca62f8bc20 +AUX callweaver.init 5739 RMD160 04a187e914cb0c6607cc2dcd555e263bdc305ac0 SHA1 2f9a0499964be2c77799bad89bda2e800041295c SHA256 3b439847bfbb02d3be46248f30bd4e8c531b3cdbfe2be8d1c9796346d077f73e +EBUILD callweaver-svn-9999.ebuild 4718 RMD160 d29a0bb70c05b4e0ed2550099adf0c52f93c0f72 SHA1 9190459ffdb68e59f7b1d160943bcf9d48a8d882 SHA256 11ac9aee165d7987d4a7c8c8f8d590d0e1abe7221095c526dba4eff6da52060e +MISC ChangeLog 296 RMD160 3629a95c883875b94b173ad4d211403ce9b86d46 SHA1 3e48922c6ab4894607ebc724f54f27d1ea1ead2b SHA256 732cf242e14599db79017703978ad642dd053e14f0874f7e8278f2c49b23460f +MISC metadata.xml 1138 RMD160 9efd1395dabb68739bc3b6a30fbd50ee4fdd1d7b SHA1 fcec473c51e88fe274b9a1895a97fb862a57417c SHA256 bf4dab7f3f7aeeee8986e27f99d3da84b87c186ed582da46d2d53d6510be6253 diff --git a/net-misc/callweaver-svn/callweaver-svn-9999.ebuild b/net-misc/callweaver-svn/callweaver-svn-9999.ebuild new file mode 100644 index 0000000..8e7d0d2 --- /dev/null +++ b/net-misc/callweaver-svn/callweaver-svn-9999.ebuild @@ -0,0 +1,155 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit eutils subversion + +DESCRIPTION="Community-driven vendor-independent cross-platform Open Source PBX software." +HOMEPAGE="http://www.callweaver.org/" +# ESVN_REPO_URI="http://svn.callweaver.org/callweaver/branches/rel/1.2/" +ESVN_REPO_URI="http://svn.callweaver.org/callweaver/trunk/" +ESVN_BOOTSTRAP="./bootstrap.sh" +S="${WORKDIR}/${PN}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="ael dahdi debug fax jabber mgr2 misdn mysql odbc postgres profile speex t38" + +RDEPEND="!net-misc/callweaver + >=media-libs/spandsp-0.0.6_pre3 + >=net-libs/vale-0.0.2 + >=sys-libs/libcap-1.10 + dahdi? ( net-misc/dahdi ) + dahdi? ( net-misc/dahdi-tools ) + misdn? ( >=net-dialup/misdn-1.1.7 >=net-dialup/misdnuser-1.1.7 ) + speex? ( media-libs/speex ) + mysql? ( dev-db/mysql ) + postgres? ( dev-db/postgresql )" + +DEPEND="${RDEPEND} + sys-devel/flex + dev-util/subversion + >=sys-devel/automake-1.9.6 + >=sys-devel/autoconf-2.59 + >=sys-devel/libtool-1.5.20" + +src_unpack() { + subversion_fetch + cd "${S}" + subversion_bootstrap +} + +src_compile() { + ewarn "Zaptel has been renamed to DAHDI and therefore the 'zap' and" + ewarn "'zaptel' USE flags are no longer recognized. Set the 'dahdi'" + ewarn "USE flag instead and make sure you move your configurations" + ewarn "from /etc/zaptel.conf to /etc/dahdi/system.conf and from" + ewarn "/etc/callweaver/zapata.conf to /etc/callweaver/chan_dahdi.conf." + ebeep 10 + echo "" + ewarn "This ebuild from SVN is using the bleeding edge trunk version until" + ewarn "the DAHDI patches have been merged with the rel/1.2 branch. This" + ewarn "means that you should not expect everything to fully work. If you" + ewarn "can't live with this, you should stay with the regular callweaver" + ewarn "ebuild. You have been warned!" + ebeep 10 + echo "" + ewarn "All USE flags are experimental, please submit issues and patches to:" + ewarn "http://bugs.gentoo.org/buglist.cgi?quicksearch=callweaver" + epause 10 + econf \ + --libdir=/usr/$(get_libdir)/callweaver \ + --datadir=/var/lib \ + --localstatedir=/var \ + --sharedstatedir=/var/lib/callweaver \ + --with-directory-layout=lsb \ + $(use_with ael pbx_ael) \ + $(use_with dahdi chan_zap) \ + $(use_with fax chan_fax) \ + $(use_with fax app_rxfax) \ + $(use_with fax app_txfax) \ + $(use_with jabber res_jabber) \ + $(use_with misdn chan_misdn) \ + $(use_with mgr2 chan_unicall) \ + $(use_with mysql cdr_mysql) \ + $(use_with mysql res_config_mysql) \ + $(use_with odbc res_odbc) \ + $(use_with odbc res_config_odbc) \ + $(use_with postgres cdr_pgsql) \ + $(use_with postgres res_config_pgsql) \ + $(use_with speex codec_speex) \ + $(use_with t38 app_rxfax) \ + $(use_with t38 app_txfax) \ + $(use_enable debug) \ + $(use_enable profile) \ + $(use_enable t38) \ + || die "configure failed" + emake || die "emake failed" +} + +src_install() { + emake DESTDIR="${D}" install || die "emake install failed" + + dodoc README INSTALL AUTHORS NEWS BUGS + dodoc TODO_FOR_AUTOMAKE SECURITY CREDITS HARDWARE + dodoc doc/README* doc/*.txt doc/*.pdf + + docinto samples + dodoc "${D}"etc/callweaver/*.sample + + rm -rf "${D}"var/lib/callweaver/doc + + newinitd "${FILESDIR}"/callweaver.init callweaver + newconfd "${FILESDIR}"/callweaver.conf callweaver + + keepdir /var/{log,run,spool}/callweaver + keepdir /var/lib/callweaver/{images,keys} +} + +pkg_preinst() { + if [[ -z "$(egetent passwd callweaver)" ]]; then + elog "Creating callweaver group and user..." + enewgroup callweaver + enewuser callweaver -1 -1 /var/lib/callweaver "callweaver,dialout" + fi + + # make sure callweaver is in the dialout group (for upgrading users) + # TODO: remove this 3 months after the release of callweaver-1.2.1 + usermod -a -G dialout callweaver +} + +pkg_postinst() { + elog "Fixing permissions..." + + chmod -R u=rwX,g=rX,o= "${ROOT}"etc/callweaver + chown -R root:callweaver "${ROOT}"etc/callweaver + + for x in lib log run spool; do + chmod -R u=rwX,g=rX,o= "${ROOT}"var/${x}/callweaver + chown -R callweaver:callweaver "${ROOT}"var/${x}/callweaver + done + + chown -R root:callweaver "${ROOT}"usr/lib/callweaver +} + +pkg_config() { + elog "Do you want to reset the permissions and ownerships of callweaver to" + elog "the default values (y/N)?" + read res + + res="$(echo $res | tr [[:upper:]] [[:lower:]])" + + if [[ "$res" = "y" ]] || [[ "$res" = "yes" ]]; then + elog "First time installation, fixing permissions..." + + chmod -R u=rwX,g=rX,o= "${ROOT}"etc/callweaver + chown -R root:callweaver "${ROOT}"etc/callweaver + + for x in lib log run spool; do + chmod -R u=rwX,g=rX,o= "${ROOT}"var/${x}/callweaver + chown -R callweaver:callweaver "${ROOT}"var/${x}/callweaver + done + fi +} + diff --git a/net-misc/callweaver-svn/files/callweaver.conf b/net-misc/callweaver-svn/files/callweaver.conf new file mode 100644 index 0000000..0926a6c --- /dev/null +++ b/net-misc/callweaver-svn/files/callweaver.conf @@ -0,0 +1,98 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# +# Additional options for callweaver +# +# see "callweaver -h" for a list of options +# +CALLWEAVER_OPTS="" + +# +# User and group to run callweaver as +# +# Value: double-colon separated list of user and group, or empty to run as root: +# +# +# "callweaver:callweaver" to run as user "callweaver" and group "callweaver" +# +# "callweaver" to run as user "callweaver" and default group of user callweaver +# +# ":callweaver" to run as user "root" and group "callweaver" +# +# "" to run as user "root" and group "root" +# +CALLWEAVER_USER="callweaver:callweaver" + +# +# Nicelevel +# +# Set the priority of the callweaver process +# +# Value: (highest) -20..19 (lowest) +# +#CALLWEAVER_NICE="19" + +# +# Wrapper script +# +# Value: yes or no/empty +# +CALLWEAVER_WRAPPER="yes" + +############# 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 +# +CALLWEAVER_NOTIFY_EMAIL="your@email.here" + +# +# Send callweaver's output to this terminal +# +# Value: Full path to device node or a number +# +#CALLWEAVER_TTY="/dev/tty9" + +# +# Start an callweaver console on the terminal specified by CALLWEAVER_TTY +# +# Warning! Use only for debugging, this is a potential security issue! +# +# Value: yes or no/empty +# +CALLWEAVER_CONSOLE="no" + +# +# Maximum size of core files. +# +# Value: Size in bytes, unlimited for no limit or empty to disable. +# +CALLWEAVER_CORE_SIZE="unlimited" + +# +# CALLWEAVER_CORE_DIR +# +# Value: Directory (will be created if non-existant), default is /tmp +# +CALLWEAVER_CORE_DIR="/var/lib/callweaver/coredump" + +# +# Max number of filedescriptors +# +# Value: Number of descriptors +# +#CALLWEAVER_MAX_FD="1024" + +# +# Kill these tasks after callweaver crashed (CALLWEAVER_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") +# +#CALLWEAVER_CLEANUP_ON_CRASH="mpg123 mad" diff --git a/net-misc/callweaver-svn/files/callweaver.init b/net-misc/callweaver-svn/files/callweaver.init new file mode 100644 index 0000000..9a71c45 --- /dev/null +++ b/net-misc/callweaver-svn/files/callweaver.init @@ -0,0 +1,237 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +opts="${opts} forcestop reload" + +depend() { + need net + use dahdi mysql postgresql slapd capi +} + +is_running() { + if [[ -z "$(pidof callweaver)" ]]; then + return 1 + else + PID="$(cat /var/run/callweaver/callweaver.pid)" + for x in $(pidof callweaver); do + if [[ "${x}" = "${PID}" ]]; then + return 0 + fi + done + fi + + return 1 +} + +callweaver_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 + CALLWEAVER_CONSOLE="$(echo ${CALLWEAVER_CONSOLE} | tr [:lower:] [:upper:])" + + if [[ -n "${CALLWEAVER_CORE_SIZE}" ]] && + [[ "${CALLWEAVER_CORE_SIZE}" != "0" ]]; then + ulimit -c ${CALLWEAVER_CORE_SIZE} + + if [[ -n "${CALLWEAVER_CORE_DIR}" ]] && \ + [[ ! -d "${CALLWEAVER_CORE_DIR}" ]] + then + mkdir -m750 -p "${CALLWEAVER_CORE_DIR}" + + if [[ -n "${CALLWEAVER_USER}" ]]; then + chown -R "${CALLWEAVER_USER}" "${CALLWEAVER_CORE_DIR}" + fi + fi + CALLWEAVER_CORE_DIR="${CALLWEAVER_CORE_DIR:-/tmp}" + + cd "${CALLWEAVER_CORE_DIR}" + echo " Core dump size : ${CALLWEAVER_CORE_SIZE}" + echo " Core dump location : ${CALLWEAVER_CORE_DIR}" + fi + + if [[ -n "${CALLWEAVER_MAX_FD}" ]]; then + ulimit -n ${CALLWEAVER_MAX_FD} + echo " Max open filedescriptors : ${CALLWEAVER_MAX_FD}" + fi + + if [[ -n "${CALLWEAVER_NICE}" ]]; then + echo " Nice level : ${CALLWEAVER_NICE}" + NICE="/bin/nice -n ${CALLWEAVER_NICE} --" + fi + + if [[ -n "${CALLWEAVER_NOTIFY_EMAIL}" ]]; then + if [[ -x /usr/sbin/sendmail ]]; then + echo " Email notifications go to : ${CALLWEAVER_NOTIFY_EMAIL}" + else + echo " Notifications disabled, /usr/sbin/sendmail doesn't exist or is not executable!" + unset CALLWEAVER_NOTIFY_EMAIL + fi + fi + + if [[ -n "${CALLWEAVER_TTY}" ]]; then + for x in ${CALLWEAVER_TTY} \ + /dev/tty${CALLWEAVER_TTY} \ + /dev/vc/${CALLWEAVER_TTY} + do + if [[ -c "${x}" ]]; then + TTY="${x}" + fi + done + [[ -n "${TTY}" ]] && \ + echo " Messages are sent to : ${TTY}" + fi + + if [[ "${CALLWEAVER_CONSOLE}" = "YES" ]] && [[ -n "${TTY}" ]]; then + echo " Starting CallWeaver console : ${CALLWEAVER_CONSOLE}" + OPTS="${OPTS} -c" + fi + + OPTS="${OPTS} ${ARGS}" + + while :; do + + if [[ -n "${TTY}" ]]; then + /usr/bin/stty -F ${TTY} sane + ${NICE} /usr/sbin/callweaver ${OPTS} >${TTY} 2>&1 <${TTY} + result=$? + else + ${NICE} /usr/sbin/callweaver ${OPTS} +# TODO: temporary disable dumping output as callweaver would die with error 11 +# ${NICE} /usr/sbin/callweaver ${OPTS} &>/dev/null + result=$? + fi + + if [[ $result -eq 0 ]]; then + echo "CallWeaver terminated normally" + break + else + if [[ $result -gt 128 ]]; then + signal=$((result - 128)) + MSG="CallWeaver terminated with Signal: $signal" + + CORE_TARGET="core-$(date "+%Y%m%d-%h%M%s")" + + local CORE_DUMPED=0 + if [[ -f "${CALLWEAVER_CORE_DIR}/core" ]]; then + mv "${CALLWEAVER_CORE_DIR}/core" \ + "${CALLWEAVER_CORE_DIR}/${CORE_TARGET}" + CORE_DUMPED=1 + + elif [[ -f "${CALLWEAVER_CORE_DIR}/core.${PID}" ]]; then + mv "${CALLWEAVER_CORE_DIR}/core.${PID}" \ + "${CALLWEAVER_CORE_DIR}/${CORE_TARGET}" + CORE_DUMPED=1 + + fi + + [[ $CORE_DUMPED -eq 1 ]] && \ + MSG="${MSG}\n\rCore dumped: ${CALLWEAVER_CORE_DIR}/${CORE_TARGET}" + else + MSG="CallWeaver terminated with return code: $result" + fi + + # kill left-over tasks + for X in ${CALLWEAVER_CLEANUP_ON_CRASH}; do + kill -9 $(pidof ${X}); + done + fi + + [[ -n "${TTY}" ]] \ + && echo "${MSG}" >${TTY} \ + || echo "${MSG}" + + + if [[ -n "${CALLWEAVER_NOTIFY_EMAIL}" ]] && \ + [[ -x /usr/sbin/sendmail ]]; then + echo -e -n "Subject: CallWeaver crashed\n\r${MSG}\n\r" |\ + /usr/sbin/sendmail "${CALLWEAVER_NOTIFY_EMAIL}" + fi + sleep 5 + echo "Restarting CallWeaver..." + done + return 0 +} + +start() { + local OPTS USER GROUP PID + local tmp x + + if [[ -n "${CALLWEAVER_NICE}" ]]; then + if [[ ${CALLWEAVER_NICE} -ge -20 ]] && \ + [[ ${CALLWEAVER_NICE} -le 19 ]]; then + OPTS="--nicelevel ${CALLWEAVER_NICE}" + else + eerror "Nice value must be between -20 and 19" + return 1 + fi + fi + + if [[ -n "${CALLWEAVER_USER}" ]]; then + USER=${CALLWEAVER_USER/:*/} + GROUP=$(echo $CALLWEAVER_USER | awk -F: '/.*:.*/ { print $2 }') + if [[ -n "${USER}" ]]; then + CALLWEAVER_OPTS="${CALLWEAVER_OPTS} -U ${USER}" + fi + if [[ -n "${GROUP}" ]]; then + CALLWEAVER_OPTS="${CALLWEAVER_OPTS} -G ${GROUP}" + GROUP=":${GROUP}" # make it look nice... + fi + ebegin "Starting CallWeaver (as ${USER}${GROUP})" + else + ebegin "Starting CallWeaver (as root)" + fi + + if [[ "$(echo ${CALLWEAVER_WRAPPER} | tr [:upper:] [:lower:])" != "yes" ]]; then + start-stop-daemon --start --exec /usr/sbin/callweaver \ + ${OPTS} -- ${CALLWEAVER_OPTS} + else + callweaver_run_loop ${CALLWEAVER_OPTS} 2>/dev/null & + fi + + if [[ $result -eq 0 ]]; then + # 2 seconds should be enough for callweaver to start + sleep 2 + + result=$(is_running) + fi + + eend $result +} + +forcestop() { + ebegin "Stopping CallWeaver" + start-stop-daemon --stop --pidfile /var/run/callweaver/callweaver.pid + eend $? +} + +stop() { + + if is_running; then + ebegin "Stopping CallWeaver gracefully" + /usr/sbin/callweaver -r -x "stop gracefully" &>/dev/null + [[ $? -eq 0 ]] && svc_stop + eend + else + + eerror "CallWeaver is not running!" + fi +} + +reload() { + if is_running; then + ebegin "Forcing CallWeaver to reload configuration" + /usr/sbin/callweaver -r -x "reload" &>/dev/null + eend $? + else + eerror "CallWeaver is not running!" + fi +} diff --git a/net-misc/callweaver-svn/metadata.xml b/net-misc/callweaver-svn/metadata.xml new file mode 100644 index 0000000..329b5f3 --- /dev/null +++ b/net-misc/callweaver-svn/metadata.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>maintainer-wanted</herd> + <longdescription lang="en"> + CallWeaver is a community-driven, vendor-independent, cross-platform, + open source, PBX software project (formerly known as OpenPBX.org). It + was originally derived from Asterisk. Now it supports analog and + digital PSTN telephony, multi-protocol voice over IP telephony, fax, + software-fax, T.38 fax over IP and many telephony applications such as + IVR, conferencing and callcenter queue management. + </longdescription> + <use> + <flag name='ael'>Support AEL (Asterisk Extension Language) for a more C-style extensions configuration.</flag> + <flag name='dahdi'>Support Digium compatible hardware (formerly known as Zaptel).</flag> + <flag name='fax'>Support the fax channel driver.</flag> + <flag name='mgr2'>Support the Unicall call abstraction layer.</flag> + <flag name='misdn'>Support the new ISDN stack of Linux 2.6 kernels.</flag> + <flag name='t38'>Support T.38 fax over IP.</flag> + </use> +</pkgmetadata>
\ No newline at end of file |