OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /v/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-src Date: 08-Mar-2008 22:37:19 Branch: HEAD Handle: 2008030821371800 Added files: openpkg-src/asterisk16 asterisk.txt asterisk16.patch asterisk16.spec rc.asterisk Log: first cut for an Asterisk 1.6 package Summary: Revision Changes Path 1.1 +507 -0 openpkg-src/asterisk16/asterisk.txt 1.1 +137 -0 openpkg-src/asterisk16/asterisk16.patch 1.1 +369 -0 openpkg-src/asterisk16/asterisk16.spec 1.1 +56 -0 openpkg-src/asterisk16/rc.asterisk ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/asterisk16/asterisk.txt ============================================================================ $ cvs diff -u -r0 -r1.1 asterisk.txt --- /dev/null 2008-03-08 22:36:07 +0100 +++ asterisk.txt 2008-03-08 22:37:19 +0100 @@ -0,0 +1,507 @@ +<file name="asterisk.conf"> +;; +;; asterisk.conf -- Asterisk master configuration +;; + +[directories] +astetcdir = @l_prefix@/etc/asterisk +astmoddir = @l_prefix@/lib/asterisk/modules +astagidir = @l_prefix@/share/asterisk/agi-bin +astvarlibdir = @l_prefix@/share/asterisk +astspooldir = @l_prefix@/var/asterisk/spool +astrundir = @l_prefix@/var/asterisk/run +astlogdir = @l_prefix@/var/asterisk/log + +[files] +astctlowner = @l_rusr@ +astctlgroup = @l_rgrp@ +astctlpermissions = 700 +astctl = asterisk.ctl + +[options] +systemname = openpkg-pbx +runuser = @l_rusr@ +rungroup = @l_rgrp@ +verbose = 0 +alwaysfork = yes +dumpcore = no +quiet = yes +highpriority = yes +initcrypto = no +nocolor = yes +execincludes = no +;timestamp = yes +;optiondebug = no +;nofork = no +;console = no +;dontwarn = no + +</file> +<file name="modules.conf"> +;; +;; modules.conf -- Asterisk functionality module configuration +;; + +[modules] +autoload = yes +noload = pbx_gtkconsole.so ; not wished +noload = pbx_kdeconsole.so ; not wished +noload = app_intercom.so ; obsolete +noload = chan_modem.so ; obsolete +noload = chan_modem_aopen.so ; obsolete +noload = chan_modem_bestdata.so ; obsolete +noload = chan_modem_i4l.so ; obsolete +noload = chan_alsa.so ; not wished +noload = chan_oss.so ; not wished +noload = chan_iax2.so ; not wished +noload = pbx_dundi.so ; not yet wished +noload = chan_agent.so ; not yet wished +noload = chan_mgcp.so ; not yet wished +noload = chan_skinny.so ; not yet wished +noload = app_queue.so ; not yet wished +noload = cdr_custom.so ; not yet wished +noload = pbx_ael.so ; not yet wished +noload = app_meetme.so ; not yet wished +load = app_conference.so ; wished +load = res_musiconhold.so ; wished + +[global] + +</file> +<file name="logger.conf"> +;; +;; logger.conf -- Asterisk logging configuration +;; + +[general] +dateformat = %F %T +queue_log = no +event_log = no + +[logfiles] +console = error,warning,notice,verbose +asterisk.log = error,warning,notice ; verbose,debug + +</file> +<file name="manager.conf"> +;; +;; manager.conf -- Asterisk internal manager API configuration +;; + +[general] +enabled = no +port = 5038 +bindaddr = 10.10.0.1 +displayconnects = yes + +[asterisk] +secret = asterisk +deny = 0.0.0.0/0.0.0.0 +permit = 10.10.0.0/255.255.0.0 +read = system,call,log,verbose,command,agent,user +write = system,call,log,verbose,command,agent,user + +</file> +<file name="sip.conf"> +;; +;; sip.conf -- Asterisk SIP configuration +;; + +[general] +useragent = OpenPKG Asterisk PBX +realm = example +bindport = 5060 +bindaddr = 127.0.0.1 +srvlookup = yes +useclientcode = yes +allowguest = yes +canreinvite = no +disallow = all +allow = speex +allow = g726 +allow = ulaw +allow = alaw +allow = gsm +context = external +;register = NNNNNNN:XXXXXX:[EMAIL PROTECTED]/s + +;[sipgate] +;type = peer +;username = NNNNNNN +;host = sipgate.de +;fromuser = NNNNNNN +;fromdomain = sipgate.de +;canreinvite = no +;disallow = all +;allow = speex +;allow = g726 +;allow = ulaw +;allow = alaw +;allow = gsm +;context = external + +;[gw] +;type = friend +;username = gw +;callerid = "ISDN-to-SIP" <gw> +;fromdomain = example.com +;secret = asterisk +;host = dynamic +;canreinvite = no +;disallow = all +;allow = g726 +;allow = ulaw +;allow = alaw +;allow = gsm +;dtmfmode = rfc2833 +;qualify = yes +;insecure = yes +;context = external + +[foo] +type = friend +username = foo +callerid = "Mr. Foo" <foo> +fromdomain = example.com +secret = asterisk +host = dynamic +disallow = all +allow = speex +allow = g726 +allow = ulaw +allow = alaw +dtmfmode = rfc2833 +qualify = yes +context = internal + +[bar] +type = friend +username = bar +callerid = "Mr. Bar" <bar> +fromdomain = example.com +secret = asterisk +host = dynamic +disallow = all +allow = speex +allow = g726 +allow = ulaw +allow = alaw +dtmfmode = rfc2833 +qualify = yes +context = internal + +</file> +<file name="rtp.conf"> +;; +;; rtp.conf -- Asterisk RTP configuration +;; + +[general] +rtpstart = 7070 +rtpend = 7089 + +</file> +<file name="extensions.conf"> +;; +;; extensions.conf -- Asterisk inbound & outbound call configuration +;; + +[general] +static = yes +writeprotect = yes +autofallthrough = yes + +[globals] +MEETME_SPOOLDIR = @l_prefix@/var/asterisk/spool/meetme +STAFF = SIP/foo&SIP/bar +CONSOLE = Console/dsp + +;; +;; SPECIAL CONTEXTS +;; + +[macro-dial] +exten = s,1,Dial(${ARG1},${ARG2},j${ARG3}) +exten = s,n,Goto(s-${DIALSTATUS},1) +exten = s-BUSY,1,Voicemail(u${ARG1}) +exten = s-BUSY,2,Busy +exten = s-CONGESTION,1,Busy +exten = s-CANCEL,1,Busy +exten = s-ANSWER,1,Hangup +exten = s-NOANSWER,1,Hangup +exten = s-CHANUNAVAIL,1,Hangup +exten = _s-.,1,Goto(s-NOANSWER,1) + +[default] +; currently empty + +;; +;; EXTERNAL DIAL CONTEXT +;; + +[external] +include = default + +; external incoming SIP connection +exten = example,hint,${STAFF} +exten = example,1,Goto(s,1) +exten = s,n,Ringing +exten = s,n,Wait(1) +exten = s,n,Answer +exten = s,n,Macro(dial,${STAFF},30,gTtr) + +; external to internal mapping +exten = foo,hint,SIP/foo +exten = foo,1,Goto(internal,foo,1) +exten = bar,hint,SIP/bar +exten = bar,1,Goto(internal,bar,1) + +;; +;; INTERNAL DIAL CONTEXT +;; + +[internal] +include = default + +; internal to external mapping +exten = example,1,Goto(external,example,1) + +; internal user <foo> #11 +exten = foo,hint,SIP/foo +exten = foo,1,Goto(11,1) +exten = 11,hint,SIP/foo +exten = 11,1,Macro(dial,SIP/foo,30,gTtr) + +; internal user <bar> #12 +exten = bar,hint,SIP/bar +exten = bar,1,Goto(12,1) +exten = 12,hint,SIP/bar +exten = 12,1,Macro(dial,SIP/bar,30,gTtr) + +; internal group <all> #20 +exten = all,1,Goto(20,1) +exten = 20/foo,1,Macro(dial,SIP/bar,60) +exten = 20/bar,1,Macro(dial,SIP/foo,60) + +; internal service <conference> #7<n> +exten = conference,1,Goto(70,1) +exten = _7[0-9],1,Set(confno=${EXTEN:1}) +exten = _7[0-9],n,Goto(7,enter) +exten = 7,1,Set(TIMEOUT(digit)=3) +exten = 7,n,Set(TIMEOUT(response)=6) +exten = 7,n(repeat),Read(confno,conf-getconfno,3) +exten = 7,n,GotoIf($[${confno} >= 0 & ${confno} <= 9]?enter) +exten = 7,n,Playback(conf-invalid) +exten = 7,n,Goto(repeat) +exten = 7,n(enter),Playback(conf-placeintoconf) +exten = 7,n,SayNumber(${confno}) +exten = 7,n,Set(SPYGROUP=conference-${confno}) +exten = 7,n,Set(confopt=cps) +exten = 7,n,GotoIf($[${confno} >= 4 & ${confno} <= 9]?l1:l2) +exten = 7,n(l1),Set(confopt=${confopt}i) +exten = 7,n(l2),GotoIf($[${confno} >= 7 & ${confno} <= 9]?l3:l4) +exten = 7,n(l3),Set(confopt=${confopt}r) +exten = 7,n,Set(MEETME_RECORDINGFILE=${MEETME_SPOOLDIR}/meetme-conference-${confno}-${TIMESTAMP}) +exten = 7,n,Set(MEETME_RECORDINGFORMAT=wav49) +exten = 7,n,Playback(this-call-may-be-monitored-or-recorded) +exten = 7,n(l4),MeetMe(${confno},${confopt}) +exten = 7,n,Playback(vm-goodbye) +exten = 7,n,Hangup + +; internal service <voicemail> #80/#*<n> +exten = voicemail,1,Goto(80,1) +exten = 80,1,VoicemailMain(s${CALLERIDNUM}) +exten = 80,n,Hangup +exten = _*XX,1,Voicemail(u${EXTEN:1}) +exten = _*XX,n,Hangup + +; internal service <echo> #81 +exten = echo,1,Goto(81,1) +exten = 81,1,Answer +exten = 81,n,Playback(demo-echotest) +exten = 81,n,Echo +exten = 81,n,Playback(demo-echodone) +exten = 81,n,Hangup + +; internal service <reload> #82 +exten = reload,1,Goto(82,1) +exten = 82,1,Answer +exten = 82,n,Read(pin,conf-getpin,4) +exten = 82,n,GotoIf($[${pin} = 1234]?ok) +exten = 82,n,Playback(conf-invalidpin) +exten = 82,n,Hangup +exten = 82,n(ok),Playback(beep) +exten = 82,n,Wait(1) +exten = 82,n,Playback(beep) +exten = 82,n,Wait(1) +exten = 82,n,Playback(beep) +exten = 82,n,Wait(1) +exten = 82,n,System(@l_prefix@/sbin/asterisk -rx reload) +exten = 82,n,Hangup + +; external outgoing ISDN (via SIP-to-ISDN gateway call-through) +;exten = _0.,1,Set(number=${EXTEN:1}) +;exten = _0.,n,Set(enum=${ENUMLOOKUP(+${number},ALL)}) +;exten = _0.,n,Set(enum_is_sip_url=${REGEX("^SIP/.+" ${enum})}) +;exten = _0.,n,GotoIf($["${enum_is_sip_url}" = "1"]?sip:isdn) +;exten = _0.,n(sip),Dial(${enum},60,o) +;exten = _0.,n,Goto(_0.,7) +;exten = _0.,n(isdn),Dial(SIP/gw,60,D(w1234w0#31#${number}#)) +;exten = _0.,n,Hangup + +; internal outgoing SIP call (part 1/2) +; (notice sort-order trickery!) +include = internal-siponly + +[internal-siponly] +; internal outgoing SIP call (part 2/2) +; (notice sort-order trickery!) +exten = [EMAIL PROTECTED],1,Dial(SIP/[EMAIL PROTECTED],60,o) +exten = [EMAIL PROTECTED],n,Hangup +exten = [EMAIL PROTECTED],102,Busy + +</file> +<file name="enum.conf"> +;; +;; enum.conf -- Asterisk ENUM configuration +;; + +[general] +search = e164.arpa +search = e164.org + +</file> +<file name="musiconhold.conf"> +;; +;; musiconhold.conf -- Asterisk music-on-hold configuration +;; + +[default] +mode = quietmp3 +directory = @l_prefix@/share/asterisk/mohmp3 + +</file> +<file name="voicemail.conf"> +;; +;; voicemail.conf -- Asterisk voice mail configuration +;; + +[general] +format = wav49 +serveremail = [EMAIL PROTECTED] +attach = yes +maxmsg = 20 +maxmessage = 180 +minmessage = 3 +maxgreet = 60 +skipms = 3000 +maxsilence = 10 +silencethreshold = 128 +maxlogins = 3 +charset = ISO-8859-1 +pbxskip = yes +fromstring = Asterisk PBX +usedirectory = yes +emailsubject = [PBX]: New voice message ${VM_MSGNUM} in mailbox ${VM_MAILBOX} +emailbody = Dear ${VM_NAME},\n\njust wanted to let you know you were left a ${VM_DUR} long\nvoice message (number ${VM_MSGNUM}) in voice mailbox ${VM_MAILBOX}\nfrom caller ${VM_CALLERID},\non ${VM_DATE}.\nYou might want to check it when you get a chance. Thanks!\n\n\t\t\t\t-- OpenPKG Asterisk PBX\n +pagerfromstring = Asterisk PBX +pagersubject = New VM +pagerbody = New ${VM_DUR} long msg in box ${VM_MAILBOX}\nfrom ${VM_CALLERID}, on ${VM_DATE} +emaildateformat = %A, %d %B %Y %H:%M:%S %r +mailcmd = @l_prefix@/sbin/sendmail -t + +[default] +1 = 1,Example,[EMAIL PROTECTED],,|delete=yes + +</file> +<file name="meetme.conf"> +;; +;; meetme.conf -- Asterisk conference configuration +;; + +[general] +audiobuffers = 16 + +[rooms] +conf = 0 +conf = 1 +conf = 2 +conf = 3 +conf = 4 +conf = 5 +conf = 6 +conf = 7 +conf = 8 +conf = 9,1234,1234 + +</file> +<file name="codecs.conf"> +;; +;; codecs.conf -- Asterisk codec configuration +;; + +[speex] +quality = 4 +complexity = 3 +enhancement = true +vad = true +vbr = true +abr = 8000 +vbr_quality = 5 +dtx = false +preprocess = false +pp_vad = false +pp_agc = false +pp_agc_level = 8000 +pp_denoise = false +pp_dereverb = false +pp_dereverb_decay = 0.4 +pp_dereverb_level = 0.3 + +[plc] +genericplc = true + +</file> +<file name="zapata.conf"> +;; +;; zapata.conf -- Asterisk Zap channel configuration +;; + +; (an empty configuration is ok, but required even for dummy Zaptel support) +</file> +<file name="capi.conf"> +;; +;; capi.conf -- Asterisk ISDN/CAPI channel configuration +;; + +[general] +nationalprefix = 0 +internationalprefix = 00 +rxgain = 1.0 +txgain = 1.0 +ulaw = no +debug = yes + +[ISDN1] +isdnmode = msn +incomingmsn = * +controller = 0 +group = 1 +;prefix = 0 +softdtmf = off +relaxdtmf = off +accountcode = +context = external +holdtype = local +;immediate = yes +echocancel = no +echosquelch = no +;echotail = 64 +;bridge = yes +;callgroup = 1 +;deflect = 1234567 +devices = 2 +;wait_silence_samples = 1000 +;dtmf_generate = yes + +</file> @@ . patch -p0 <<'@@ .' Index: openpkg-src/asterisk16/asterisk16.patch ============================================================================ $ cvs diff -u -r0 -r1.1 asterisk16.patch --- /dev/null 2008-03-08 22:36:07 +0100 +++ asterisk16.patch 2008-03-08 22:37:19 +0100 @@ -0,0 +1,137 @@ +Index: Makefile +--- Makefile.orig 2008-01-29 18:22:47 +0100 ++++ Makefile 2008-03-08 19:36:45 +0100 +@@ -245,12 +245,6 @@ + ASTCFLAGS+=-fsigned-char + endif + +-ifeq ($(OSARCH),FreeBSD) +- # -V is understood by BSD Make, not by GNU make. +- BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk) +- ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi) +-endif +- + ifeq ($(OSARCH),NetBSD) + ASTCFLAGS+=-pthread -I/usr/pkg/include + endif +Index: appconference-2.0.1/Makefile +--- appconference-2.0.1/Makefile.orig 2008-02-26 17:05:57 +0100 ++++ appconference-2.0.1/Makefile 2008-03-08 21:10:48 +0100 +@@ -18,9 +18,9 @@ + # + + INSTALL_PREFIX := +-INSTALL_MODULES_DIR := $(INSTALL_PREFIX)/usr/lib/asterisk/modules ++INSTALL_MODULES_DIR := $(INSTALL_PREFIX)/lib/asterisk/modules + +-ASTERISK_INCLUDE_DIR ?= ../asterisk/include ++ASTERISK_INCLUDE_DIR ?= ../include + + REVISION = $(shell svnversion -n .) + +@@ -48,7 +48,7 @@ + INCLUDE = -I$(ASTERISK_INCLUDE_DIR) + DEBUG := -g + +-CFLAGS = -pipe -Wall -Wmissing-prototypes -Wmissing-declarations -MD -MP $(DEBUG) ++CFLAGS = -pipe -MD -MP $(DEBUG) + CPPFLAGS = $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE -DREVISION=\"$(REVISION)\" + #CFLAGS += -O2 + #CFLAGS += -O3 -march=pentium3 -msse -mfpmath=sse,387 -ffast-math +Index: appconference-2.0.1/app_conference.h +--- appconference-2.0.1/app_conference.h.orig 2008-02-26 17:05:57 +0100 ++++ appconference-2.0.1/app_conference.h 2008-03-08 19:36:45 +0100 +@@ -44,6 +44,7 @@ + #include <pthread.h> + + /* asterisk includes */ ++#include <asterisk.h> + #include <asterisk/utils.h> + #include <asterisk/pbx.h> + #include <asterisk/module.h> +Index: asterisk-perl-0.10/Makefile.PL +--- asterisk-perl-0.10/Makefile.PL.orig 2008-03-08 19:41:19 +0100 ++++ asterisk-perl-0.10/Makefile.PL 2008-03-08 19:41:19 +0100 +@@ -14,3 +14,4 @@ + }, + ); + ++ +Index: configure +--- configure.orig 2008-02-19 18:33:55 +0100 ++++ configure 2008-03-08 19:36:45 +0100 +@@ -4043,12 +4043,6 @@ + # note- does not work on FreeBSD + + case "${host_os}" in +- freebsd*) +- ac_default_prefix=/usr/local +- CPPFLAGS=-I/usr/local/include +- LDFLAGS=-L/usr/local/lib +- ;; +- + *) + ac_default_prefix=/usr + if test ${sysconfdir} = '${prefix}/etc'; then +Index: iax-0.2.2/src/Makefile.in +--- iax-0.2.2/src/Makefile.in.orig 2001-11-13 18:45:14 +0100 ++++ iax-0.2.2/src/Makefile.in 2008-03-08 19:36:45 +0100 +@@ -71,7 +71,7 @@ + PACKAGE = @PACKAGE@ + RANLIB = @RANLIB@ + VERSION = @VERSION@ +-CFLAGS = -g -Wall -Wstrict-prototypes -I . -DDEBUG_SUPPORT -DDEBUG_DEFAULT $(UCFLAGS) ++CFLAGS = -I . -DDEBUG_SUPPORT -DDEBUG_DEFAULT $(UCFLAGS) + + pkgdir = $(libdir) + pkg_LTLIBRARIES = libiax.la +@@ -304,12 +304,11 @@ + + + install: +- mkdir -p $(includedir)/iax +- install -m 644 md5.h $(includedir)/iax +- install -m 644 frame.h $(includedir)/iax +- install -m 644 iax.h $(includedir)/iax +- install -m 644 iax-client.h $(includedir)/iax +- /sbin/ldconfig ++ mkdir -p $(DESTDIR)$(includedir)/iax ++ install -m 644 md5.h $(DESTDIR)$(includedir)/iax ++ install -m 644 frame.h $(DESTDIR)$(includedir)/iax ++ install -m 644 iax.h $(DESTDIR)$(includedir)/iax ++ install -m 644 iax-client.h $(DESTDIR)$(includedir)/iax + + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. +Index: iax-0.2.2/src/iax.c +--- iax-0.2.2/src/iax.c.orig 2001-11-07 00:10:41 +0100 ++++ iax-0.2.2/src/iax.c 2008-03-08 19:36:45 +0100 +@@ -33,13 +33,11 @@ + #include <sys/time.h> + #include <stdlib.h> + #include <string.h> +-#include <malloc.h> + #include <stdarg.h> + #include <stdio.h> + #include <unistd.h> + #include <fcntl.h> + #include <errno.h> +-#include <error.h> + #include <sys/select.h> + #include <netinet/in.h> + #include <arpa/inet.h> +Index: main/Makefile +--- main/Makefile.orig 2008-01-29 18:44:05 +0100 ++++ main/Makefile 2008-03-08 19:36:45 +0100 +@@ -82,10 +82,7 @@ + endif + + ifeq ($(OSARCH),FreeBSD) +- # -V is understood by BSD Make, not by GNU make. +- BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk) +- AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi) +- AST_LIBS+=-lcrypto ++ AST_LIBS+=-lpthread -lcrypto + endif + + ifneq ($(findstring $(OSARCH), mingw32 cygwin ),) @@ . patch -p0 <<'@@ .' Index: openpkg-src/asterisk16/asterisk16.spec ============================================================================ $ cvs diff -u -r0 -r1.1 asterisk16.spec --- /dev/null 2008-03-08 22:36:07 +0100 +++ asterisk16.spec 2008-03-08 22:37:19 +0100 @@ -0,0 +1,369 @@ +## +## asterisk16.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + +# package version +%define V_opkg 1.6.0b4 +%define V_asterisk 1.6.0-beta4 +%define V_asterisk_addons 1.6.0-beta2 +%define V_asterisk_sounds 1.2.1 +%define V_asterisk_libiax 0.2.2 +%define V_app_conference 2.0.1 +%define V_asterisk_perl 0.10 +%define V_chan_capi 1_6_1 + +# package information +Name: asterisk16 +Summary: Private Branch Exchange (PBX) for VoIP +URL: http://www.asterisk.org/ +Vendor: Mark Spencer et al. +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: EVAL +Group: VoIP +License: GPL +Version: %{V_opkg} +Release: 20080308 + +# package options +%option with_zaptel no +%option with_capi no +%option with_mp3 no + +# list of sources +Source0: http://downloads.digium.com/pub/asterisk/releases/asterisk-%{V_asterisk}.tar.gz +Source1: http://downloads.digium.com/pub/asterisk/releases/asterisk-addons-%{V_asterisk_addons}.tar.gz +Source2: http://downloads.digium.com/pub/asterisk/releases/asterisk-sounds-%{V_asterisk_sounds}.tar.gz +Source3: http://downloads.digium.com/pub/libiax/iax-%{V_asterisk_libiax}.tar.gz +Source4: http://switch.dl.sourceforge.net/appconference/appconference-%{V_app_conference}.tar.gz +Source5: http://asterisk.gnuinter.net/files/asterisk-perl-%{V_asterisk_perl}.tar.gz +Source6: http://www.turbocat.net/~hselasky/capi4pbx/releases/chan_capi_%{V_chan_capi}.tar.bz2 +Source7: asterisk.txt +Source8: rc.asterisk +Patch0: asterisk16.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20040130, bison, gcc, make, grep +PreReq: OpenPKG, openpkg >= 20040130 +BuildPreReq: zlib, curl, openssl, ncurses, speex, vorbis-libs, imap, popt, sqlite +PreReq: zlib, curl, openssl, ncurses, speex, vorbis-libs, imap, popt, sqlite +BuildPreReq: perl, perl-openpkg +PreReq: perl +%if "%{with_mp3}" == "yes" +PreReq: mpg123 +%endif +AutoReq: no +AutoReqProv: no +Provides: asterisk = %{version}-%{release} + +%description + Asterisk is a complete Private Branch Exchange (PBX) in software. + It provides all of the features you would expect from a PBX and + more. Asterisk does Voice over IP (VoIP) in many protocols. Asterisk + provides Voicemail services with Directory, Call Conferencing, + Interactive Voice Response and Call Queuing. It has support for + three-way calling, caller ID services, ADSI, SIP, etc. Asterisk + needs no additional hardware for VoIP. + + NOTICE: This OpenPKG packaging of Asterisk is special according to + the following aspects: 1. for full portability this package does + NOT include Asterisk support for any telephony hardware, 2. this + package uses a stripped down default configuration which provides + an out-of-the-box VoIP configuration for a small organisation, + 3. this package includes the add-on Asterisk application module + "app_conference" for hardware-timer independent conferencing, and 4. + this package includes the Perl Asterisk::AGI module. + +%track + prog asterisk16 = { + version = %{V_asterisk} + url = http://downloads.digium.com/pub/asterisk/releases/ + regex = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz + } + prog asterisk16:addons = { + version = %{V_asterisk_addons} + url = http://downloads.digium.com/pub/asterisk/releases/ + regex = asterisk-addons-(\d+\.\d+(\.\d+)+)\.tar\.gz + } + prog asterisk16:sounds = { + version = %{V_asterisk_sounds} + url = http://downloads.digium.com/pub/asterisk/releases/ + regex = asterisk-sounds-(\d+\.\d+(\.\d+)+)\.tar\.gz + } + prog asterisk16:libiax = { + version = %{V_asterisk_libiax} + url = http://downloads.digium.com/pub/libiax/ + regex = iax-(\d+\.\d+(\.\d+)+)\.tar\.gz + } + prog asterisk16:agi = { + version = %{V_asterisk_perl} + url = http://asterisk.gnuinter.net/files/ + regex = asterisk-perl-(__VER__)\.tar\.gz + } + prog asterisk16:chan_capi = { + version = %{V_chan_capi} + url = http://www.turbocat.net/~hselasky/capi4pbx/releases/ + regex = chan_capi_(__VER__)\.tar\.bz2 + } + +%prep + %setup -q -n asterisk-%{V_asterisk} + %setup -q -n asterisk-%{V_asterisk} -D -T -a 1 + %setup -q -n asterisk-%{V_asterisk} -D -T -a 2 + %setup -q -n asterisk-%{V_asterisk} -D -T -a 3 + %setup -q -n asterisk-%{V_asterisk} -D -T -a 4 + %setup -q -n asterisk-%{V_asterisk} -D -T -a 5 + %setup -q -n asterisk-%{V_asterisk} -D -T -a 6 + %patch -p0 + +%build + # sanity check +%if "%{with_zaptel}" == "yes" + zaptel_prefix="" + case "%{l_platform -t}" in + *-linux* ) + if [ ! -f /usr/include/linux/zaptel.h ]; then + echo "option \"with_zaptel\" requires Zaptel Linux drivers installed" 1>&2; exit 1 + fi + zaptel_prefix=/usr + ;; + *-freebsd* ) + if [ ! -f /usr/local/include/zaptel.h ]; then + echo "option \"with_zaptel\" requires Zaptel FreeBSD drivers installed" 1>&2; exit 1 + fi + zaptel_prefix=/usr/local + ;; + * ) echo "option \"with_zaptel\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;; + esac +%endif +%if "%{with_capi}" == "yes" + case "%{l_platform -t}" in + *-freebsd* | *-netbsd* ) + if [ ! -f /usr/include/i4b/include/capi20.h ]; then + echo "option \"with_chan_capi\" requires I4B 1.6 or newer installed" 1>&2; exit 1 + fi + ;; + * ) echo "option \"with_capi\" supported under FreeBSD and NetBSD only" 1>&2; exit 1 ;; + esac +%endif + + # re-configure music-on-hold to find mpg123 +%if "%{with_mp3}" == "yes" + mpg123="%{l_prefix}/bin/mpg123" +%else + mpg123="`which false`" +%endif + %{l_shtool} subst \ + -e "s;/usr/local/bin/mpg123;$mpg123;" \ + -e "s;/usr/bin/mpg123;$mpg123;" \ + res/res_musiconhold.c apps/app_mp3.c + + # build program + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + CPPFLAGS="%{l_cppflags ncurses .}" \ + LDFLAGS="%{l_ldflags}" \ + LIBS="-logg" \ + ./configure \ + --prefix=%{l_prefix} \ + --mandir=%{l_prefix}/man \ + --sysconfdir=%{l_prefix}/etc/asterisk \ + --localstatedir=%{l_prefix}/var/asterisk \ + --with-curl=%{l_prefix} \ + --with-ncurses \ + --with-gsm="internal" \ + --with-popt=%{l_prefix} \ + --with-sqlite3=%{l_prefix} \ + --with-speex=%{l_prefix} \ + --with-ssl=%{l_prefix} \ + --with-z=%{l_prefix} \ + --with-ogg=%{l_prefix} \ + --with-vorbis=%{l_prefix} \ +%if "%{with_zaptel}" == "yes + --with-zaptel=$zaptel_prefix \ +%else + --without-zaptel \ +%endif + --without-imap \ + --without-netsnmp \ + --without-isdnnet \ + --without-misdn \ + --without-kde \ + --without-nbs \ + --without-newt \ + --without-asound \ + --without-oss \ + --without-qt \ + --without-odbc \ + --without-sqlite \ + --without-postgres \ + --without-tds \ + --without-osptk \ + --without-pri \ + --without-radius \ + --without-suppserv \ + --without-tonezone \ + --without-vpb \ + --without-sdl \ + --without-x11 \ + --without-gtk \ + --without-gtk2 + %{l_make} %{l_mflags} \ + CC="%{l_cc} %{l_cflags -O} -I. -I./include -I../include -I../../include %{l_cppflags ncurses .}" + + # build addon modules + ( cd appconference-* + %{l_make} %{l_mflags} \ + INSTALL_PREFIX=%{l_prefix} + ) || exit $? +%if "%{with_capi}" == "yes" + ( cd chan_capi_* + %{l_make} %{l_mflags} \ + INSTALL_PREFIX=%{l_prefix} + ) || exit $? +%endif + + # build libiax + ( cd iax-%{V_asterisk_libiax} + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + ./configure \ + --prefix=%{l_prefix} \ + --disable-shared + %{l_make} %{l_mflags -O} + ) || exit $? + + # build Perl API + %{l_prefix}/bin/perl-openpkg prepare + %{l_prefix}/bin/perl-openpkg -d asterisk-perl-%{V_asterisk_perl} configure build + +%install + # install program + rm -rf $RPM_BUILD_ROOT + %{l_make} %{l_mflags} install \ + DESTDIR=$RPM_BUILD_ROOT \ + INSTALL_PREFIX=%{l_prefix} + + # install additional sounds + ( cd asterisk-sounds-%{V_asterisk_sounds} + %{l_make} %{l_mflags} install \ + DESTDIR=$RPM_BUILD_ROOT \ + ASTVARLIBDIR=%{l_prefix}/share/asterisk \ + INSTALL="%{l_shtool} install -c" + ) || exit $? +%if "%{with_mp3}" == "yes" + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + sounds/*.mp3 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/mohmp3/ +%endif + + # install addon modules + ( cd appconference-* + %{l_make} %{l_mflags} install \ + INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \ + INSTALL="%{l_shtool} install -c" + ) || exit $? +%if "%{with_capi}" == "yes" + ( cd chan_capi_* + %{l_make} %{l_mflags} install \ + INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \ + INSTALL="%{l_shtool} install -c" + ) || exit $? +%endif + + # install libiax + ( cd iax-%{V_asterisk_libiax} + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT + ) || exit $? + + # install Perl API + %{l_prefix}/bin/perl-openpkg -d asterisk-perl-%{V_asterisk_perl} install + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;' \ + asterisk-perl-%{V_asterisk_perl}/examples/* \ + $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/ + %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup + + # strip down installation + rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true + rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true + rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/firmware >/dev/null 2>&1 || true + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true + + # post-adjust installation + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true + for bin in $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/*.*; do + mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'` + done + + # install default configuration + for name in `grep "^<file" %{SOURCE asterisk.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do +%if "%{with_zaptel}" == "no" + [ ".$name" = ".zapata.conf" ] && continue +%endif +%if "%{with_capi}" == "no" + [ ".$name" = ".capi.conf" ] && continue +%endif + (echo ""; cat %{SOURCE asterisk.txt}; echo "") |\ + sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/ + done + + # install run-command script + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} `cat perl-openpkg-files` \ + '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%post + # after upgrade, restart service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} asterisk status 2>/dev/null` + [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart + exit 0 + +%preun + # before erase, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} asterisk stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/astdb >/dev/null 2>&1 || true + exit 0 + @@ . patch -p0 <<'@@ .' Index: openpkg-src/asterisk16/rc.asterisk ============================================================================ $ cvs diff -u -r0 -r1.1 rc.asterisk --- /dev/null 2008-03-08 22:36:07 +0100 +++ rc.asterisk 2008-03-08 22:37:19 +0100 @@ -0,0 +1,56 @@ [EMAIL PROTECTED]@/bin/openpkg rc +## +## rc.asterisk -- Run-Commands +## + +%config + asterisk_enable="$openpkg_rc_def" + asterisk_flags="" + asterisk_log_prolog="true" + asterisk_log_epilog="true" + asterisk_log_numfiles="10" + asterisk_log_minsize="1M" + asterisk_log_complevel="9" + +%status -u @l_susr@ -o + asterisk_usable="unknown" + asterisk_active="no" + rcService asterisk enable yes && \ + @l_prefix@/sbin/asterisk -rx "show version" >/dev/null 2>&1 && \ + asterisk_active="yes" + echo "asterisk_enable=\"$asterisk_enable\"" + echo "asterisk_usable=\"$asterisk_usable\"" + echo "asterisk_active=\"$asterisk_active\"" + +%start -u @l_susr@ + rcService asterisk enable yes || exit 0 + rcService asterisk active yes && exit 0 + @l_prefix@/sbin/asterisk ${asterisk_flags} + +%stop -u @l_susr@ + rcService asterisk enable yes || exit 0 + rcService asterisk active no && exit 0 + ( @l_prefix@/sbin/asterisk -rx "stop gracefully" & + sleep 2 + @l_prefix@/sbin/asterisk -rx "stop now" & + ) >/dev/null 2>&1 || true + +%restart -u @l_susr@ + rcService asterisk enable yes || exit 0 + rcService asterisk active no && exit 0 + rc asterisk stop start + +%reload -u @l_susr@ + rcService asterisk enable yes || exit 0 + rcService asterisk active no && exit 0 + @l_prefix@/sbin/asterisk -rx "reload" + +%daily -u @l_susr@ + rcService asterisk enable yes || exit 0 + shtool rotate -f \ + -n ${asterisk_log_numfiles} -s ${asterisk_log_minsize} -d \ + -z ${asterisk_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \ + -P "${asterisk_log_prolog}" \ + -E "${asterisk_log_epilog}; rc asterisk reload" \ + @l_prefix@/var/asterisk/log/asterisk.log + @@ . ______________________________________________________________________ OpenPKG http://openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org