diff options
Diffstat (limited to 'net/asterisk12')
33 files changed, 1399 insertions, 431 deletions
diff --git a/net/asterisk12/Makefile b/net/asterisk12/Makefile index 1ab6962de6c8..66d605c16c3c 100644 --- a/net/asterisk12/Makefile +++ b/net/asterisk12/Makefile @@ -6,8 +6,7 @@  #  PORTNAME=	asterisk -PORTVERSION=	0.5.0 -PORTREVISION=	3 +PORTVERSION=	0.7.1  CATEGORIES=	net  MASTER_SITES=	ftp://ftp.asterisk.org/pub/telephony/asterisk/ \  		ftp://ftp.asterisk.org/pub/telephony/asterisk/old-releases/ @@ -30,8 +29,8 @@ USE_OPENLDAP=	yes  MAKE_ENV=	PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \  		PTHREAD_LIBS="${PTHREAD_LIBS}" \  		MKDIR="${MKDIR}" \ -		PWLIBDIR=${WRKDIR}/../../../devel/pwlib/work/pwlib \ -		OPENH323DIR=${WRKDIR}/../../../net/openh323/work/openh323 \ +		PWLIBDIR=${WRKDIRPREFIX}${PORTSDIR}/devel/pwlib/work/pwlib \ +		OPENH323DIR=${WRKDIRPREFIX}${PORTSDIR}/net/openh323/work/openh323 \  		OSVERSION=${OSVERSION} \  		CXX="${CXX}" diff --git a/net/asterisk12/distinfo b/net/asterisk12/distinfo index aae6b84dba9d..38db09d4734e 100644 --- a/net/asterisk12/distinfo +++ b/net/asterisk12/distinfo @@ -1 +1 @@ -MD5 (asterisk-0.5.0.tar.gz) = 6daf4091a62933d74fb8650f00b22374 +MD5 (asterisk-0.7.1.tar.gz) = 593e7154a2def54e70d8855434fd9e5c diff --git a/net/asterisk12/files/patch-Makefile b/net/asterisk12/files/patch-Makefile index 9d225b6e1723..1e4ffbe62070 100644 --- a/net/asterisk12/files/patch-Makefile +++ b/net/asterisk12/files/patch-Makefile @@ -1,9 +1,9 @@  $FreeBSD$ ---- Makefile.orig	Tue Sep  2 03:33:42 2003 -+++ Makefile	Sun Oct 19 10:02:05 2003 -@@ -39,10 +39,10 @@ +--- Makefile.orig	Wed Jan 14 08:48:38 2004 ++++ Makefile	Fri Jan 30 02:25:09 2004 +@@ -43,10 +43,10 @@   #K6OPT  = -DK6OPT   #Tell gcc to optimize the asterisk's code @@ -16,16 +16,16 @@ $FreeBSD$   # New hangup routines for chan_zap.c   # If this flag is uncommented then you need to have new libpri code in your system -@@ -64,7 +64,7 @@ +@@ -68,7 +68,7 @@   # Where to install asterisk after compiling   # Default -> leave empty  -INSTALL_PREFIX= -+INSTALL_PREFIX=${PREFIX} ++INSTALL_PREFIX=$(PREFIX) - # Original busydetect routine - BUSYDETECT = #-DBUSYDETECT -@@ -78,28 +78,28 @@ + # Staging directory + # Files are copied here temporarily during the install process +@@ -88,28 +88,26 @@   # Don't use together with -DBUSYDETECT_TONEONLY   BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE @@ -48,7 +48,6 @@ $FreeBSD$  +ASTSBINDIR=$(INSTALL_PREFIX)/sbin  +ASTVARRUNDIR=/var/run -    MODULES_DIR=$(ASTLIBDIR)/modules   AGI_DIR=$(ASTVARLIBDIR)/agi-bin @@ -56,44 +55,45 @@ $FreeBSD$  -CFLAGS=-pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY  +CFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY   CFLAGS+=$(OPTIMIZE) - CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi) +-CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)   CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi) --ifeq (${OSARCH},OpenBSD) + ifeq (${OSARCH},FreeBSD)  -CFLAGS+=-pthread -+ifeq (${OSARCH},FreeBSD) -+CFLAGS+=${PTHREAD_CFLAGS} +-INCLUDE+=-I/usr/local/include ++CFLAGS+=$(PTHREAD_CFLAGS)   endif -  - CFLAGS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi) -@@ -131,14 +131,14 @@ - ifeq (${OSARCH},Linux) - LIBS=-ldl + ifeq (${OSARCH},OpenBSD) + CFLAGS+=-pthread +@@ -151,7 +149,7 @@ + LIBS=-pthread + else + ifeq (${OSARCH},FreeBSD) +-LIBS=-pthread ++LIBS=$(PTHREAD_LIBS) + else + endif + endif +@@ -179,7 +177,7 @@ + SOLINK=-shared -Xlinker -x   endif --LIBS+=-lpthread -lncurses -lm -lresolv  #-lnjamd -+LIBS+=${PTHREAD_LIBS} -lncurses -lm #-lnjamd - OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \ - 	translate.o file.o say.o pbx.o cli.o md5.o term.o \ - 	ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \ - 	cdr.o tdd.o acl.o rtp.o manager.o asterisk.o ast_expr.o \ - 	dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \ - 	astmm.o enum.o srv.o +   -CC=gcc  +CC?=gcc   INSTALL=install   _all: all -@@ -163,13 +163,13 @@ - editline/libedit.a: editline/config.h +@@ -200,13 +198,13 @@ + 	cd editline && unset CFLAGS LIBS && test -f config.h || ./configure   	$(MAKE) -C editline libedit.a --db1-ast/libdb1.a:  +-db1-ast/libdb1.a: FORCE  -	@if [ -d db1-ast ]; then \  -		$(MAKE) -C db1-ast libdb1.a ; \  -	else \  -		echo "You need to do a cvs update -d not just cvs update"; \  -		exit 1; \  -	fi -+#db1-ast/libdb1.a:  ++#db1-ast/libdb1.a: FORCE  +#	@if [ -d db1-ast ]; then \  +#		$(MAKE) -C db1-ast libdb1.a ; \  +#	else \ @@ -103,98 +103,107 @@ $FreeBSD$   ifneq ($(wildcard .depend),)   include .depend -@@ -199,8 +199,8 @@ - 	./make_build_h - endif +@@ -244,8 +242,8 @@ + 		exit 1; \ + 	fi --asterisk: editline/libedit.a db1-ast/libdb1.a $(OBJS) --	$(CC) $(DEBUG) -o asterisk -rdynamic $(OBJS) $(LIBS) $(LIBEDIT) db1-ast/libdb1.a -+asterisk: editline/libedit.a $(OBJS) -+	$(CC) $(DEBUG) -o asterisk -rdynamic $(OBJS) $(LIBS) $(LIBEDIT) +-asterisk: editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS) +-	$(CC) $(DEBUG) -o asterisk $(ASTLINK) $(OBJS) $(LIBS) $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a ++asterisk: editline/libedit.a stdtime/libtime.a $(OBJS) ++	$(CC) $(DEBUG) -o asterisk $(ASTLINK) $(OBJS) $(LIBS) $(LIBEDIT) stdtime/libtime.a   subdirs:    	for x in $(SUBDIRS); do $(MAKE) -C $$x || exit 1 ; done -@@ -214,10 +214,10 @@ - 	$(MAKE) -C db1-ast clean +@@ -260,10 +258,10 @@ + 	$(MAKE) -C stdtime clean   datafiles: all --	mkdir -p $(ASTVARLIBDIR)/sounds/digits -+	$(MKDIR) $(ASTVARLIBDIR)/sounds/digits +-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ++	$(MKDIR) $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits   	for x in sounds/digits/*.gsm; do \   		if grep -q "^%`basename $$x`%" sounds.txt; then \ --			install $$x $(ASTVARLIBDIR)/sounds/digits ; \ -+			$(BSD_INSTALL_DATA) $$x $(ASTVARLIBDIR)/sounds/digits ; \ +-			install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \ ++			$(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \   		else \   			echo "No description for $$x"; \   			exit 1; \ -@@ -225,18 +225,18 @@ +@@ -271,18 +269,18 @@   	done   	for x in sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-*; do \   		if grep -q "^%`basename $$x`%" sounds.txt; then \ --			install $$x $(ASTVARLIBDIR)/sounds ; \ -+			$(BSD_INSTALL_DATA) $$x $(ASTVARLIBDIR)/sounds ; \ +-			install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \ ++			$(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \   		else \   			echo "No description for $$x"; \   			exit 1; \   		fi; \   	done --	mkdir -p $(ASTVARLIBDIR)/mohmp3 --	mkdir -p $(ASTVARLIBDIR)/images -+	$(MKDIR) $(ASTVARLIBDIR)/mohmp3 -+	$(MKDIR) $(ASTVARLIBDIR)/images +-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 +-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/images ++	$(MKDIR) $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ++	$(MKDIR) $(DESTDIR)$(ASTVARLIBDIR)/images   	for x in images/*.jpg; do \ --		install $$x $(ASTVARLIBDIR)/images ; \ -+		$(BSD_INSTALL_DATA) $$x $(ASTVARLIBDIR)/images ; \ +-		install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/images ; \ ++		$(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTVARLIBDIR)/images ; \   	done --	mkdir -p $(AGI_DIR) -+	$(MKDIR) $(AGI_DIR) +-	mkdir -p $(DESTDIR)$(AGI_DIR) ++	$(MKDIR) $(DESTDIR)$(AGI_DIR)   update:    	@if [ -d CVS ]; then \ -@@ -248,98 +248,73 @@ +@@ -294,105 +292,74 @@   	fi   bininstall: all --	mkdir -p $(MODULES_DIR) --	mkdir -p $(ASTSBINDIR) --	mkdir -p $(ASTETCDIR) --	mkdir -p $(ASTBINDIR) --	mkdir -p $(ASTSBINDIR) --	mkdir -p $(ASTVARRUNDIR) --	mkdir -p $(ASTSPOOLDIR)/voicemail --	install -m 755 asterisk $(ASTSBINDIR)/ --	install -m 755 astgenkey $(ASTSBINDIR)/ --	install -m 755 safe_asterisk $(ASTSBINDIR)/ -+	$(MKDIR) $(MODULES_DIR) -+	$(MKDIR) $(ASTSBINDIR) -+	$(MKDIR) $(ASTETCDIR) -+	$(MKDIR) $(ASTBINDIR) -+	$(MKDIR) $(ASTSBINDIR) -+	$(MKDIR) $(ASTVARRUNDIR) -+	$(MKDIR) $(ASTSPOOLDIR)/voicemail -+	${BSD_INSTALL_PROGRAM} asterisk $(ASTSBINDIR)/ -+	${BSD_INSTALL_SCRIPT} astgenkey $(ASTSBINDIR)/ -+	${BSD_INSTALL_SCRIPT} safe_asterisk $(ASTSBINDIR)/ +-	mkdir -p $(DESTDIR)$(MODULES_DIR) +-	mkdir -p $(DESTDIR)$(ASTSBINDIR) +-	mkdir -p $(DESTDIR)$(ASTETCDIR) +-	mkdir -p $(DESTDIR)$(ASTBINDIR) +-	mkdir -p $(DESTDIR)$(ASTSBINDIR) +-	mkdir -p $(DESTDIR)$(ASTVARRUNDIR) +-	mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail +-	install -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/ +-	install -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/ ++	$(MKDIR) $(DESTDIR)$(MODULES_DIR) ++	$(MKDIR) $(DESTDIR)$(ASTSBINDIR) ++	$(MKDIR) $(DESTDIR)$(ASTETCDIR) ++	$(MKDIR) $(DESTDIR)$(ASTBINDIR) ++	$(MKDIR) $(DESTDIR)$(ASTSBINDIR) ++	$(MKDIR) $(DESTDIR)$(ASTVARRUNDIR) ++	$(MKDIR) $(DESTDIR)$(ASTSPOOLDIR)/voicemail ++	$(BSD_INSTALL_PROGRAM) asterisk $(DESTDIR)$(ASTSBINDIR)/ ++	$(BSD_INSTALL_SCRIPT) contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/ + 	if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \ +-		install -m 755 contrib/scripts/safe_asterisk $(DESTDIR)$(ASTSBINDIR)/ ;\ ++		$(BSD_INSTALL_SCRIPT) contrib/scripts/safe_asterisk $(DESTDIR)$(ASTSBINDIR)/ ;\ + 	fi   	for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done --	install -d $(ASTHEADERDIR) --	install include/asterisk/*.h $(ASTHEADERDIR) --	rm -f $(ASTVARLIBDIR)/sounds/vm --	rm -f $(ASTVARLIBDIR)/sounds/voicemail --	if [ ! -h $(ASTSPOOLDIR)/vm ] && [ -d $(ASTSPOOLDIR)/vm ]; then \ --		mv $(ASTSPOOLDIR)/vm $(ASTSPOOLDIR)/voicemail/default; \ +-	install -d $(DESTDIR)$(ASTHEADERDIR) +-	install -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR) ++	$(MKDIR) $(DESTDIR)$(ASTHEADERDIR) ++	$(BSD_INSTALL_DATA) include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR) + 	rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm +-	rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail +-	if [ ! -h $(DESTDIR)$(ASTSPOOLDIR)/vm ] && [ -d $(DESTDIR)$(ASTSPOOLDIR)/vm ]; then \ +-		mv $(DESTDIR)$(ASTSPOOLDIR)/vm $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default; \  -	else \ --		mkdir -p $(ASTSPOOLDIR)/voicemail/default; \ --		rm -f $(ASTSPOOLDIR)/vm; \ +-		mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default; \ +-		rm -f $(DESTDIR)$(ASTSPOOLDIR)/vm; \  -	fi --	ln -s $(ASTSPOOLDIR)/voicemail/default $(ASTSPOOLDIR)/vm --	rm -f $(MODULES_DIR)/chan_ixj.so --	rm -f $(MODULES_DIR)/chan_tor.so --	mkdir -p $(ASTVARLIBDIR)/sounds --	mkdir -p $(ASTLOGDIR)/cdr-csv --	mkdir -p $(ASTVARLIBDIR)/keys --	install -m 644 keys/iaxtel.pub $(ASTVARLIBDIR)/keys --	( cd $(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/vm . ) --	( cd $(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/voicemail . ) +-	ln -s $(ASTSPOOLDIR)/voicemail/default $(DESTDIR)$(ASTSPOOLDIR)/vm +-	rm -f $(DESTDIR)$(MODULES_DIR)/chan_ixj.so +-	rm -f $(DESTDIR)$(MODULES_DIR)/chan_tor.so +-	rm -f $(DESTDIR)$(MODULES_DIR)/cdr_mysql.so +-	rm -f $(DESTDIR)$(MODULES_DIR)/cdr_unixodbc.so +-	rm -f $(DESTDIR)$(MODULES_DIR)/codec_mp3_d.so +-	rm -f $(DESTDIR)$(MODULES_DIR)/format_mp3.so +-	rm -f $(DESTDIR)$(MODULES_DIR)/app_voicemail2.so +-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds +-	mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv +-	mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/keys +-	install -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTVARLIBDIR)/keys +-	( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/vm . ) +-	( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/voicemail . )  -	@echo " +---- Asterisk Installation Complete -------+"    -	@echo " +                                           +"  -	@echo " +    YOU MUST READ THE SECURITY DOCUMENT    +" @@ -216,17 +225,13 @@ $FreeBSD$  -	@echo " + **Note** This requires that you have      +"  -	@echo " + doxygen installed on your local system    +"  -	@echo " +-------------------------------------------+" -+	$(MKDIR) $(ASTHEADERDIR) -+	${BSD_INSTALL_DATA} include/asterisk/*.h $(ASTHEADERDIR) -+	$(MKDIR) $(ASTSPOOLDIR)/voicemail/default -+	rm -f $(ASTSPOOLDIR)/vm -+	ln -sf $(ASTSPOOLDIR)/voicemail/default $(ASTSPOOLDIR)/vm -+	$(MKDIR) $(ASTVARLIBDIR)/sounds -+	$(MKDIR) $(ASTLOGDIR)/cdr-csv -+	$(MKDIR) $(ASTVARLIBDIR)/keys -+	${BSD_INSTALL_DATA} keys/iaxtel.pub $(ASTVARLIBDIR)/keys -+	( cd $(ASTVARLIBDIR)/sounds; rm -f vm; ln -sf $(ASTSPOOLDIR)/vm . ) -+	( cd $(ASTVARLIBDIR)/sounds; rm -f voicemail; ln -sf $(ASTSPOOLDIR)/voicemail . ) ++	ln -sf $(ASTSPOOLDIR)/voicemail/default $(DESTDIR)$(ASTSPOOLDIR)/vm ++	$(MKDIR) $(DESTDIR)$(ASTVARLIBDIR)/sounds ++	$(MKDIR) $(DESTDIR)$(ASTLOGDIR)/cdr-csv ++	$(MKDIR) $(DESTDIR)$(ASTVARLIBDIR)/keys ++	$(BSD_INSTALL_DATA) keys/iaxtel.pub $(DESTDIR)$(ASTVARLIBDIR)/keys ++	( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds; ln -sf $(ASTSPOOLDIR)/vm . ) ++	( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds; ln -sf $(ASTSPOOLDIR)/voicemail . )  -install: all datafiles bininstall  +install: all datafiles bininstall samples @@ -234,63 +239,63 @@ $FreeBSD$   upgrade: all bininstall   adsi: all --	mkdir -p $(ASTETCDIR) -+	$(MKDIR) $(ASTETCDIR) +-	mkdir -p $(DESTDIR)$(ASTETCDIR) ++	$(MKDIR) $(DESTDIR)$(ASTETCDIR)   	for x in configs/*.adsi; do \ -+		$(BSD_INSTALL_DATA) $$x $(ASTETCDIR)/`basename $$x`-dist; \ - 		if ! [ -f $(ASTETCDIRX)/$$x ]; then \ --			install -m 644 $$x $(ASTETCDIR)/`basename $$x` ; \ -+			$(BSD_INSTALL_DATA) $$x $(ASTETCDIR)/`basename $$x` ; \ ++		$(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x`-dist; \ + 		if ! [ -f $(DESTDIR)$(ASTETCDIRX)/$$x ]; then \ +-			install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \ ++			$(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x` ; \   		fi ; \   	done   samples: all datafiles adsi --	mkdir -p $(ASTETCDIR) +-	mkdir -p $(DESTDIR)$(ASTETCDIR)  -	for x in configs/*.sample; do \ --		if [ -f $(ASTETCDIR)/`basename $$x .sample` ]; then \ --			mv -f $(ASTETCDIR)/`basename $$x .sample` $(ASTETCDIR)/`basename $$x .sample`.old ; \ -+	$(MKDIR) $(ASTETCDIR) +-		if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \ +-			mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \ ++	$(MKDIR) $(DESTDIR)$(ASTETCDIR)  +	for x in configs/*.sample channels/h323/*.sample; do \ -+		$(BSD_INSTALL_DATA) $$x $(ASTETCDIR)/`basename $$x .sample`-dist ;\ -+		if ! [ -f $(ASTETCDIR)/`basename $$x .sample` ]; then \ -+			$(BSD_INSTALL_DATA) $$x $(ASTETCDIR)/`basename $$x .sample` ;\ ++		$(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`-dist;\ ++		if ! [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \ ++			$(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\   		fi ; \ --		install $$x $(ASTETCDIR)/`basename $$x .sample` ;\ +-		install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\   	done --	echo "[directories]" > $(ASTETCDIR)/asterisk.conf --	echo "astetcdir => $(ASTETCDIR)" >> $(ASTETCDIR)/asterisk.conf --	echo "astmoddir => $(MODULES_DIR)" >> $(ASTETCDIR)/asterisk.conf --	echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(ASTETCDIR)/asterisk.conf --	echo "astagidir => $(AGI_DIR)" >> $(ASTETCDIR)/asterisk.conf --	echo "astspooldir => $(ASTSPOOLDIR)" >> $(ASTETCDIR)/asterisk.conf --	echo "astrundir => $(ASTVARRUNDIR)" >> $(ASTETCDIR)/asterisk.conf --	echo "astlogdir => $(ASTLOGDIR)" >> $(ASTETCDIR)/asterisk.conf -+	echo "[directories]" > $(ASTETCDIR)/asterisk.conf-dist -+	echo "astetcdir => $(ASTETCDIR)" >> $(ASTETCDIR)/asterisk.conf-dist -+	echo "astmoddir => $(MODULES_DIR)" >> $(ASTETCDIR)/asterisk.conf-dist -+	echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(ASTETCDIR)/asterisk.conf-dist -+	echo "astagidir => $(AGI_DIR)" >> $(ASTETCDIR)/asterisk.conf-dist -+	echo "astspooldir => $(ASTSPOOLDIR)" >> $(ASTETCDIR)/asterisk.conf-dist -+	echo "astrundir => $(ASTVARRUNDIR)" >> $(ASTETCDIR)/asterisk.conf-dist -+	echo "astlogdir => $(ASTLOGDIR)" >> $(ASTETCDIR)/asterisk.conf-dist -+	if ! [ -f $(ASTETCDIR)/asterisk.conf ]; then \ -+		$(BSD_INSTALL_DATA) $(ASTETCDIR)/asterisk.conf-dist $(ASTETCDIR)/asterisk.conf; \ +-	echo "[directories]" > $(DESTDIR)$(ASTETCDIR)/asterisk.conf +-	echo "astetcdir => $(ASTETCDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf +-	echo "astmoddir => $(MODULES_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf +-	echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf +-	echo "astagidir => $(AGI_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf +-	echo "astspooldir => $(ASTSPOOLDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf +-	echo "astrundir => $(ASTVARRUNDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf +-	echo "astlogdir => $(ASTLOGDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf ++	echo "[directories]" > $(DESTDIR)$(ASTETCDIR)/asterisk.conf-dist ++	echo "astetcdir => $(ASTETCDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf-dist ++	echo "astmoddir => $(MODULES_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf-dist ++	echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf-dist ++	echo "astagidir => $(AGI_DIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf-dist ++	echo "astspooldir => $(ASTSPOOLDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf-dist ++	echo "astrundir => $(ASTVARRUNDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf-dist ++	echo "astlogdir => $(ASTLOGDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf-dist ++	if ! [ -f $(DESTDIR)$(ASTETCDIR)/asterisk.conf ]; then \ ++		$(BSD_INSTALL_DATA) $(DESTDIR)$(ASTETCDIR)/asterisk.conf-dist $(DESTDIR)$(ASTETCDIR)/asterisk.conf; \  +	fi   	for x in sounds/demo-*; do \   		if grep -q "^%`basename $$x`%" sounds.txt; then \ --			install $$x $(ASTVARLIBDIR)/sounds ; \ -+			$(BSD_INSTALL_DATA) $$x $(ASTVARLIBDIR)/sounds ; \ +-			install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \ ++			$(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \   		else \   			echo "No description for $$x"; \   			exit 1; \   		fi; \   	done   	for x in sounds/*.mp3; do \ --		install $$x $(ASTVARLIBDIR)/mohmp3 ; \ -+		$(BSD_INSTALL_DATA) $$x $(ASTVARLIBDIR)/mohmp3 ; \ +-		install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \ ++		$(BSD_INSTALL_DATA) $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \   	done --	mkdir -p $(ASTSPOOLDIR)/voicemail/default/1234/INBOX -+	$(MKDIR) $(ASTSPOOLDIR)/voicemail/default/1234/INBOX - 	:> $(ASTVARLIBDIR)/sounds/voicemail/default/1234/unavail.gsm +-	mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX ++	$(MKDIR) $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX + 	:> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm   	for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \ - 		cat $(ASTVARLIBDIR)/sounds/$$x.gsm >> $(ASTVARLIBDIR)/sounds/voicemail/default/1234/unavail.gsm ; \ + 		cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \ diff --git a/net/asterisk12/files/patch-agi::Makefile b/net/asterisk12/files/patch-agi::Makefile index 806195bfbb3e..567c30f5624e 100644 --- a/net/asterisk12/files/patch-agi::Makefile +++ b/net/asterisk12/files/patch-agi::Makefile @@ -1,9 +1,9 @@  $FreeBSD$ ---- agi/Makefile.orig	Tue Aug 19 19:42:30 2003 -+++ agi/Makefile	Fri Oct 17 14:13:14 2003 -@@ -11,20 +11,23 @@ +--- agi/Makefile.orig	Sat Oct 25 20:27:53 2003 ++++ agi/Makefile	Fri Jan 30 02:31:07 2004 +@@ -11,21 +11,24 @@   # the GNU General Public License   # @@ -17,9 +17,11 @@ $FreeBSD$   all: depend $(AGIS)   install: all --	for x in $(AGIS); do $(INSTALL) -m 755 $$x $(AGI_DIR) ; done -+	for x in $(AGIS_BIN); do $(BSD_INSTALL_PROGRAM) $$x $(AGI_DIR) ; done -+	for x in $(AGIS_SCR); do $(BSD_INSTALL_SCRIPT) $$x $(AGI_DIR) ; done +-	mkdir -p $(DESTDIR)$(AGI_DIR) +-	for x in $(AGIS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(AGI_DIR) ; done ++	$(MKDIR) $(DESTDIR)$(AGI_DIR) ++	for x in $(AGIS_BIN); do $(BSD_INSTALL_PROGRAM) $$x $(DESTDIR)$(AGI_DIR) ; done ++	for x in $(AGIS_SCR); do $(BSD_INSTALL_SCRIPT) $$x $(DESTDIR)$(AGI_DIR) ; done   eagi-test: eagi-test.o  -	$(CC) -o eagi-test eagi-test.o diff --git a/net/asterisk12/files/patch-apps::Makefile b/net/asterisk12/files/patch-apps::Makefile index 66bf2e7524e7..901ba694c33a 100644 --- a/net/asterisk12/files/patch-apps::Makefile +++ b/net/asterisk12/files/patch-apps::Makefile @@ -1,32 +1,36 @@  $FreeBSD$ ---- apps/Makefile.orig	Thu Sep  4 07:40:37 2003 -+++ apps/Makefile	Fri Oct 17 12:40:46 2003 -@@ -15,15 +15,8 @@ -  - MLFLAGS= - ifeq ($(USE_MYSQL_VM_INTERFACE),1) --CFLAGS+=-DUSEMYSQLVM --CFLAGS+=$(shell if [ -d /usr/local/mysql/include ]; then echo "-I/usr/local/mysql/include"; fi) --CFLAGS+=$(shell if [ -d /usr/include/mysql ]; then echo "-I/usr/include/mysql"; fi) --CFLAGS+=$(shell if [ -d /usr/local/include/mysql ]; then echo "-I/usr/local/include/mysql"; fi) --CFLAGS+=$(shell if [ -d /opt/mysql/include/mysql ]; then echo "-I/opt/mysql/include/mysql"; fi) --MLFLAGS+=$(shell if [ -d /usr/lib/mysql ]; then echo "-L/usr/lib/mysql"; fi) --MLFLAGS+=$(shell if [ -d /usr/local/mysql/lib ]; then echo "-L/usr/local/mysql/lib"; fi) --MLFLAGS+=$(shell if [ -d /usr/local/lib/mysql ]; then echo "-L/usr/local/lib/mysql"; fi) --MLFLAGS+=$(shell if [ -d /opt/mysql/lib/mysql ]; then echo "-L/opt/mysql/lib/mysql"; fi) -+CFLAGS+=-DUSEMYSQLVM -I${LOCALBASE}/include/mysql -+MLFLAGS+=-L${LOCALBASE}/lib/mysql - endif -  - #APPS=app_dial.so app_playback.so app_directory.so app_intercom.so app_mp3.so  -@@ -57,7 +50,7 @@ - 	$(CC) -shared -Xlinker -x -o $@ $< -ltonezone +--- apps/Makefile.orig	Mon Jan 12 03:56:38 2004 ++++ apps/Makefile	Fri Jan 30 01:47:34 2004 +@@ -59,17 +59,17 @@ + 	$(CC) $(SOLINK) -o $@ $< -ltonezone   install: all --	for x in $(APPS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done -+	for x in $(APPS); do $(BSD_INSTALL_PROGRAM) $$x $(MODULES_DIR) ; done +-	for x in $(APPS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done ++	for x in $(APPS); do $(BSD_INSTALL_PROGRAM) $$x $(DESTDIR)$(MODULES_DIR) ; done   app_todd.o: app_todd.c - 	gcc -pipe -O6 -g  -Iinclude -I../include -D_REENTRANT -march=i586 -DDO_CRASH -c -o  app_todd.o app_todd.c +-	gcc -pipe -O6 -g  -Iinclude -I../include -D_REENTRANT -march=i586 -DDO_CRASH -c -o  app_todd.o app_todd.c ++	$(CC) $(CFLAGS) -Iinclude -I../include -D_REENTRANT -DDO_CRASH -c -o  app_todd.o app_todd.c +  + app_todd.so: app_todd.o +-	$(CC) $(SOLINK) -o $@ $< -L/usr/local/ssl/lib -lssl -lcrypto ++	$(CC) $(SOLINK) -o $@ $< -lssl -lcrypto +  + app_voicemail.so : app_voicemail.o + ifeq ($(USE_MYSQL_VM_INTERFACE),1) +-	$(CC) $(SOLINK) -o $@ $(MLFLAGS) $< -L/usr/lib/mysql -lmysqlclient -lz ++	$(CC) $(SOLINK) -o $@ $(MLFLAGS) $< -L$(LOCALBASE)/lib/mysql -lmysqlclient -lz + else + ifeq ($(USE_POSTGRES_VM_INTERFACE),1) + 	$(CC) $(SOLINK) -o $@ $(MLFLAGS) $< -lpq +@@ -88,7 +88,7 @@ + 	$(CC) $(SOLINK) -o $@ $< -lodbc +  + look:	look.c +-	gcc -pipe -O6 -g look.c -o look -lncurses ++	$(CC) $(CFLAGS) look.c -o look -lncurses +  + ifneq ($(wildcard .depend),) + include .depend diff --git a/net/asterisk12/files/patch-apps::app_intercom.c b/net/asterisk12/files/patch-apps::app_intercom.c index 387ddfb36f24..e4ac57f8e31b 100644 --- a/net/asterisk12/files/patch-apps::app_intercom.c +++ b/net/asterisk12/files/patch-apps::app_intercom.c @@ -1,14 +1,14 @@  $FreeBSD$ ---- apps/app_intercom.c.orig	Wed Aug 13 18:25:16 2003 -+++ apps/app_intercom.c	Fri Oct 17 11:27:30 2003 +--- apps/app_intercom.c.orig	Wed Oct 22 06:10:24 2003 ++++ apps/app_intercom.c	Fri Jan 30 01:52:03 2004  @@ -29,7 +29,7 @@   #ifdef __linux__   #include <linux/soundcard.h> - #else --#include <soundcard.h> + #elif defined(__FreeBSD__) +-#include <machine/soundcard.h>  +#include <sys/soundcard.h> + #else + #include <soundcard.h>   #endif - #include <netinet/in.h> -  diff --git a/net/asterisk12/files/patch-astman::Makefile b/net/asterisk12/files/patch-astman::Makefile index 53c8b316c2df..cf31005257cf 100644 --- a/net/asterisk12/files/patch-astman::Makefile +++ b/net/asterisk12/files/patch-astman::Makefile @@ -1,14 +1,14 @@  $FreeBSD$ ---- astman/Makefile	2003/10/17 09:43:08	1.1 -+++ astman/Makefile	2003/10/17 09:43:31 +--- astman/Makefile.orig	Sat Oct 25 20:27:53 2003 ++++ astman/Makefile	Fri Jan 30 01:47:34 2004  @@ -8,7 +8,7 @@   install:   	if [ "$(TARGET)" != "none" ]; then \   		for x in $(TARGET); do \ --			install -m 755 $$x $(ASTSBINDIR)/astman; \ -+			$(BSD_INSTALL_PROGRAM) $$x $(ASTSBINDIR)/astman; \ +-			install -m 755 $$x $(DESTDIR)$(ASTSBINDIR)/astman; \ ++			$(BSD_INSTALL_PROGRAM) $$x $(DESTDIR)$(ASTSBINDIR)/astman; \   		done ; \   	fi diff --git a/net/asterisk12/files/patch-cdr::Makefile b/net/asterisk12/files/patch-cdr::Makefile index 59db17a59b8b..2ede608f9019 100644 --- a/net/asterisk12/files/patch-cdr::Makefile +++ b/net/asterisk12/files/patch-cdr::Makefile @@ -1,31 +1,14 @@  $FreeBSD$ ---- cdr/Makefile.orig	Tue Aug 19 19:42:30 2003 -+++ cdr/Makefile	Fri Oct 17 12:42:54 2003 -@@ -18,21 +18,14 @@ - # - # MySQL stuff...  Autoconf anyone?? - # --MODS+=$(shell if [ -d /usr/local/mysql/include ] || [ -d /usr/include/mysql ] || [ -d /usr/local/include/mysql ] || [ -d /opt/mysql/include ]; then echo "cdr_mysql.so"; fi) --CFLAGS+=$(shell if [ -d /usr/local/mysql/include ]; then echo "-I/usr/local/mysql/include"; fi) --CFLAGS+=$(shell if [ -d /usr/include/mysql ]; then echo "-I/usr/include/mysql"; fi) --CFLAGS+=$(shell if [ -d /usr/local/include/mysql ]; then echo "-I/usr/local/include/mysql"; fi) --CFLAGS+=$(shell if [ -d /opt/mysql/include/mysql ]; then echo "-I/opt/mysql/include/mysql"; fi) --MLFLAGS= --MLFLAGS+=$(shell if [ -d /usr/lib/mysql ]; then echo "-L/usr/lib/mysql"; fi) --MLFLAGS+=$(shell if [ -d /usr/local/mysql/lib ]; then echo "-L/usr/local/mysql/lib"; fi) --MLFLAGS+=$(shell if [ -d /usr/local/lib/mysql ]; then echo "-L/usr/local/lib/mysql"; fi) --MLFLAGS+=$(shell if [ -d /opt/mysql/lib/mysql ]; then echo "-L/opt/mysql/lib/mysql"; fi) -+MODS+=cdr_mysql.so -+CFLAGS+=-I${LOCALBASE}/include/mysql -+MLFLAGS+=-L${LOCALBASE}/lib/mysql -  +--- cdr/Makefile.orig	Sun Jan 11 21:17:02 2004 ++++ cdr/Makefile	Fri Jan 30 01:47:34 2004 +@@ -43,7 +43,7 @@   all: depend $(MODS)   install: all --	for x in $(MODS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done -+	for x in $(MODS); do $(BSD_INSTALL_PROGRAM) $$x $(MODULES_DIR) ; done +-	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done ++	for x in $(MODS); do $(BSD_INSTALL_PROGRAM) $$x $(DESTDIR)$(MODULES_DIR) ; done   clean:   	rm -f *.so *.o .depend diff --git a/net/asterisk12/files/patch-channels::Makefile b/net/asterisk12/files/patch-channels::Makefile index 9754d5555252..57e7635206a8 100644 --- a/net/asterisk12/files/patch-channels::Makefile +++ b/net/asterisk12/files/patch-channels::Makefile @@ -1,34 +1,42 @@  $FreeBSD$ ---- channels/Makefile.orig	Tue Aug 19 19:42:30 2003 -+++ channels/Makefile	Sun Oct 19 11:08:13 2003 -@@ -25,7 +25,7 @@ +--- channels/Makefile.orig	Wed Dec 10 04:19:22 2003 ++++ channels/Makefile	Fri Jan 30 01:47:34 2004 +@@ -26,12 +26,10 @@ + #   #CHANNEL_LIBS+=chan_vofr +-ifneq (${OSARCH},Darwin) + CHANNEL_LIBS+=chan_oss.so +-endif +    CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)  -CHANNEL_LIBS+=$(shell [ -f h323/libchanh323.a ] && echo chan_h323.so)  +CHANNEL_LIBS+=chan_h323.so   CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations   CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API") -@@ -95,7 +95,7 @@ - ifeq (${OSARCH},Linux) - 	$(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o - else --	$(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o -lossaudio -+	$(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o - endif -  - chan_zap.o: $(CHANZAP) -@@ -119,15 +119,17 @@ +@@ -99,10 +97,8 @@ +  + chan_oss.o: chan_oss.c  busy.h ringtone.h +  +-ifeq (${OSARCH},OpenBSD) + chan_oss.so: chan_oss.o +-	$(CC) $(SOLINK) -o $@ chan_oss.o -lossaudio +-endif ++	$(CC) $(SOLINK) -o $@ chan_oss.o +  + chan_iax2.so: chan_iax2.o iax2-parser.o + ifeq ($(USE_MYSQL_FRIENDS),1) +@@ -139,15 +135,17 @@   chan_vpb.so: chan_vpb.o - 	 $(CXX) -shared -Xlinker -x -o $@ $< -lvpb -lpthread -lm -ldl + 	 $(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl  -chan_h323.so: chan_h323.o h323/libchanh323.a --	$(CC) -shared -Xlinker -x -o $@ $< h323/libchanh323.a -L$(PWLIBDIR)/lib  -lpt_linux_x86_r -L$(OPENH323DIR)/lib -lh323_linux_x86_r -L/usr/lib -lpthread -ldl -lcrypto -lssl -lexpat +-	$(CC) $(SOLINK) -o $@ $< h323/libchanh323.a -L$(PWLIBDIR)/lib  -lpt_linux_x86_r -L$(OPENH323DIR)/lib -lh323_linux_x86_r -L/usr/lib -lpthread -ldl -lcrypto -lssl -lexpat  +chan_h323.so: chan_h323.o h323/ast_h323.o -+	$(CXX) -shared -Xlinker -x -o $@ $< h323/ast_h323.o -L$(OPENH323DIR)/lib -lh323_FreeBSD_x86_r_s -L$(PWLIBDIR)/lib  -lpt_FreeBSD_x86_r_s -lcrypto -lssl -L$(LOCALBASE)/lib -lexpat -llber -lldap -lldap_r ++	$(CC) $(SOLINK) -o $@ $< h323/ast_h323.o -L$(OPENH323DIR)/lib -lh323_FreeBSD_x86_r_s -L$(PWLIBDIR)/lib  -lpt_FreeBSD_x86_r_s -lcrypto -lssl -L$(LOCALBASE)/lib -lexpat -llber -lldap -lldap_r  +h323/ast_h323.o:  +	$(MAKE) -C h323 ast_h323.o @@ -37,8 +45,8 @@ $FreeBSD$   #	$(CC) -rdynamic -shared -Xlinker -x -o $@ $<   install: all --	for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done -+	for x in $(CHANNEL_LIBS); do $(BSD_INSTALL_PROGRAM) $$x $(MODULES_DIR) ; done +-	for x in $(CHANNEL_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done ++	for x in $(CHANNEL_LIBS); do $(BSD_INSTALL_PROGRAM) $$x $(DESTDIR)$(MODULES_DIR) ; done   depend: .depend diff --git a/net/asterisk12/files/patch-channels::chan_h323.c b/net/asterisk12/files/patch-channels::chan_h323.c index 26256ec21152..e413bd8ecec8 100644 --- a/net/asterisk12/files/patch-channels::chan_h323.c +++ b/net/asterisk12/files/patch-channels::chan_h323.c @@ -1,8 +1,8 @@  $FreeBSD$ ---- channels/chan_h323.c	2003/10/19 06:39:00	1.1 -+++ channels/chan_h323.c	2003/10/19 06:52:18 +--- channels/chan_h323.c.orig	Tue Jan 13 11:24:26 2004 ++++ channels/chan_h323.c	Fri Jan 30 01:47:34 2004  @@ -54,6 +54,7 @@   #include <fcntl.h>   #include <netdb.h> diff --git a/net/asterisk12/files/patch-channels::chan_oss.c b/net/asterisk12/files/patch-channels::chan_oss.c index 10bbc21f9ba7..1006b377874e 100644 --- a/net/asterisk12/files/patch-channels::chan_oss.c +++ b/net/asterisk12/files/patch-channels::chan_oss.c @@ -1,14 +1,14 @@  $FreeBSD$ ---- channels/chan_oss.c.orig	Wed Aug 13 18:25:16 2003 -+++ channels/chan_oss.c	Fri Oct 17 11:27:30 2003 +--- channels/chan_oss.c.orig	Wed Oct 22 06:10:34 2003 ++++ channels/chan_oss.c	Fri Jan 30 01:50:35 2004  @@ -36,7 +36,7 @@   #ifdef __linux   #include <linux/soundcard.h> - #else --#include <soundcard.h> + #elif defined(__FreeBSD__) +-#include <machine/soundcard.h>  +#include <sys/soundcard.h> + #else + #include <soundcard.h>   #endif - #include "busy.h" - #include "ringtone.h" diff --git a/net/asterisk12/files/patch-channels::h323::Makefile b/net/asterisk12/files/patch-channels::h323::Makefile index 2d67f5b74b9d..a9159b4441c1 100644 --- a/net/asterisk12/files/patch-channels::h323::Makefile +++ b/net/asterisk12/files/patch-channels::h323::Makefile @@ -1,18 +1,9 @@  $FreeBSD$ ---- channels/h323/Makefile.orig	Wed Aug 27 19:05:14 2003 -+++ channels/h323/Makefile	Sun Oct 19 10:49:58 2003 -@@ -16,6 +16,8 @@ - ASTETCDIR=/etc/asterisk - endif -  -+CXX?=g++ -+ - # Uncomment if u want to attempt to include the G.729 stuff - # This is a quick fix to work around the missing H323Capability - # in Open H.323. As of Open H.323 1.12.0 the H323Capability for -@@ -25,7 +27,7 @@ +--- channels/h323/Makefile.orig	Sun Jan 11 04:22:32 2004 ++++ channels/h323/Makefile	Fri Jan 30 01:47:34 2004 +@@ -19,7 +19,7 @@   #   # This needs to be updated to deal with more than just little endian machines   # @@ -21,7 +12,7 @@ $FreeBSD$   ############################################# -@@ -33,13 +35,13 @@ +@@ -27,38 +27,39 @@   # Only change below if you know WTF your doing   #   CFLAGS += -DNDEBUG -DDO_CRASH -DDEBUG_THREADS @@ -38,8 +29,6 @@ $FreeBSD$   all:   	libchanh323.a -@@ -61,26 +63,27 @@ -     samples:   -	if [ -f $(ASTETCDIR)/h323.conf ]; then \ diff --git a/net/asterisk12/files/patch-codecs::Makefile b/net/asterisk12/files/patch-codecs::Makefile index 5275ffaab105..b802dc1233e8 100644 --- a/net/asterisk12/files/patch-codecs::Makefile +++ b/net/asterisk12/files/patch-codecs::Makefile @@ -1,35 +1,44 @@  $FreeBSD$ ---- codecs/Makefile.orig	Tue May  6 03:00:20 2003 -+++ codecs/Makefile	Sat Oct 18 11:49:23 2003 -@@ -19,9 +19,9 @@ +--- codecs/Makefile.orig	Tue Nov  4 04:40:09 2003 ++++ codecs/Makefile	Fri Jan 30 01:47:34 2004 +@@ -17,23 +17,22 @@ + # g723.1b) + #   #MODG723=codec_g723_1.so codec_g723_1b.so - MODG723=$(shell [ -f g723.1/coder.c ] && echo "codec_g723_1.so") - MODG723+=$(shell [ -f g723.1b/coder2.c ] && echo "codec_g723_1b.so") +-MODG723=$(shell [ -f g723.1/coder.c ] && echo "codec_g723_1.so") +-MODG723+=$(shell [ -f g723.1b/coder2.c ] && echo "codec_g723_1b.so")  -MODSPEEX=$(shell [ -f /usr/include/speex.h ] || [ -f /usr/local/include/speex.h ] && echo "codec_speex.so") ++MODG723=codec_g723_1_dummy.so ++MODG729=codec_g729_dummy.so  +MODSPEEX=codec_speex.so   MODILBC=$(shell [ -f ilbc/iLBC_decode.h ] && echo "codec_ilbc.so")  -CFLAGS+=-fPIC +-CFLAGS+=$(shell [ -f /usr/local/include/speex.h ] && echo "-I/usr/local/include")  +CFLAGS+=-fPIC -I$(LOCALBASE)/include   LIBG723=g723.1/libg723.a   LIBG723B=g723.1b/libg723b.a -@@ -30,7 +30,7 @@ - LIBGSMT=$(shell if uname -m | grep -q 86; then echo gsm/lib/libgsm.a; fi) - LIBMP3=mp3/libmp3.a + LIBGSM=gsm/lib/libgsm.a + LIBGSMT=gsm/lib/libgsm.a   LIBLPC10=lpc10/liblpc10.a --LIBSPEEX=-lspeex -lm -+LIBSPEEX=-L$(LOCALBASE)/lib -lspeex -lm +-LIBSPEEX=$(shell [ -f /usr/local/lib/libspeex.a ] && echo "-L/usr/local/lib") ++LIBSPEEX=-L$(LOCALBASE)/lib + LIBSPEEX+=-lspeex -lm   LIBILBC=ilbc/libilbc.a - CODECS+=$(MODG723) $(MODSPEEX) $(MODILBC) codec_gsm.so codec_mp3_d.so codec_lpc10.so  \ -@@ -95,7 +95,7 @@ +-CODECS+=$(MODG723) $(MODSPEEX) $(MODILBC) codec_gsm.so codec_lpc10.so  \ ++CODECS+=$(MODG723) $(MODG729) $(MODSPEEX) $(MODILBC) codec_gsm.so codec_lpc10.so  \ +         codec_adpcm.so codec_ulaw.so codec_alaw.so codec_a_mu.so +  + all: depend $(CODECS) +@@ -88,7 +87,7 @@   include .depend   install: all --	for x in $(CODECS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done -+	for x in $(CODECS); do $(BSD_INSTALL_PROGRAM) $$x $(MODULES_DIR) ; done +-	for x in $(CODECS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done ++	for x in $(CODECS); do $(BSD_INSTALL_PROGRAM) $$x $(DESTDIR)$(MODULES_DIR) ; done   depend: .depend diff --git a/net/asterisk12/files/patch-codecs::codec_g723_1_dummy.c b/net/asterisk12/files/patch-codecs::codec_g723_1_dummy.c new file mode 100644 index 000000000000..661ff2d88602 --- /dev/null +++ b/net/asterisk12/files/patch-codecs::codec_g723_1_dummy.c @@ -0,0 +1,314 @@ + +$FreeBSD$ + +--- /dev/null	Fri Jan 30 01:52:11 2004 ++++ codecs/codec_g723_1_dummy.c	Fri Jan 30 01:57:59 2004 +@@ -0,0 +1,308 @@ ++/* ++ * Asterisk -- A telephony toolkit for Linux. ++ * ++ * Translate between signed linear and G.723.1 (dummy!) ++ * ++ * The G.723.1 code is not included in the Asterisk distribution because ++ * it is covered with patents, and in spite of statements to the contrary, ++ * the "technology" is extremely expensive to license. ++ *  ++ * Copyright (C) 1999, Mark Spencer ++ * ++ * Mark Spencer <markster@linux-support.net> ++ * ++ * This program is free software, distributed under the terms of ++ * the GNU General Public License ++ */ ++ ++#define TYPE_HIGH	 0x0 ++#define TYPE_LOW	 0x1 ++#define TYPE_SILENCE	 0x2 ++#define TYPE_DONTSEND	 0x3 ++#define TYPE_MASK	 0x3 ++ ++#include <sys/types.h> ++#include <asterisk/translate.h> ++#include <asterisk/module.h> ++#include <asterisk/logger.h> ++#include <asterisk/channel.h> ++#include <pthread.h> ++#include <fcntl.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <netinet/in.h> ++#include <string.h> ++#include <stdio.h> ++ ++/* Sample frame data */ ++#include "slin_g723_ex.h" ++#include "g723_slin_ex.h" ++ ++static ast_mutex_t localuser_lock = AST_MUTEX_INITIALIZER; ++static int localusecnt=0; ++ ++static char *tdesc = "Dummy G.723.1/PCM16 Codec Translator"; ++ ++struct g723_encoder_pvt { ++	struct ast_frame f; ++	/* Space to build offset */ ++	char offset[AST_FRIENDLY_OFFSET]; ++	/* Buffer for our outgoing frame */ ++	char outbuf[8000]; ++	/* Enough to store a full second */ ++	short buf[8000]; ++	int tail; ++}; ++ ++struct g723_decoder_pvt { ++	struct ast_frame f; ++	/* Space to build offset */ ++	char offset[AST_FRIENDLY_OFFSET]; ++	/* Enough to store a full second */ ++	short buf[8000]; ++	int tail; ++}; ++ ++static struct ast_translator_pvt *g723tolin_new() ++{ ++	struct g723_decoder_pvt *tmp; ++	tmp = malloc(sizeof(struct g723_decoder_pvt)); ++	if (tmp) { ++		tmp->tail = 0; ++		localusecnt++; ++		ast_update_use_count(); ++	} ++	return (struct ast_translator_pvt *)tmp; ++} ++ ++static struct ast_frame *lintog723_sample() ++{ ++	static struct ast_frame f; ++	f.frametype = AST_FRAME_VOICE; ++	f.subclass = AST_FORMAT_SLINEAR; ++	f.datalen = sizeof(slin_g723_ex); ++	/* Assume 8000 Hz */ ++	f.samples = sizeof(slin_g723_ex)/16; ++	f.mallocd = 0; ++	f.offset = 0; ++	f.src = __PRETTY_FUNCTION__; ++	f.data = slin_g723_ex; ++	return &f; ++} ++ ++static struct ast_frame *g723tolin_sample() ++{ ++	static struct ast_frame f; ++	f.frametype = AST_FRAME_VOICE; ++	f.subclass = AST_FORMAT_G723_1; ++	f.datalen = sizeof(g723_slin_ex); ++	/* All frames are 30 ms long */ ++	f.samples = 30; ++	f.mallocd = 0; ++	f.offset = 0; ++	f.src = __PRETTY_FUNCTION__; ++	f.data = g723_slin_ex; ++	return &f; ++} ++ ++static struct ast_translator_pvt *lintog723_new() ++{ ++	struct g723_encoder_pvt *tmp; ++	tmp = malloc(sizeof(struct g723_encoder_pvt)); ++	if (tmp) { ++		localusecnt++; ++		ast_update_use_count(); ++		tmp->tail = 0; ++	} ++	return (struct ast_translator_pvt *)tmp; ++} ++ ++static struct ast_frame *g723tolin_frameout(struct ast_translator_pvt *pvt) ++{ ++	struct g723_decoder_pvt *tmp = (struct g723_decoder_pvt *)pvt; ++	if (!tmp->tail) ++		return NULL; ++	/* Signed linear is no particular frame size, so just send whatever ++	   we have in the buffer in one lump sum */ ++	tmp->f.frametype = AST_FRAME_VOICE; ++	tmp->f.subclass = AST_FORMAT_SLINEAR; ++	tmp->f.datalen = tmp->tail * 2; ++	/* Assume 8000 Hz */ ++	tmp->f.samples = tmp->tail / 8; ++	tmp->f.mallocd = 0; ++	tmp->f.offset = AST_FRIENDLY_OFFSET; ++	tmp->f.src = __PRETTY_FUNCTION__; ++	tmp->f.data = tmp->buf; ++	/* Reset tail pointer */ ++	tmp->tail = 0; ++ ++	return &tmp->f;	 ++} ++ ++static int g723_len(unsigned char buf) ++{ ++	switch(buf & TYPE_MASK) { ++	case TYPE_DONTSEND: ++		return 2; ++		break; ++	case TYPE_SILENCE: ++		return 4; ++		break; ++	case TYPE_HIGH: ++		return 24; ++		break; ++	case TYPE_LOW: ++		return 20; ++		break; ++	default: ++		ast_log(LOG_WARNING, "Badly encoded frame (%d)\n", buf & TYPE_MASK); ++	} ++	return -1; ++} ++ ++static int g723tolin_framein(struct ast_translator_pvt *pvt, struct ast_frame *f) ++{ ++	struct g723_decoder_pvt *tmp = (struct g723_decoder_pvt *)pvt; ++	int len = 0; ++	int res; ++	while(len < f->datalen) { ++		/* Assuming there's space left, decode into the current buffer at ++		   the tail location */ ++		res = g723_len(((unsigned char *)f->data + len)[0]); ++		if (res < 0) { ++			ast_log(LOG_WARNING, "Invalid data\n"); ++			return -1; ++		} ++		if (res + len > f->datalen) { ++			ast_log(LOG_WARNING, "Measured length exceeds frame length\n"); ++			return -1; ++		} ++		if (tmp->tail + 480 < sizeof(tmp->buf)/2) {	 ++			memset(tmp->buf + tmp->tail, 0, 480); ++			tmp->tail+=480; ++		} else { ++			ast_log(LOG_WARNING, "Out of buffer space\n"); ++			return -1; ++		} ++		len += res; ++	} ++	return 0; ++} ++ ++static int lintog723_framein(struct ast_translator_pvt *pvt, struct ast_frame *f) ++{ ++	/* Just add the frames to our stream */ ++	/* XXX We should look at how old the rest of our stream is, and if it ++	   is too old, then we should overwrite it entirely, otherwise we can ++	   get artifacts of earlier talk that do not belong */ ++	struct g723_encoder_pvt *tmp = (struct g723_encoder_pvt *)pvt; ++	if (tmp->tail + f->datalen/2 < sizeof(tmp->buf) / 2) { ++		memcpy(&tmp->buf[tmp->tail], f->data, f->datalen); ++		tmp->tail += f->datalen/2; ++	} else { ++		ast_log(LOG_WARNING, "Out of buffer space\n"); ++		return -1; ++	} ++	return 0; ++} ++ ++static struct ast_frame *lintog723_frameout(struct ast_translator_pvt *pvt) ++{ ++	struct g723_encoder_pvt *tmp = (struct g723_encoder_pvt *)pvt; ++	int cnt=0; ++	/* We can't work on anything less than a frame in size */ ++	if (tmp->tail < 480) ++		return NULL; ++	tmp->f.frametype = AST_FRAME_VOICE; ++	tmp->f.subclass = AST_FORMAT_G723_1; ++	tmp->f.offset = AST_FRIENDLY_OFFSET; ++	tmp->f.src = __PRETTY_FUNCTION__; ++	tmp->f.samples = 0; ++	tmp->f.mallocd = 0; ++	while(tmp->tail >= 480) { ++		/* Encode a frame of data */ ++		if (cnt + 24 >= sizeof(tmp->outbuf)) { ++			ast_log(LOG_WARNING, "Out of buffer space\n"); ++			return NULL; ++		} ++		memset(tmp->outbuf + cnt, 0, 24); ++		/* Assume 8000 Hz */ ++		tmp->f.samples += 30; ++		cnt += 24; ++		tmp->tail -= 480; ++		/* Move the data at the end of the buffer to the front */ ++		if (tmp->tail) ++			memmove(tmp->buf, tmp->buf + 480, tmp->tail * 2); ++	} ++	tmp->f.datalen = cnt; ++	tmp->f.data = tmp->outbuf; ++	return &tmp->f;	 ++} ++ ++static void g723_destroy(struct ast_translator_pvt *pvt) ++{ ++	free(pvt); ++	localusecnt--; ++	ast_update_use_count(); ++} ++ ++static struct ast_translator g723tolin = ++	{ "g723tolin_dummy",  ++	   AST_FORMAT_G723_1, AST_FORMAT_SLINEAR, ++	   g723tolin_new, ++	   g723tolin_framein, ++	   g723tolin_frameout, ++	   g723_destroy, ++	   g723tolin_sample ++	   }; ++ ++static struct ast_translator lintog723 = ++	{ "lintog723_dummy",  ++	   AST_FORMAT_SLINEAR, AST_FORMAT_G723_1, ++	   lintog723_new, ++	   lintog723_framein, ++	   lintog723_frameout, ++	   g723_destroy, ++	   lintog723_sample ++	   }; ++ ++int unload_module(void) ++{ ++	int res; ++	ast_mutex_lock(&localuser_lock); ++	res = ast_unregister_translator(&lintog723); ++	if (!res) ++		res = ast_unregister_translator(&g723tolin); ++	if (localusecnt) ++		res = -1; ++	ast_mutex_unlock(&localuser_lock); ++	return res; ++} ++ ++int load_module(void) ++{ ++	int res; ++	res=ast_register_translator(&g723tolin); ++	if (!res)  ++		res=ast_register_translator(&lintog723); ++	else ++		ast_unregister_translator(&g723tolin); ++	return res; ++} ++ ++char *description(void) ++{ ++	return tdesc; ++} ++ ++int usecount(void) ++{ ++	int res; ++	STANDARD_USECOUNT(res); ++	return res; ++} ++ ++char *key() ++{ ++	return ASTERISK_GPL_KEY; ++} diff --git a/net/asterisk12/files/patch-codecs::codec_g729_dummy.c b/net/asterisk12/files/patch-codecs::codec_g729_dummy.c new file mode 100644 index 000000000000..c3e27d98e27e --- /dev/null +++ b/net/asterisk12/files/patch-codecs::codec_g729_dummy.c @@ -0,0 +1,281 @@ + +$FreeBSD$ + +--- /dev/null	Fri Jan 30 01:52:11 2004 ++++ codecs/codec_g729_dummy.c	Fri Jan 30 01:57:59 2004 +@@ -0,0 +1,275 @@ ++/* ++ * Asterisk -- A telephony toolkit for Linux. ++ * ++ * Translate between signed linear and G.729 (dummy!) ++ * ++ * The G.729 code is not included in the Asterisk distribution because ++ * it is covered with patents, and in spite of statements to the contrary, ++ * the "technology" is extremely expensive to license. ++ *  ++ * Copyright (C) 1999, Mark Spencer ++ * ++ * Mark Spencer <markster@linux-support.net> ++ * ++ * This program is free software, distributed under the terms of ++ * the GNU General Public License ++ */ ++ ++#include <sys/types.h> ++#include <asterisk/translate.h> ++#include <asterisk/module.h> ++#include <asterisk/logger.h> ++#include <asterisk/channel.h> ++#include <pthread.h> ++#include <fcntl.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <netinet/in.h> ++#include <string.h> ++#include <stdio.h> ++ ++/* Sample frame data */ ++#include "slin_g729_ex.h" ++#include "g729_slin_ex.h" ++ ++static ast_mutex_t localuser_lock = AST_MUTEX_INITIALIZER; ++static int localusecnt=0; ++ ++static char *tdesc = "Dummy G.729/PCM16 Codec Translator"; ++ ++struct g729_encoder_pvt { ++	struct ast_frame f; ++	/* Space to build offset */ ++	char offset[AST_FRIENDLY_OFFSET]; ++	/* Buffer for our outgoing frame */ ++	char outbuf[8000]; ++	/* Enough to store a full second */ ++	short buf[8000]; ++	int tail; ++}; ++ ++struct g729_decoder_pvt { ++	struct ast_frame f; ++	/* Space to build offset */ ++	char offset[AST_FRIENDLY_OFFSET]; ++	/* Enough to store a full second */ ++	short buf[8000]; ++	int tail; ++}; ++ ++static struct ast_translator_pvt *g729tolin_new() ++{ ++	struct g729_decoder_pvt *tmp; ++	tmp = malloc(sizeof(struct g729_decoder_pvt)); ++	if (tmp) { ++		tmp->tail = 0; ++		localusecnt++; ++		ast_update_use_count(); ++	} ++	return (struct ast_translator_pvt *)tmp; ++} ++ ++static struct ast_frame *lintog729_sample() ++{ ++	static struct ast_frame f; ++	f.frametype = AST_FRAME_VOICE; ++	f.subclass = AST_FORMAT_SLINEAR; ++	f.datalen = sizeof(slin_g729_ex); ++	/* Assume 8000 Hz */ ++	f.samples = sizeof(slin_g729_ex)/16; ++	f.mallocd = 0; ++	f.offset = 0; ++	f.src = __PRETTY_FUNCTION__; ++	f.data = slin_g729_ex; ++	return &f; ++} ++ ++static struct ast_frame *g729tolin_sample() ++{ ++	static struct ast_frame f; ++	f.frametype = AST_FRAME_VOICE; ++	f.subclass = AST_FORMAT_G729A; ++	f.datalen = sizeof(g729_slin_ex); ++	/* All frames are 10 ms long */ ++	f.samples = 10; ++	f.mallocd = 0; ++	f.offset = 0; ++	f.src = __PRETTY_FUNCTION__; ++	f.data = g729_slin_ex; ++	return &f; ++} ++ ++static struct ast_translator_pvt *lintog729_new() ++{ ++	struct g729_encoder_pvt *tmp; ++	tmp = malloc(sizeof(struct g729_encoder_pvt)); ++	if (tmp) { ++		localusecnt++; ++		ast_update_use_count(); ++		tmp->tail = 0; ++	} ++	return (struct ast_translator_pvt *)tmp; ++} ++ ++static struct ast_frame *g729tolin_frameout(struct ast_translator_pvt *pvt) ++{ ++	struct g729_decoder_pvt *tmp = (struct g729_decoder_pvt *)pvt; ++	if (!tmp->tail) ++		return NULL; ++	/* Signed linear is no particular frame size, so just send whatever ++	   we have in the buffer in one lump sum */ ++	tmp->f.frametype = AST_FRAME_VOICE; ++	tmp->f.subclass = AST_FORMAT_SLINEAR; ++	tmp->f.datalen = tmp->tail * 2; ++	/* Assume 8000 Hz */ ++	tmp->f.samples = tmp->tail / 8; ++	tmp->f.mallocd = 0; ++	tmp->f.offset = AST_FRIENDLY_OFFSET; ++	tmp->f.src = __PRETTY_FUNCTION__; ++	tmp->f.data = tmp->buf; ++	/* Reset tail pointer */ ++	tmp->tail = 0; ++ ++	return &tmp->f;	 ++} ++ ++static int g729tolin_framein(struct ast_translator_pvt *pvt, struct ast_frame *f) ++{ ++	struct g729_decoder_pvt *tmp = (struct g729_decoder_pvt *)pvt; ++	int len = 0; ++	while(len < f->datalen) { ++		/* Assuming there's space left, decode into the current buffer at ++		   the tail location */ ++		if (10 + len > f->datalen) { ++			ast_log(LOG_WARNING, "Measured length exceeds frame length\n"); ++			return -1; ++		} ++		if (tmp->tail + 160 < sizeof(tmp->buf)/2) {	 ++			memset(tmp->buf + tmp->tail, 0, 160); ++			tmp->tail+=160; ++		} else { ++			ast_log(LOG_WARNING, "Out of buffer space\n"); ++			return -1; ++		} ++		len += 10; ++	} ++	return 0; ++} ++ ++static int lintog729_framein(struct ast_translator_pvt *pvt, struct ast_frame *f) ++{ ++	/* Just add the frames to our stream */ ++	/* XXX We should look at how old the rest of our stream is, and if it ++	   is too old, then we should overwrite it entirely, otherwise we can ++	   get artifacts of earlier talk that do not belong */ ++	struct g729_encoder_pvt *tmp = (struct g729_encoder_pvt *)pvt; ++	if (tmp->tail + f->datalen/2 < sizeof(tmp->buf) / 2) { ++		memcpy(&tmp->buf[tmp->tail], f->data, f->datalen); ++		tmp->tail += f->datalen/2; ++	} else { ++		ast_log(LOG_WARNING, "Out of buffer space\n"); ++		return -1; ++	} ++	return 0; ++} ++ ++static struct ast_frame *lintog729_frameout(struct ast_translator_pvt *pvt) ++{ ++	struct g729_encoder_pvt *tmp = (struct g729_encoder_pvt *)pvt; ++	int cnt=0; ++	/* We can't work on anything less than a frame in size */ ++	if (tmp->tail < 160) ++		return NULL; ++	tmp->f.frametype = AST_FRAME_VOICE; ++	tmp->f.subclass = AST_FORMAT_G729A; ++	tmp->f.offset = AST_FRIENDLY_OFFSET; ++	tmp->f.src = __PRETTY_FUNCTION__; ++	tmp->f.samples = 0; ++	tmp->f.mallocd = 0; ++	while(tmp->tail >= 160) { ++		/* Encode a frame of data */ ++		if (cnt + 10 >= sizeof(tmp->outbuf)) { ++			ast_log(LOG_WARNING, "Out of buffer space\n"); ++			return NULL; ++		} ++		memset(tmp->outbuf + cnt, 0, 10); ++		/* Assume 8000 Hz */ ++		tmp->f.samples += 10; ++		cnt += 10; ++		tmp->tail -= 160; ++		/* Move the data at the end of the buffer to the front */ ++		if (tmp->tail) ++			memmove(tmp->buf, tmp->buf + 160, tmp->tail * 2); ++	} ++	tmp->f.datalen = cnt; ++	tmp->f.data = tmp->outbuf; ++	return &tmp->f;	 ++} ++ ++static void g729_destroy(struct ast_translator_pvt *pvt) ++{ ++	free(pvt); ++	localusecnt--; ++	ast_update_use_count(); ++} ++ ++static struct ast_translator g729tolin = ++	{ "g729tolin_dummy",  ++	   AST_FORMAT_G729A, AST_FORMAT_SLINEAR, ++	   g729tolin_new, ++	   g729tolin_framein, ++	   g729tolin_frameout, ++	   g729_destroy, ++	   g729tolin_sample ++	   }; ++ ++static struct ast_translator lintog729 = ++	{ "lintog729_dummy",  ++	   AST_FORMAT_SLINEAR, AST_FORMAT_G729A, ++	   lintog729_new, ++	   lintog729_framein, ++	   lintog729_frameout, ++	   g729_destroy, ++	   lintog729_sample ++	   }; ++ ++int unload_module(void) ++{ ++	int res; ++	ast_mutex_lock(&localuser_lock); ++	res = ast_unregister_translator(&lintog729); ++	if (!res) ++		res = ast_unregister_translator(&g729tolin); ++	if (localusecnt) ++		res = -1; ++	ast_mutex_unlock(&localuser_lock); ++	return res; ++} ++ ++int load_module(void) ++{ ++	int res; ++	res=ast_register_translator(&g729tolin); ++	if (!res)  ++		res=ast_register_translator(&lintog729); ++	else ++		ast_unregister_translator(&g729tolin); ++	return res; ++} ++ ++char *description(void) ++{ ++	return tdesc; ++} ++ ++int usecount(void) ++{ ++	int res; ++	STANDARD_USECOUNT(res); ++	return res; ++} ++ ++char *key() ++{ ++	return ASTERISK_GPL_KEY; ++} diff --git a/net/asterisk12/files/patch-codecs::g729_slin_ex.h b/net/asterisk12/files/patch-codecs::g729_slin_ex.h new file mode 100644 index 000000000000..44e60f2de848 --- /dev/null +++ b/net/asterisk12/files/patch-codecs::g729_slin_ex.h @@ -0,0 +1,20 @@ + +$FreeBSD$ + +--- /dev/null	Fri Jan 30 01:52:11 2004 ++++ codecs/g729_slin_ex.h	Fri Jan 30 01:57:59 2004 +@@ -0,0 +1,14 @@ ++/* ++ * g729_slin_ex.h -- ++ * ++ *      8-bit G.729 data, 10 milliseconds worth at 8 kHz. ++ * ++ * Copyright (C) 2004, Maxim Sobolev <sobomax@FreeBSD.org> ++ * ++ * Distributed under the terms of the GNU General Public License ++ * ++ */ ++ ++static unsigned char g729_slin_ex[] = { ++120,82,175,64,0,250,219,0,7,214 ++}; diff --git a/net/asterisk12/files/patch-codecs::gsm::Makefile b/net/asterisk12/files/patch-codecs::gsm::Makefile index 0c9a35eecb6d..d60ed11f3298 100644 --- a/net/asterisk12/files/patch-codecs::gsm::Makefile +++ b/net/asterisk12/files/patch-codecs::gsm::Makefile @@ -1,20 +1,20 @@  $FreeBSD$ ---- codecs/gsm/Makefile.orig	Sun Apr 27 21:13:11 2003 -+++ codecs/gsm/Makefile	Fri Oct 17 11:59:00 2003 -@@ -54,8 +54,8 @@ +--- codecs/gsm/Makefile.orig	Thu Jan  8 18:52:11 2004 ++++ codecs/gsm/Makefile	Fri Jan 30 01:47:34 2004 +@@ -60,8 +60,8 @@   # CC		= /usr/lang/acc   # CCFLAGS 	= -c -O --CC		= gcc -ansi -pedantic $(OPTIMIZE) -march=$(PROC) -fschedule-insns2  -fomit-frame-pointer  --CCFLAGS 	+= -c -DNeedFunctionPrototypes=1 -finline-functions -funroll-loops -fPIC +-CC		= gcc $(OPTIMIZE) -fomit-frame-pointer  +-CCFLAGS 	+= -c -DNeedFunctionPrototypes=1 -funroll-loops -fPIC  +CC		?= gcc -+CCFLAGS 	+= -c -DNeedFunctionPrototypes=1 -finline-functions -funroll-loops -fPIC -ansi -pedantic $(OPTIMIZE) -fschedule-insns2  -fomit-frame-pointer ++CCFLAGS 	+= -c -DNeedFunctionPrototypes=1 -funroll-loops -fPIC $(OPTIMIZE) -fomit-frame-pointer   LD 		= $(CC) -@@ -140,7 +140,7 @@ +@@ -146,7 +146,7 @@   DEBUG	= -DNDEBUG   ######### Remove -DNDEBUG to enable assertions. diff --git a/net/asterisk12/files/patch-codecs::ilbc::Makefile b/net/asterisk12/files/patch-codecs::ilbc::Makefile index 1eb6bc1887f6..7770e07550a4 100644 --- a/net/asterisk12/files/patch-codecs::ilbc::Makefile +++ b/net/asterisk12/files/patch-codecs::ilbc::Makefile @@ -1,8 +1,8 @@  $FreeBSD$ ---- codecs/ilbc/Makefile	2003/10/17 09:04:00	1.1 -+++ codecs/ilbc/Makefile	2003/10/17 09:04:09 +--- codecs/ilbc/Makefile.orig	Sun Apr 27 21:13:11 2003 ++++ codecs/ilbc/Makefile	Fri Jan 30 01:47:34 2004  @@ -1,4 +1,4 @@  -CFLAGS+= -fPIC -O3  +CFLAGS+= -fPIC diff --git a/net/asterisk12/files/patch-codecs::lpc10::Makefile b/net/asterisk12/files/patch-codecs::lpc10::Makefile index 43138eb093d9..68c98c064f70 100644 --- a/net/asterisk12/files/patch-codecs::lpc10::Makefile +++ b/net/asterisk12/files/patch-codecs::lpc10::Makefile @@ -1,8 +1,8 @@  $FreeBSD$ ---- codecs/lpc10/Makefile.orig	Sun Apr 27 21:13:11 2003 -+++ codecs/lpc10/Makefile	Fri Oct 17 12:07:20 2003 +--- codecs/lpc10/Makefile.orig	Thu Jan  8 18:52:11 2004 ++++ codecs/lpc10/Makefile	Fri Jan 30 02:06:54 2004  @@ -3,7 +3,7 @@   #  @@ -12,7 +12,7 @@ $FreeBSD$   #    # These definitions for CFLAGS and LIB_TARGET_DIR are used when one -@@ -22,12 +22,12 @@ +@@ -22,14 +22,14 @@   #    WARNINGS = -Wall -Wno-comment -Wno-error @@ -21,9 +21,11 @@ $FreeBSD$   #CFLAGS+= $(shell if uname -m | grep -q 86; then echo "-mpentium" ; fi)   #fix for PPC processors + ifneq ($(OSARCH),Darwin)   ifneq ($(PROC),ppc) + ifneq ($(PROC),x86_64)  -	CFLAGS+= -march=$(PROC)  +	CFLAGS+=    endif -  - LIB = $(LIB_TARGET_DIR)/liblpc10.a + endif + endif diff --git a/net/asterisk12/files/patch-codecs::lpc10::lpcini.c b/net/asterisk12/files/patch-codecs::lpc10::lpcini.c deleted file mode 100644 index f30f7e4b2b6c..000000000000 --- a/net/asterisk12/files/patch-codecs::lpc10::lpcini.c +++ /dev/null @@ -1,17 +0,0 @@ - -$FreeBSD$ - ---- codecs/lpc10/lpcini.c.orig	Wed Feb 12 15:59:15 2003 -+++ codecs/lpc10/lpcini.c	Fri Oct 17 12:13:04 2003 -@@ -29,9 +29,9 @@ - 	-lf2c -lm   (in that order) - */ -  --#include "f2c.h" -+#include <stdlib.h> -  --#include <malloc.h> -+#include "f2c.h" -  - /* Common Block Declarations */ -  diff --git a/net/asterisk12/files/patch-codecs::mp3::Makefile b/net/asterisk12/files/patch-codecs::mp3::Makefile deleted file mode 100644 index 3cd714f7ce62..000000000000 --- a/net/asterisk12/files/patch-codecs::mp3::Makefile +++ /dev/null @@ -1,14 +0,0 @@ - -$FreeBSD$ - ---- codecs/mp3/Makefile	2003/10/17 09:05:05	1.1 -+++ codecs/mp3/Makefile	2003/10/17 09:05:18 -@@ -1,7 +1,7 @@ - # - # LMC section -  --CFLAGS+= -I../include -Iinclude -O6 -funroll-loops -finline-functions -Wall -Wno-missing-prototypes -Wno-missing-declarations -g -fPIC -+CFLAGS+= -I../include -Iinclude -funroll-loops -finline-functions -Wall -Wno-missing-prototypes -Wno-missing-declarations -fPIC - RANLIB=ranlib -  - # the XING decoder objs and dependencies: diff --git a/net/asterisk12/files/patch-codecs::mp3::include::L3.h b/net/asterisk12/files/patch-codecs::mp3::include::L3.h deleted file mode 100644 index 50d7345c39a4..000000000000 --- a/net/asterisk12/files/patch-codecs::mp3::include::L3.h +++ /dev/null @@ -1,20 +0,0 @@ - -$FreeBSD$ - ---- codecs/mp3/include/L3.h.orig	Wed Feb 12 15:59:14 2003 -+++ codecs/mp3/include/L3.h	Fri Oct 17 11:27:30 2003 -@@ -49,6 +49,14 @@ - #define LITTLE_ENDIAN 0 - #endif -  -+#if BYTE_ORDER == LITTLE_ENDIAN -+#define LITTLE_ENDIAN 1 -+#endif -+ -+#if BYTE_ORDER == BIG_ENDIAN -+#define LITTLE_ENDIAN 0 -+#endif -+ - #ifndef LITTLE_ENDIAN - #error Layer III LITTLE_ENDIAN must be defined 0 or 1 - #endif diff --git a/net/asterisk12/files/patch-codecs::slin_g729_ex.h b/net/asterisk12/files/patch-codecs::slin_g729_ex.h new file mode 100644 index 000000000000..e1236d2498dc --- /dev/null +++ b/net/asterisk12/files/patch-codecs::slin_g729_ex.h @@ -0,0 +1,31 @@ + +$FreeBSD$ + +--- /dev/null	Fri Jan 30 01:52:11 2004 ++++ codecs/slin_g729_ex.h	Fri Jan 30 01:57:59 2004 +@@ -0,0 +1,25 @@ ++/* ++ * slin_g729_ex.h -- ++ * ++ *	Signed 16-bit audio data, 10 milliseconds worth at 8 kHz. ++ * ++ * Source: g723.example ++ * ++ * Copyright (C) 2001, Linux Support Services, Inc. ++ * ++ * Distributed under the terms of the GNU General Public License ++ * ++ */ ++ ++static signed short slin_g729_ex[] = { ++	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, ++	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, ++	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, ++	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, ++	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, ++	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, ++	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, ++	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, ++	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, ++	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 ++}; diff --git a/net/asterisk12/files/patch-db.c b/net/asterisk12/files/patch-db.c index ebe8fedec060..59e5cef87770 100644 --- a/net/asterisk12/files/patch-db.c +++ b/net/asterisk12/files/patch-db.c @@ -1,8 +1,8 @@  $FreeBSD$ ---- db.c.orig	Wed Aug 13 18:25:16 2003 -+++ db.c	Fri Oct 17 11:27:30 2003 +--- db.c.orig	Tue Dec  2 17:12:56 2003 ++++ db.c	Fri Jan 30 01:47:34 2004  @@ -32,7 +32,7 @@   #include <asterisk/options.h>   #include <asterisk/astdb.h> diff --git a/net/asterisk12/files/patch-editline::configure b/net/asterisk12/files/patch-editline::configure index 040ab0422c92..f6b9c5b76eee 100644 --- a/net/asterisk12/files/patch-editline::configure +++ b/net/asterisk12/files/patch-editline::configure @@ -1,8 +1,8 @@  $FreeBSD$ ---- editline/configure	2003/10/17 09:02:33	1.1 -+++ editline/configure	2003/10/17 09:03:18 +--- editline/configure.orig	Sun Apr 27 21:13:11 2003 ++++ editline/configure	Fri Jan 30 01:47:34 2004  @@ -1906,7 +1906,7 @@     CPPFLAGS="$CPPFLAGS -DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG"     CPPFLAGS="$CPPFLAGS -DDEBUG_REFRESH -DDEBUG_PASTE" diff --git a/net/asterisk12/files/patch-enum.c b/net/asterisk12/files/patch-enum.c deleted file mode 100644 index fd5c7f9926af..000000000000 --- a/net/asterisk12/files/patch-enum.c +++ /dev/null @@ -1,40 +0,0 @@ - -$FreeBSD$ - ---- enum.c.orig	Mon Sep  1 18:36:52 2003 -+++ enum.c	Fri Oct 17 11:27:30 2003 -@@ -380,9 +380,14 @@ - 	struct enum_search *s = NULL; - 	int version = -1; - 	struct __res_state enumstate; --	res_ninit(&enumstate);	 --	if (chan && ast_autoservice_start(chan) < 0) -+	static ast_mutex_t reslock = AST_MUTEX_INITIALIZER; -+ -+	ast_mutex_lock(&reslock); -+	res_init();	 -+	if (chan && ast_autoservice_start(chan) < 0) { -+		ast_mutex_unlock(&reslock); - 		return -1; -+	} -  - 	strncat(naptrinput, number, sizeof(naptrinput) - 2); -  -@@ -411,7 +416,7 @@ - 		ast_mutex_unlock(&enumlock); - 		if (!s) - 			break; --		res = res_nsearch(&enumstate, tmp, C_IN, T_NAPTR, answer, sizeof(answer)); -+		res = res_search(tmp, C_IN, T_NAPTR, answer, sizeof(answer)); - 		if (res > 0) - 			break; - 	} -@@ -429,7 +434,7 @@ - 	} - 	if (chan) - 		ret |= ast_autoservice_stop(chan); --	res_nclose(&enumstate); -+	ast_mutex_unlock(&reslock); - 	return ret; - } -  diff --git a/net/asterisk12/files/patch-formats::Makefile b/net/asterisk12/files/patch-formats::Makefile index 2b59d3522211..dacfd7b08303 100644 --- a/net/asterisk12/files/patch-formats::Makefile +++ b/net/asterisk12/files/patch-formats::Makefile @@ -1,14 +1,23 @@  $FreeBSD$ ---- formats/Makefile	2003/10/17 09:41:29	1.1 -+++ formats/Makefile	2003/10/17 09:41:43 +--- formats/Makefile.orig	Tue Nov  4 04:40:09 2003 ++++ formats/Makefile	Fri Jan 30 01:47:34 2004 +@@ -18,7 +18,7 @@ + # + # G723 simple frame is depricated + # +-#FORMAT_LIBS+=format_g723.so ++FORMAT_LIBS+=format_g723_1.so +  + GSMLIB=../codecs/gsm/lib/libgsm.a +   @@ -40,7 +40,7 @@ - 	$(CC) -shared -Xlinker -x -o $@ $< -lm + 	$(CC) $(SOLINK) -o $@ $< -lm   install: all --	for x in $(FORMAT_LIBS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done -+	for x in $(FORMAT_LIBS); do $(BSD_INSTALL_PROGRAM) $$x $(MODULES_DIR) ; done +-	for x in $(FORMAT_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done ++	for x in $(FORMAT_LIBS); do $(BSD_INSTALL_PROGRAM) $$x $(DESTDIR)$(MODULES_DIR) ; done   depend: .depend diff --git a/net/asterisk12/files/patch-formats::format_g723_1.c b/net/asterisk12/files/patch-formats::format_g723_1.c new file mode 100644 index 000000000000..8d0755e14205 --- /dev/null +++ b/net/asterisk12/files/patch-formats::format_g723_1.c @@ -0,0 +1,351 @@ + +$FreeBSD$ + +--- /dev/null	Fri Jan 30 01:52:11 2004 ++++ formats/format_g723_1.c	Fri Jan 30 01:58:19 2004 +@@ -0,0 +1,345 @@ ++/* ++ * Asterisk -- A telephony toolkit for Linux. ++ * ++ * Save and read raw, headerless G723.1 Annex A data. ++ * ++ * Copyright (C) 1999, Mark Spencer <markster@linux-support.net> ++ * Copyright (C) 2003, Maxim Sobolev <sobomax@FreeBSD.org> ++ * ++ * This program is free software, distributed under the terms of ++ * the GNU General Public License ++ */ ++ ++#include <asterisk/lock.h> ++#include <asterisk/channel.h> ++#include <asterisk/file.h> ++#include <asterisk/logger.h> ++#include <asterisk/sched.h> ++#include <asterisk/module.h> ++#include <netinet/in.h> ++#include <arpa/inet.h> ++#include <stdlib.h> ++#include <sys/time.h> ++#include <stdio.h> ++#include <unistd.h> ++#include <errno.h> ++#include <string.h> ++#include <pthread.h> ++#ifdef __linux__ ++#include <endian.h> ++#else ++#include <machine/endian.h> ++#endif ++ ++/* Based on format_g729.c */ ++ ++#define TYPE_HIGH	0x0 ++#define TYPE_LOW	0x1 ++#define TYPE_SILENCE	0x2 ++#define TYPE_DONTSEND	0x3 ++#define TYPE_MASK	0x3 ++ ++struct ast_filestream { ++	void *reserved[AST_RESERVED_POINTERS]; ++	/* This is what a filestream means to us */ ++	int fd; 				/* Descriptor */ ++	struct ast_frame fr;			/* Frame information */ ++	char waste[AST_FRIENDLY_OFFSET];	/* Buffer for sending frames, etc */ ++	char empty;				/* Empty character */ ++	unsigned char g723[24];			/* One Real G723.1 Frame */ ++}; ++ ++static long g723_tell(struct ast_filestream *); ++ ++static ast_mutex_t g723_lock = AST_MUTEX_INITIALIZER; ++static int glistcnt = 0; ++ ++static char *name = "g723"; ++static char *desc = "Raw G723.1 Annex A data"; ++static char *exts = "g723"; ++ ++static int g723_len(unsigned char buf) ++{ ++	switch(buf & TYPE_MASK) { ++	case TYPE_DONTSEND: ++		return 2; ++		break; ++	case TYPE_SILENCE: ++		return 4; ++		break; ++	case TYPE_HIGH: ++		return 24; ++		break; ++	case TYPE_LOW: ++		return 20; ++		break; ++	default: ++		ast_log(LOG_WARNING, "Badly encoded G723.1 frame (%d)\n", buf & TYPE_MASK); ++	} ++	return -1; ++} ++ ++static struct ast_filestream *g723_open(int fd) ++{ ++	/* We don't have any header to read or anything really, but ++	   if we did, it would go here.  We also might want to check ++	   and be sure it's a valid file.  */ ++	struct ast_filestream *tmp; ++	if ((tmp = malloc(sizeof(struct ast_filestream)))) { ++		memset(tmp, 0, sizeof(struct ast_filestream)); ++		if (ast_mutex_lock(&g723_lock)) { ++			ast_log(LOG_WARNING, "Unable to lock g723 list\n"); ++			free(tmp); ++			return NULL; ++		} ++		tmp->fd = fd; ++		tmp->fr.data = tmp->g723; ++		tmp->fr.frametype = AST_FRAME_VOICE; ++		tmp->fr.subclass = AST_FORMAT_G723_1; ++		/* datalen will vary for each frame */ ++		tmp->fr.src = name; ++		tmp->fr.mallocd = 0; ++		glistcnt++; ++		ast_mutex_unlock(&g723_lock); ++		ast_update_use_count(); ++	} ++	return tmp; ++} ++ ++static struct ast_filestream *g723_rewrite(int fd, char *comment) ++{ ++	/* We don't have any header to read or anything really, but ++	   if we did, it would go here.  We also might want to check ++	   and be sure it's a valid file.  */ ++	struct ast_filestream *tmp; ++	if ((tmp = malloc(sizeof(struct ast_filestream)))) { ++		memset(tmp, 0, sizeof(struct ast_filestream)); ++		if (ast_mutex_lock(&g723_lock)) { ++			ast_log(LOG_WARNING, "Unable to lock g723 list\n"); ++			free(tmp); ++			return NULL; ++		} ++		tmp->fd = fd; ++		glistcnt++; ++		ast_mutex_unlock(&g723_lock); ++		ast_update_use_count(); ++	} else ++		ast_log(LOG_WARNING, "Out of memory\n"); ++	return tmp; ++} ++ ++static void g723_close(struct ast_filestream *s) ++{ ++	if (ast_mutex_lock(&g723_lock)) { ++		ast_log(LOG_WARNING, "Unable to lock g723 list\n"); ++		return; ++	} ++	glistcnt--; ++	ast_mutex_unlock(&g723_lock); ++	ast_update_use_count(); ++	close(s->fd); ++	free(s); ++	s = NULL; ++} ++ ++static struct ast_frame *g723_read(struct ast_filestream *s, int *whennext) ++{ ++	int res; ++	/* Send a frame from the file to the appropriate channel */ ++	s->fr.frametype = AST_FRAME_VOICE; ++	s->fr.subclass = AST_FORMAT_G723_1; ++	s->fr.offset = AST_FRIENDLY_OFFSET; ++	s->fr.samples = 240; ++	s->fr.mallocd = 0; ++	s->fr.data = s->g723; ++	if ((res = read(s->fd, s->g723, 1)) != 1) { ++		if (res) ++			ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno)); ++		return NULL; ++	} ++	s->fr.datalen = g723_len(s->g723[0]); ++	if (s->fr.datalen < 0) { ++		ast_log(LOG_WARNING, "Invalid G723.1 frame!\n"); ++		return NULL; ++	} ++	if (s->fr.datalen > 1 && (res = read(s->fd, s->g723 + 1, s->fr.datalen - 1)) != s->fr.datalen - 1) { ++		if (res) ++			ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno)); ++		return NULL; ++	} ++	*whennext = s->fr.samples; ++	return &s->fr; ++} ++ ++static int g723_write(struct ast_filestream *fs, struct ast_frame *f) ++{ ++	int res; ++	unsigned char *cp; ++	if (f->frametype != AST_FRAME_VOICE) { ++		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n"); ++		return -1; ++	} ++	if (f->subclass != AST_FORMAT_G723_1) { ++		ast_log(LOG_WARNING, "Asked to write non-G723.1 frame (%d)!\n", f->subclass); ++		return -1; ++	} ++	for (cp = f->data; cp < (unsigned char *)f->data + f->datalen; cp += res) { ++		res = g723_len(cp[0]); ++		if (res < 0) { ++			ast_log(LOG_WARNING, "Asked to write invalid G723.1 frame!\n"); ++			return -1; ++		} ++	} ++	if (cp != (unsigned char *)f->data + f->datalen) { ++		ast_log(LOG_WARNING, "Invalid G723.1 data length, %d\n", f->datalen); ++		return -1; ++	} ++	if ((res = write(fs->fd, f->data, f->datalen)) != f->datalen) { ++		ast_log(LOG_WARNING, "Bad write %d: %s\n", res, strerror(errno)); ++		return -1; ++	} ++	return 0; ++} ++ ++static char *g723_getcomment(struct ast_filestream *s) ++{ ++	return NULL; ++} ++ ++static int g723_seek(struct ast_filestream *fs, long sample_offset, int whence) ++{ ++	long cur, offset, max; ++	off_t coffset, moffset, soffset; ++	int res; ++	unsigned char c; ++ ++	offset = 0;	/* Shut up gcc warning */ ++	if (whence == SEEK_SET) { ++		offset = sample_offset; ++	} else if (whence == SEEK_CUR || whence == SEEK_FORCECUR) { ++		if ((cur = g723_tell(fs)) == -1) { ++			ast_log(LOG_WARNING, "Can't get current position!\n"); ++			return -1; ++		} ++		offset = cur + sample_offset; ++	} ++	if ((moffset = lseek(fs->fd, 0, SEEK_END)) == -1) { ++		ast_log(LOG_WARNING, "Can't seek stream to an end!\n"); ++		return -1; ++	} ++	if (whence == SEEK_END) { ++		if ((max = g723_tell(fs)) == -1) { ++			ast_log(LOG_WARNING, "Can't get maximum position!\n"); ++			return -1; ++		} ++		offset = max - sample_offset; ++	} ++	if (offset < 0) ++		offset = 0; ++	soffset = -1; ++	for (coffset = 0; coffset < moffset && offset > 0; coffset += res) { ++		if (lseek(fs->fd, coffset, SEEK_SET) != coffset) { ++			ast_log(LOG_WARNING, "Can't seek to offset %lli!\n", coffset); ++			return -1; ++		} ++		if (read(fs->fd, &c, 1) != 1) { ++			ast_log(LOG_WARNING, "Can't read from offset %lli!\n", coffset); ++			return -1; ++		} ++		soffset = coffset; ++		if ((res = g723_len(c)) < 0) { ++			ast_log(LOG_WARNING, "Invalid G723.1 frame at offset %lli!\n", coffset); ++			return -1; ++		} ++		if (res > 1) ++			offset -= 240; ++	} ++	if (soffset != -1 && lseek(fs->fd, soffset, SEEK_SET) != soffset) { ++		ast_log(LOG_WARNING, "Can't seek to offset %lli!\n", soffset); ++		return -1; ++	} ++ ++	return 0; ++} ++ ++static int g723_trunc(struct ast_filestream *fs) ++{ ++	/* Truncate file to current length */ ++	if (ftruncate(fs->fd, lseek(fs->fd, 0, SEEK_CUR)) < 0) ++		return -1; ++	return 0; ++} ++ ++static long g723_tell(struct ast_filestream *fs) ++{ ++	off_t offset, coffset; ++	int res; ++	long rval; ++	unsigned char c; ++ ++	offset = lseek(fs->fd, 0, SEEK_CUR); ++	rval = 0; ++	for (coffset = 0; coffset < offset; coffset += res) { ++		if (lseek(fs->fd, coffset, SEEK_SET) != coffset) { ++			ast_log(LOG_WARNING, "Can't seek to offset %llu!\n", coffset); ++			return -1; ++		} ++		if (read(fs->fd, &c, 1) != 1) { ++			ast_log(LOG_WARNING, "Can't read from offset %llu!\n", coffset); ++			return -1; ++		} ++		if ((res = g723_len(c)) < 0) { ++			ast_log(LOG_WARNING, "Invalid G723.1 frame at offset %llu!\n", coffset); ++			return -1; ++		} ++		if (res > 1) ++			rval += 240; ++	} ++	if (lseek(fs->fd, offset, SEEK_SET) != offset) { ++		ast_log(LOG_WARNING, "Can't seek to offset %llu!\n", offset); ++		return -1; ++	} ++	return rval; ++} ++ ++int load_module() ++{ ++	return ast_format_register(name, exts, AST_FORMAT_G723_1, ++				   g723_open, ++				   g723_rewrite, ++				   g723_write, ++				   g723_seek, ++				   g723_trunc, ++				   g723_tell, ++				   g723_read, ++				   g723_close, ++				   g723_getcomment); ++} ++ ++int unload_module() ++{ ++	return ast_format_unregister(name); ++} ++ ++int usecount() ++{ ++	int res; ++	if (ast_mutex_lock(&g723_lock)) { ++		ast_log(LOG_WARNING, "Unable to lock g723 list\n"); ++		return -1; ++	} ++	res = glistcnt; ++	ast_mutex_unlock(&g723_lock); ++	return res; ++} ++ ++char *description() ++{ ++	return desc; ++} ++ ++ ++char *key() ++{ ++	return ASTERISK_GPL_KEY; ++} diff --git a/net/asterisk12/files/patch-formats::format_g729.c b/net/asterisk12/files/patch-formats::format_g729.c new file mode 100644 index 000000000000..a255fc351e71 --- /dev/null +++ b/net/asterisk12/files/patch-formats::format_g729.c @@ -0,0 +1,63 @@ + +$FreeBSD$ + +--- formats/format_g729.c.orig	Mon Sep  8 19:48:07 2003 ++++ formats/format_g729.c	Fri Jan 30 01:47:34 2004 +@@ -45,7 +45,7 @@ + 	struct ast_frame fr;				/* Frame information */ + 	char waste[AST_FRIENDLY_OFFSET];	/* Buffer for sending frames, etc */ + 	char empty;							/* Empty character */ +-	unsigned char g729[20];				/* Two Real G729 Frames */ ++	unsigned char g729[10];				/* One Real G729 Frame */ + }; +  +  +@@ -126,11 +126,11 @@ + 	s->fr.frametype = AST_FRAME_VOICE; + 	s->fr.subclass = AST_FORMAT_G729A; + 	s->fr.offset = AST_FRIENDLY_OFFSET; +-	s->fr.samples = 160; +-	s->fr.datalen = 20; ++	s->fr.samples = 80; ++	s->fr.datalen = 10; + 	s->fr.mallocd = 0; + 	s->fr.data = s->g729; +-	if ((res = read(s->fd, s->g729, 20)) != 20) { ++	if ((res = read(s->fd, s->g729, 10)) != 10) { + 		if (res) + 			ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno)); + 		return NULL; +@@ -150,12 +150,12 @@ + 		ast_log(LOG_WARNING, "Asked to write non-G729 frame (%d)!\n", f->subclass); + 		return -1; + 	} +-	if (f->datalen % 20) { +-		ast_log(LOG_WARNING, "Invalid data length, %d, should be multiple of 20\n", f->datalen); ++	if (f->datalen % 10) { ++		ast_log(LOG_WARNING, "Invalid data length, %d, should be multiple of 10\n", f->datalen); + 		return -1; + 	} + 	if ((res = write(fs->fd, f->data, f->datalen)) != f->datalen) { +-			ast_log(LOG_WARNING, "Bad write (%d/20): %s\n", res, strerror(errno)); ++			ast_log(LOG_WARNING, "Bad write (%d/10): %s\n", res, strerror(errno)); + 			return -1; + 	} + 	return 0; +@@ -174,7 +174,7 @@ + 	cur = lseek(fs->fd, 0, SEEK_CUR); + 	max = lseek(fs->fd, 0, SEEK_END); + 	 +-	bytes = 20 * (sample_offset / 160); ++	bytes = 10 * (sample_offset / 80); + 	if (whence == SEEK_SET) + 		offset = bytes; + 	else if (whence == SEEK_CUR || whence == SEEK_FORCECUR) +@@ -202,7 +202,7 @@ + { + 	off_t offset; + 	offset = lseek(fs->fd, 0, SEEK_CUR); +-	return (offset/20)*160; ++	return (offset/10)*80; + } +  + int load_module() diff --git a/net/asterisk12/files/patch-pbx::Makefile b/net/asterisk12/files/patch-pbx::Makefile index 2725838254dc..dca6672c389a 100644 --- a/net/asterisk12/files/patch-pbx::Makefile +++ b/net/asterisk12/files/patch-pbx::Makefile @@ -1,8 +1,8 @@  $FreeBSD$ ---- pbx/Makefile.orig	Tue Aug 19 19:42:30 2003 -+++ pbx/Makefile	Fri Oct 17 14:21:00 2003 +--- pbx/Makefile.orig	Sun Oct 26 20:50:49 2003 ++++ pbx/Makefile	Fri Jan 30 01:47:34 2004  @@ -16,7 +16,7 @@   PBX_LIBS=pbx_config.so pbx_wilcalu.so pbx_spool.so     # pbx_gtkconsole.so pbx_kdeconsole.so @@ -16,8 +16,8 @@ $FreeBSD$   endif   install: all --	for x in $(PBX_LIBS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done -+	for x in $(PBX_LIBS); do $(BSD_INSTALL_PROGRAM) $$x $(MODULES_DIR) ; done +-	for x in $(PBX_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done ++	for x in $(PBX_LIBS); do $(BSD_INSTALL_PROGRAM) $$x $(DESTDIR)$(MODULES_DIR) ; done   depend: .depend diff --git a/net/asterisk12/files/patch-res::Makefile b/net/asterisk12/files/patch-res::Makefile index 33e2d72cc932..ccd0a35dd59d 100644 --- a/net/asterisk12/files/patch-res::Makefile +++ b/net/asterisk12/files/patch-res::Makefile @@ -1,14 +1,14 @@  $FreeBSD$ ---- res/Makefile	2003/10/17 09:38:22	1.1 -+++ res/Makefile	2003/10/17 09:38:47 +--- res/Makefile.orig	Sun Oct 26 20:50:49 2003 ++++ res/Makefile	Fri Jan 30 01:47:34 2004  @@ -25,7 +25,7 @@   all: depend $(MODS)   install: all --	for x in $(MODS); do $(INSTALL) -m 755 $$x $(MODULES_DIR) ; done -+	for x in $(MODS); do $(BSD_INSTALL_PROGRAM) $$x $(MODULES_DIR) ; done +-	for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done ++	for x in $(MODS); do $(BSD_INSTALL_PROGRAM) $$x $(DESTDIR)$(MODULES_DIR) ; done   res_crypto.so: res_crypto.o - 	$(CC) -shared -Xlinker -x -o $@ $< $(CRYPTO_LIBS) + 	$(CC) $(SOLINK) -o $@ $< $(CRYPTO_LIBS) diff --git a/net/asterisk12/files/patch-srv.c b/net/asterisk12/files/patch-srv.c deleted file mode 100644 index 3cbb534f1b22..000000000000 --- a/net/asterisk12/files/patch-srv.c +++ /dev/null @@ -1,34 +0,0 @@ - -$FreeBSD$ - ---- srv.c.orig	Thu Aug 14 02:56:16 2003 -+++ srv.c	Fri Oct 17 11:27:30 2003 -@@ -246,13 +246,17 @@ - 	int ret = -1; - 	struct __res_state srvstate; - 	char answer[MAX_SIZE]; -+	static ast_mutex_t reslock = AST_MUTEX_INITIALIZER; -  - 	if (*port) - 		*port = 0; --	res_ninit(&srvstate);	 --	if (chan && ast_autoservice_start(chan) < 0) -+	ast_mutex_lock(&reslock); -+	res_init();	 -+	if (chan && ast_autoservice_start(chan) < 0) { -+		ast_mutex_unlock(&reslock); - 		return -1; --	res = res_nsearch(&srvstate, service, C_IN, T_SRV, answer, sizeof(answer)); -+	} -+	res = res_search(service, C_IN, T_SRV, answer, sizeof(answer)); - 	if (res > 0) { - 		if ((res = parse_answer(host, hostlen, port, answer, res))) { - 			ast_log(LOG_WARNING, "Parse error returned %d\n", res); -@@ -267,6 +271,6 @@ - 	} - 	if (chan) - 		ret |= ast_autoservice_stop(chan); --	res_nclose(&srvstate); -+	ast_mutex_unlock(&reslock); - 	return ret; - } diff --git a/net/asterisk12/pkg-plist b/net/asterisk12/pkg-plist index 3bcfc7d403d8..ab3eff23ff6e 100644 --- a/net/asterisk12/pkg-plist +++ b/net/asterisk12/pkg-plist @@ -16,9 +16,12 @@ etc/asterisk/asterisk.adsi-dist  @unexec if cmp -s %D/etc/asterisk/asterisk.conf %D/etc/asterisk/asterisk.conf-dist; then rm -f %D/etc/asterisk/asterisk.conf; fi  etc/asterisk/asterisk.conf-dist  @exec [ -f %B/asterisk.conf ] || cp %B/%f %B/asterisk.conf -@unexec if cmp -s %D/etc/asterisk/cdr_mysql.conf %D/etc/asterisk/cdr_mysql.conf-dist; then rm -f %D/etc/asterisk/cdr_mysql.conf; fi -etc/asterisk/cdr_mysql.conf-dist -@exec [ -f %B/cdr_mysql.conf ] || cp %B/%f %B/cdr_mysql.conf +@unexec if cmp -s %D/etc/asterisk/cdr_odbc.conf %D/etc/asterisk/cdr_odbc.conf-dist; then rm -f %D/etc/asterisk/cdr_odbc.conf; fi +etc/asterisk/cdr_odbc.conf-dist +@exec [ -f %B/cdr_odbc.conf ] || cp %B/%f %B/cdr_odbc.conf +@unexec if cmp -s %D/etc/asterisk/cdr_pgsql.conf %D/etc/asterisk/cdr_pgsql.conf-dist; then rm -f %D/etc/asterisk/cdr_pgsql.conf; fi +etc/asterisk/cdr_pgsql.conf-dist +@exec [ -f %B/cdr_pgsql.conf ] || cp %B/%f %B/cdr_pgsql.conf  @unexec if cmp -s %D/etc/asterisk/enum.conf %D/etc/asterisk/enum.conf-dist; then rm -f %D/etc/asterisk/enum.conf; fi  etc/asterisk/enum.conf-dist  @exec [ -f %B/enum.conf ] || cp %B/%f %B/enum.conf @@ -82,6 +85,9 @@ etc/asterisk/rtp.conf-dist  @unexec if cmp -s %D/etc/asterisk/sip.conf %D/etc/asterisk/sip.conf-dist; then rm -f %D/etc/asterisk/sip.conf; fi  etc/asterisk/sip.conf-dist  @exec [ -f %B/sip.conf ] || cp %B/%f %B/sip.conf +@unexec if cmp -s %D/etc/asterisk/skinny.conf %D/etc/asterisk/skinny.conf-dist; then rm -f %D/etc/asterisk/skinny.conf; fi +etc/asterisk/skinny.conf-dist +@exec [ -f %B/skinny.conf ] || cp %B/%f %B/skinny.conf  @unexec if cmp -s %D/etc/asterisk/telcordia-1.adsi %D/etc/asterisk/telcordia-1.adsi-dist; then rm -f %D/etc/asterisk/telcordia-1.adsi; fi  etc/asterisk/telcordia-1.adsi-dist  @exec [ -f %B/telcordia-1.adsi ] || cp %B/%f %B/telcordia-1.adsi @@ -96,12 +102,14 @@ etc/asterisk/zapata.conf-dist  @exec [ -f %B/zapata.conf ] || cp %B/%f %B/zapata.conf  include/asterisk/acl.h  include/asterisk/adsi.h +include/asterisk/aes.h  include/asterisk/alaw.h  include/asterisk/app.h  include/asterisk/ast_expr.h  include/asterisk/astdb.h  include/asterisk/astmm.h  include/asterisk/callerid.h +include/asterisk/causes.h  include/asterisk/cdr.h  include/asterisk/channel.h  include/asterisk/channel_pvt.h @@ -109,6 +117,9 @@ include/asterisk/chanvars.h  include/asterisk/cli.h  include/asterisk/config.h  include/asterisk/crypto.h +include/asterisk/cvsid.h +include/asterisk/dlfcn-compat.h +include/asterisk/dns.h  include/asterisk/dsp.h  include/asterisk/enum.h  include/asterisk/file.h @@ -118,6 +129,7 @@ include/asterisk/image.h  include/asterisk/indications.h  include/asterisk/io.h  include/asterisk/linkedlists.h +include/asterisk/localtime.h  include/asterisk/lock.h  include/asterisk/logger.h  include/asterisk/manager.h @@ -128,6 +140,7 @@ include/asterisk/musiconhold.h  include/asterisk/options.h  include/asterisk/parking.h  include/asterisk/pbx.h +include/asterisk/poll-compat.h  include/asterisk/privacy.h  include/asterisk/rtp.h  include/asterisk/say.h @@ -138,11 +151,12 @@ include/asterisk/term.h  include/asterisk/translate.h  include/asterisk/ulaw.h  include/asterisk/vmodem.h -include/asterisk/zonedata.h  lib/asterisk/modules/app_adsiprog.so  lib/asterisk/modules/app_agi.so  lib/asterisk/modules/app_authenticate.so +lib/asterisk/modules/app_cdr.so  lib/asterisk/modules/app_chanisavail.so +lib/asterisk/modules/app_cut.so  lib/asterisk/modules/app_datetime.so  lib/asterisk/modules/app_db.so  lib/asterisk/modules/app_dial.so @@ -152,6 +166,7 @@ lib/asterisk/modules/app_echo.so  lib/asterisk/modules/app_enumlookup.so  lib/asterisk/modules/app_festival.so  lib/asterisk/modules/app_getcpeid.so +lib/asterisk/modules/app_hasnewvoicemail.so  lib/asterisk/modules/app_image.so  lib/asterisk/modules/app_intercom.so  lib/asterisk/modules/app_lookupblacklist.so @@ -164,9 +179,13 @@ lib/asterisk/modules/app_playback.so  lib/asterisk/modules/app_privacy.so  lib/asterisk/modules/app_qcall.so  lib/asterisk/modules/app_queue.so +lib/asterisk/modules/app_random.so +lib/asterisk/modules/app_read.so  lib/asterisk/modules/app_record.so +lib/asterisk/modules/app_sayunixtime.so  lib/asterisk/modules/app_senddtmf.so  lib/asterisk/modules/app_setcallerid.so +lib/asterisk/modules/app_setcdruserfield.so  lib/asterisk/modules/app_setcidname.so  lib/asterisk/modules/app_setcidnum.so  lib/asterisk/modules/app_softhangup.so @@ -176,11 +195,9 @@ lib/asterisk/modules/app_system.so  lib/asterisk/modules/app_transfer.so  lib/asterisk/modules/app_url.so  lib/asterisk/modules/app_voicemail.so -lib/asterisk/modules/app_voicemail2.so  lib/asterisk/modules/app_waitforring.so  lib/asterisk/modules/app_zapateller.so  lib/asterisk/modules/cdr_csv.so -lib/asterisk/modules/cdr_mysql.so  lib/asterisk/modules/chan_agent.so  lib/asterisk/modules/chan_h323.so  lib/asterisk/modules/chan_iax.so @@ -193,20 +210,22 @@ lib/asterisk/modules/chan_modem_bestdata.so  lib/asterisk/modules/chan_modem_i4l.so  lib/asterisk/modules/chan_oss.so  lib/asterisk/modules/chan_sip.so +lib/asterisk/modules/chan_skinny.so  lib/asterisk/modules/codec_a_mu.so  lib/asterisk/modules/codec_adpcm.so  lib/asterisk/modules/codec_alaw.so +lib/asterisk/modules/codec_g723_1_dummy.so +lib/asterisk/modules/codec_g729_dummy.so  lib/asterisk/modules/codec_gsm.so  lib/asterisk/modules/codec_ilbc.so  lib/asterisk/modules/codec_lpc10.so -lib/asterisk/modules/codec_mp3_d.so  lib/asterisk/modules/codec_speex.so  lib/asterisk/modules/codec_ulaw.so +lib/asterisk/modules/format_g723_1.so  lib/asterisk/modules/format_g729.so  lib/asterisk/modules/format_gsm.so  lib/asterisk/modules/format_h263.so  lib/asterisk/modules/format_jpeg.so -lib/asterisk/modules/format_mp3.so  lib/asterisk/modules/format_pcm.so  lib/asterisk/modules/format_pcm_alaw.so  lib/asterisk/modules/format_vox.so @@ -242,7 +261,9 @@ share/asterisk/sounds/auth-thankyou.gsm  share/asterisk/sounds/beep.gsm  share/asterisk/sounds/conf-getchannel.gsm  share/asterisk/sounds/conf-getconfno.gsm +share/asterisk/sounds/conf-getpin.gsm  share/asterisk/sounds/conf-invalid.gsm +share/asterisk/sounds/conf-invalidpin.gsm  share/asterisk/sounds/conf-onlyperson.gsm  share/asterisk/sounds/demo-abouttotry.gsm  share/asterisk/sounds/demo-congrats.gsm @@ -368,6 +389,7 @@ share/asterisk/sounds/vm-deleted.gsm  share/asterisk/sounds/vm-extension.gsm  share/asterisk/sounds/vm-first.gsm  share/asterisk/sounds/vm-for.gsm +share/asterisk/sounds/vm-forwardoptions.gsm  share/asterisk/sounds/vm-goodbye.gsm  share/asterisk/sounds/vm-helpexit.gsm  share/asterisk/sounds/vm-incorrect.gsm @@ -377,6 +399,7 @@ share/asterisk/sounds/vm-isonphone.gsm  share/asterisk/sounds/vm-isunavail.gsm  share/asterisk/sounds/vm-last.gsm  share/asterisk/sounds/vm-login.gsm +share/asterisk/sounds/vm-mailboxfull.gsm  share/asterisk/sounds/vm-message.gsm  share/asterisk/sounds/vm-messages.gsm  share/asterisk/sounds/vm-mismatch.gsm  | 
