From 746f3ee0450eeb7756c01ac288b3ffbaa42b8f0d Mon Sep 17 00:00:00 2001 From: Nicolas Thill Date: Tue, 4 Sep 2007 19:16:45 +0000 Subject: [PATCH] add asterisk-1.4.x (thanks to Hans Zandblet) SVN-Revision: 8611 --- net/asterisk-1.4.x/Makefile | 720 ++++++++++++++ net/asterisk-1.4.x/files/asterisk.default | 4 + net/asterisk-1.4.x/files/asterisk.init | 21 + net/asterisk-1.4.x/files/modules.conf | 137 +++ .../patches/011-Makefile-main.patch | 12 + .../patches/013-chan_iax2-tmp_path.patch | 12 + .../patches/014-openssl-configure_ac.patch | 11 + .../patches/015-spandsp-app_fax.patch | 875 ++++++++++++++++++ .../patches/016-iksemel-configure_ac.patch | 12 + .../patches/017-Makefile-no_march.patch | 12 + .../patches/023-autoconf-chan_h323.patch | 23 + net/asterisk-1.4.x/patches/026-gsm-mips.patch | 30 + 12 files changed, 1869 insertions(+) create mode 100644 net/asterisk-1.4.x/Makefile create mode 100644 net/asterisk-1.4.x/files/asterisk.default create mode 100755 net/asterisk-1.4.x/files/asterisk.init create mode 100644 net/asterisk-1.4.x/files/modules.conf create mode 100644 net/asterisk-1.4.x/patches/011-Makefile-main.patch create mode 100644 net/asterisk-1.4.x/patches/013-chan_iax2-tmp_path.patch create mode 100644 net/asterisk-1.4.x/patches/014-openssl-configure_ac.patch create mode 100644 net/asterisk-1.4.x/patches/015-spandsp-app_fax.patch create mode 100644 net/asterisk-1.4.x/patches/016-iksemel-configure_ac.patch create mode 100644 net/asterisk-1.4.x/patches/017-Makefile-no_march.patch create mode 100644 net/asterisk-1.4.x/patches/023-autoconf-chan_h323.patch create mode 100644 net/asterisk-1.4.x/patches/026-gsm-mips.patch diff --git a/net/asterisk-1.4.x/Makefile b/net/asterisk-1.4.x/Makefile new file mode 100644 index 000000000..6fdd5c435 --- /dev/null +++ b/net/asterisk-1.4.x/Makefile @@ -0,0 +1,720 @@ +# +# Copyright (C) 2007 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=asterisk +PKG_VERSION:=1.4.11 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://ftp.digium.com/pub/asterisk/old-releases/ +PKG_MD5SUM:=3ba9b399fedc68de4845b1c5603d167c + +PKG_BUILD_DEPENDS:= libopenh323 pwlib + +include $(INCLUDE_DIR)/package.mk + +define Package/asterisk14/Default + SUBMENU:=asterisk14 (Complete Open Source PBX), v1.4.x + SECTION:=net + CATEGORY:=Network +endef + +define Package/asterisk14/Default/description + Asterisk is a complete PBX in software. It provides all of the features + you would expect from a PBX and more. Asterisk does voice over IP in three + protocols, and can interoperate with almost all standards-based telephony + equipment using relatively inexpensive hardware. + URL:=http://www.asterisk.org/ +endef + + +define Package/asterisk14 +$(call Package/asterisk14/Default) + TITLE:=Complete open source PBX + DEPENDS:= +libltdl +libncurses +libpopt +libpthread +zlib +endef + +define Package/asterisk14/description +$(call Package/asterisk14/Default/description) +endef + + +define Package/asterisk14-mini +$(call Package/asterisk14/Default) + TITLE:=Minimal open source PBX + DEPENDS:=+libncurses +libpthread +endef + +define Package/asterisk14-mini/description +$(call Package/asterisk14/Default/description) + This package contains only the following modules: + - app_dial + - chan_iax2 + - chan_local + - chan_sip + - codec_gsm + - codec_ulaw + - format_gsm + - format_pcm + - format_wav + - format_wav_gsm + - pbx_config + - res_features + - res_musiconhold +endef + + +define Package/asterisk14-chan-alsa +$(call Package/asterisk14/Default) + TITLE:=ALSA soundcards support + DEPENDS:= +asterisk14 +alsa-lib +endef + +define Package/asterisk14-chan-alsa/description +$(call Package/asterisk14/Default/description) + This package provides the channel driver for ALSA sound cards support to + Asterisk. +endef + + +define Package/asterisk14-chan-gtalk +$(call Package/asterisk14/Default) + TITLE:=GTalk support + DEPENDS:= +asterisk14 +libiksemel +endef + +define Package/asterisk14-chan-gtalk/description +$(call Package/asterisk14/Default/description) + This package provides the channel chan_gtalk and res_jabber for GTalk + support to Asterisk. +endef + + +define Package/asterisk14-chan-h323 +$(call Package/asterisk14/Default) + TITLE:=H.323 support for Asterisk + DEPENDS:= +asterisk14 +uclibcxx +endef + +define Package/asterisk14-chan-h323/description +$(call Package/asterisk14/Default/description) + This package provides H.323 support to Asterisk. +endef + + +define Package/asterisk14-chan-mgcp +$(call Package/asterisk14/Default) + TITLE:=MGCP support + DEPENDS:= +asterisk14 +endef + +define Package/asterisk14-chan-mgcp/description +$(call Package/asterisk14/Default/description) + This package provides MGCP (Media Gateway Control Protocol) support \\\ + to Asterisk. +endef + + +define Package/asterisk14-chan-skinny +$(call Package/asterisk14/Default) + TITLE:=Skinny Client Control Protocol support + DEPENDS:= +asterisk14 +endef + +define Package/asterisk14-chan-skinny/description +$(call Package/asterisk14/Default/description) + This package provided Skinny Client Control Protocol support to \\\ + Asterisk. +endef + + +define Package/asterisk14-codec-ilbc +$(call Package/asterisk14/Default) + TITLE:=ILBC Translator + DEPENDS:= +asterisk14 +endef + +define Package/asterisk14-codec-ilbc/description +$(call Package/asterisk14/Default/description) + This package contains the ILBC (Internet Low Bitrate Codec) translator + for Asterisk. +endef + + +define Package/asterisk14-codec-lpc10 +$(call Package/asterisk14/Default) + TITLE:=LPC10 2.4kbps voice codec Translator + DEPENDS:= +asterisk14 +endef + +define Package/asterisk14-chan-lpc10/description +$(call Package/asterisk14/Default/description) + This package contains the LPC10 (Linear Predictor Code) 2.4kbps voice + codec translator for Asterisk. +endef + + +define Package/asterisk14-codec-speex +$(call Package/asterisk14/Default) + TITLE:=Speex/PCM16 Codec Translator + DEPENDS:= +asterisk14 +libspeex +endef + +define Package/asterisk14-chan-speex/description +$(call Package/asterisk14/Default/description) + This package contains the Speex speech compression codec translator for + Asterisk. +endef + + +define Package/asterisk14-pbx-dundi +$(call Package/asterisk14/Default) + TITLE:=DUNDi support + DEPENDS:= +asterisk14 +endef + +define Package/asterisk14-pbx-dundi/description +$(call Package/asterisk14/Default/description) + This package provides DUNDi (Distributed Universal Number Discovery) + support to Asterisk. +endef + + +define Package/asterisk14-res-agi +$(call Package/asterisk14/Default) + TITLE:=AGI support + DEPENDS:= +asterisk14 +endef + +define Package/asterisk14-res-agi/description +$(call Package/asterisk14/Default/description) + This package provides AGI (Asterisk Gateway Interface) support to + Asterisk. +endef + + +define Package/asterisk14-res-crypto +$(call Package/asterisk14/Default) + TITLE:=Cryptographic Digital Signatures support + DEPENDS:= +asterisk14 +libopenssl +endef + +define Package/asterisk14-res-crypto/description +$(call Package/asterisk14/Default/description) + This package provides Cryptographic Digital Signatures support to + Asterisk. +endef + + +define Package/asterisk14-pgsql +$(call Package/asterisk14/Default) + TITLE:=PostgreSQL support + DEPENDS:= +asterisk14 +libpq +endef + +define Package/asterisk14-pgsql/description +$(call Package/asterisk14/Default/description) + This package contains PostgreSQL support modules for Asterisk. +endef + + +define Package/asterisk14-sqlite +$(call Package/asterisk14/Default) + TITLE:=SQLite modules + DEPENDS:= +asterisk14 +libsqlite2 +endef + +define Package/asterisk14-sqlite/description +$(call Package/asterisk14/Default/description) + This package contains SQLite support modules for Asterisk. +endef + + +define Package/asterisk14-sounds +$(call Package/asterisk14/Default) + TITLE:=Sound files + DEPENDS:= +asterisk14 +endef + +define Package/asterisk14-sounds/description +$(call Package/asterisk14/Default/description) + This package contains sound files for Asterisk. +endef + + +define Package/asterisk14-voicemail +$(call Package/asterisk14/Default) + TITLE:=Voicemail support + DEPENDS:= +asterisk14 +endef + +define Package/asterisk14-voicemail/description +$(call Package/asterisk14/Default/description) + This package contains voicemail related modules for Asterisk. +endef + + +CONFIGURE_ARGS+= \ + --without-curl \ + --without-curses \ + --without-gsm \ + --without-imap \ + --without-isdnnet \ + --without-kde \ + --with-ltdl="$(STAGING_DIR)/usr" \ + --without-misdn \ + --without-nbs \ + --with-ncurses="$(STAGING_DIR)/usr" \ + --without-netsnmp \ + --without-newt \ + --without-odbc \ + --without-ogg \ + --without-osptk \ + --without-oss \ + --with-popt="$(STAGING_DIR)/usr" \ + --without-pri \ + --without-qt \ + --without-radius \ + --without-spandsp \ + --without-suppserv \ + --without-tds \ + --without-termcap \ + --without-tinfo \ + --without-tonezone \ + --without-vorbis \ + --without-vpb \ + --with-z="$(STAGING_DIR)/usr" \ + --without-zaptel \ + +EXTRA_CFLAGS:= $(TARGET_CPPFLAGS) +EXTRA_LDFLAGS:= $(TARGET_LDFLAGS) + +ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk14-chan-alsa),) + CONFIGURE_ARGS+= \ + --with-asound="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= \ + --without-asound +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk14-chan-gtalk),) + CONFIGURE_ARGS+= \ + --with-gnutls="$(STAGING_DIR)/usr" \ + --with-iksemel="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= \ + --without-gnutls \ + --without-iksemel +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk14-chan-h323),) + CONFIGURE_ARGS+= \ + --with-h323="$(BUILD_DIR)/openh323" \ + --with-pwlib="$(BUILD_DIR)/pwlib" + CONFIGURE_VARS+= \ + LIBS="$$$$LIBS -luClibc++ -ldl -lpthread" + + define Build/Compile/chan-h323 + $(MAKE) -C "$(PKG_BUILD_DIR)/channels/h323" \ + $(TARGET_CONFIGURE_OPTS) \ + CXXLIBS="-nodefaultlibs -luClibc++" \ + optnoshared + endef +else + CONFIGURE_ARGS+= \ + --without-h323 \ + --without-pwlib +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk14-codec-speex),) + CONFIGURE_ARGS+= \ + --with-speex="$(STAGING_DIR)/usr" + EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/speex +else + CONFIGURE_ARGS+= \ + --without-speex +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk14-res-crypto),) + CONFIGURE_ARGS+= \ + --with-ssl="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= \ + --without-ssl +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk14-pgsql),) + CONFIGURE_ARGS+= \ + --with-postgres="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= \ + --without-postgres +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk14-sqlite),) + CONFIGURE_ARGS+= \ + --with-sqlite="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= \ + --without-sqlite +endif + + +define Build/Configure + ( cd $(PKG_BUILD_DIR); ./bootstrap.sh ) + $(call Build/Configure/Default) +endef + +define Build/Compile + $(MAKE) -C "$(PKG_BUILD_DIR)" \ + include/asterisk/version.h \ + include/asterisk/buildopts.h defaults.h \ + makeopts.embed_rules + $(call Build/Compile/chan-h323) + ASTCFLAGS="$(EXTRA_CFLAGS) -DLOW_MEMORY $(TARGET_CFLAGS)" \ + ASTLDFLAGS="$(EXTRA_LDFLAGS)" \ + $(MAKE) -C "$(PKG_BUILD_DIR)" \ + ASTVARLIBDIR="/usr/lib/asterisk" \ + NOISY_BUILD="1" \ + DEBUG="" \ + OPTIMIZE="" \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install samples + $(SED) 's|/var/lib/asterisk|/usr/lib/asterisk|g' $(PKG_INSTALL_DIR)/etc/asterisk/musiconhold.conf +endef + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include/asterisk/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/asterisk/*.h $(STAGING_DIR)/usr/include/asterisk/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/asterisk.h $(STAGING_DIR)/usr/include/ +endef + + +define Package/asterisk14/conffiles +/etc/asterisk/agents.conf +/etc/asterisk/alarmreceiver.conf +/etc/asterisk/amd.conf +/etc/asterisk/asterisk.conf +/etc/asterisk/cdr.conf +/etc/asterisk/cdr_custom.conf +/etc/asterisk/cdr_manager.conf +/etc/asterisk/codecs.conf +/etc/asterisk/dnsmgr.conf +/etc/asterisk/enum.conf +/etc/asterisk/extconfig.conf +/etc/asterisk/extensions.ael +/etc/asterisk/extensions.conf +/etc/asterisk/features.conf +/etc/asterisk/followme.conf +/etc/asterisk/http.conf +/etc/asterisk/iax.conf +/etc/asterisk/iaxprov.conf +/etc/asterisk/indications.conf +/etc/asterisk/logger.conf +/etc/asterisk/manager.conf +/etc/asterisk/misdn.conf +/etc/asterisk/modules.conf +/etc/asterisk/musiconhold.conf +/etc/asterisk/muted.conf +/etc/asterisk/osp.conf +/etc/asterisk/privacy.conf +/etc/asterisk/queues.conf +/etc/asterisk/rtp.conf +/etc/asterisk/say.conf +/etc/asterisk/sip.conf +/etc/asterisk/sip_notify.conf +/etc/asterisk/sla.conf +/etc/asterisk/smdi.conf +/etc/asterisk/udptl.conf +/etc/asterisk/users.conf +endef + +define Package/asterisk14/postinst +#!/bin/sh +ROOT=`echo $${PKG_ROOT} | sed 's:[\/]:\\\&:g' -` +/bin/sed -i 's/\ \/etc/\ '$${ROOT}'etc/g' $${PKG_ROOT}/etc/asterisk/asterisk.conf +/bin/sed -i 's/\ \/var/\ '$${ROOT}'var/g' $${PKG_ROOT}/etc/asterisk/asterisk.conf +/bin/sed -i 's/\ \/usr/\ '$${ROOT}'usr/g' $${PKG_ROOT}/etc/asterisk/asterisk.conf +/bin/sed -i 's/^DEST=/DEST='$${ROOT}'/g' $${PKG_ROOT}/etc/init.d/asterisk +/bin/sed -i 's/OPTIONS=\"\"/OPTIONS=\"-C\ '$${ROOT}'etc\/asterisk\/asterisk.conf\"/g' $${PKG_ROOT}/etc/default/asterisk +endef + +define Package/asterisk14/install + $(CP) $(PKG_INSTALL_DIR)/* $(1) + rm -rf $(1)/usr/sbin/astgenkey + rm -rf $(1)/usr/sbin/aelparse + rm -rf $(1)/usr/sbin/autosupport + rm -rf $(1)/usr/sbin/muted + rm -rf $(1)/usr/sbin/stereorize + rm -rf $(1)/usr/bin + rm -rf $(1)/usr/man + rm -rf $(1)/usr/include + rm -rf $(1)/var/spool/asterisk/meetme + rm -rf $(1)/var/spool/asterisk/voicemail + (cd $(1)/usr/lib/asterisk; \ + rm -rf agi-bin; \ + rm -rf images; \ + rm -rf keys/*; \ + rm -rf moh/*.wav; \ + rm -rf sounds/*; \ + cd modules; \ + rm -rf *adsi* *festival* *modem* *oss* *phone* *intercom* \ + *mp3* *nbscat* *sqlite* *mysql* *postgres* *pgsql* \ + *voicemail* *speex* *flash* *page* *zap* *jpeg* \ + *snmp* \ + chan_alsa.so \ + chan_gtalk.so \ + chan_h323.so \ + chan_mgcp.so \ + chan_skinny.so \ + {codec,format}_ilbc.so \ + codec_lpc10.so \ + pbx_dundi.so \ + res_agi.so \ + res_crypto.so \ + res_jabber.so \ + ) + (cd $(1)/etc/asterisk; \ + rm -f *odbc* *mysql* *postgres* *pgsql* *voicemail* \ + *adsi* *oss* *alsa* *festival* *modem* *phone* \ + *tds* *vofr* *rpt* *vpb* *snmp* \ + *zapata* \ + alsa.conf \ + dundi.conf \ + gtalk.conf \ + h323.conf \ + jabber.conf \ + mgcp.conf \ + skinny.conf \ + ) + $(INSTALL_DATA) ./files/modules.conf $(1)/etc/asterisk/ + $(INSTALL_DIR) $(1)/etc/default + $(INSTALL_DATA) ./files/asterisk.default $(1)/etc/default/asterisk + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/asterisk.init $(1)/etc/init.d/asterisk +endef + + +define Package/asterisk14-mini/conffiles +/etc/asterisk/asterisk.conf +/etc/asterisk/enum.conf +/etc/asterisk/extconfig.conf +/etc/asterisk/extensions.conf +/etc/asterisk/features.conf +/etc/asterisk/http.conf +/etc/asterisk/iax.conf +/etc/asterisk/iaxprov.conf +/etc/asterisk/logger.conf +/etc/asterisk/manager.conf +/etc/asterisk/modules.conf +/etc/asterisk/musiconhold.conf +/etc/asterisk/rtp.conf +/etc/asterisk/sip.conf +/etc/asterisk/sip_notify.conf +/etc/asterisk/users.conf +endef + +define Package/asterisk14-mini/install + $(INSTALL_DIR) $(1)/etc/asterisk + for f in asterisk enum extconfig extensions features http \ + iax iaxprov logger manager modules musiconhold rtp \ + sip sip_notify users; do \ + $(CP) $(PKG_INSTALL_DIR)/etc/asterisk/$$$$f.conf $(1)/etc/asterisk/ ; \ + done + $(INSTALL_DATA) ./files/modules.conf $(1)/etc/asterisk/ + $(INSTALL_DIR) $(1)/usr/lib/asterisk + $(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/firmware $(1)/usr/lib/asterisk/ + $(INSTALL_DIR) $(1)/usr/lib/asterisk/keys + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + for f in app_dial chan_iax2 chan_local chan_sip codec_gsm \ + codec_ulaw format_gsm format_pcm format_wav format_wav_gsm \ + pbx_config res_features res_musiconhold; do \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/$$$$f.so $(1)/usr/lib/asterisk/modules/ ; \ + done + $(INSTALL_DIR) $(1)/usr/lib/asterisk/moh + $(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/asterisk $(1)/usr/sbin/ + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/safe_asterisk $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/default + $(INSTALL_DATA) ./files/asterisk.default $(1)/etc/default/asterisk + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/asterisk.init $(1)/etc/init.d/asterisk +endef + + +define Package/asterisk14-chan-alsa/conffiles +/etc/asterisk/alsa.conf +endef + +define Package/asterisk14-chan-alsa/install + $(INSTALL_DIR) $(1)/etc/asterisk + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/alsa.conf $(1)/etc/asterisk/ + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_alsa.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-chan-gtalk/conffiles +/etc/asterisk/gtalk.conf +/etc/asterisk/jabber.conf +endef + +define Package/asterisk14-chan-gtalk/install + $(INSTALL_DIR) $(1)/etc/asterisk + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/gtalk.conf $(1)/etc/asterisk/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/jabber.conf $(1)/etc/asterisk/ + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_gtalk.so $(1)/usr/lib/asterisk/modules/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_jabber.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-chan-h323/conffiles +/etc/asterisk/h323.conf +endef + +define Package/asterisk14-chan-h323/install + $(INSTALL_DIR) $(1)/etc/asterisk + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/h323.conf $(1)/etc/asterisk/ + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_h323.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-chan-mgcp/install +/etc/asterisk/mgcp.conf +endef + +define Package/asterisk14-chan-mgcp/install + $(INSTALL_DIR) $(1)/etc/asterisk + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/mgcp.conf $(1)/etc/asterisk/ + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_mgcp.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-chan-skinny/conffiles +/etc/asterisk/skinny.conf +endef + +define Package/asterisk14-chan-skinny/install + $(INSTALL_DIR) $(1)/etc/asterisk + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/skinny.conf $(1)/etc/asterisk/ + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_skinny.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-codec-ilbc/install + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/codec_ilbc.so $(1)/usr/lib/asterisk/modules/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/format_ilbc.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-codec-lpc10/install + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/codec_lpc10.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-codec-speex/install + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/codec_speex.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-pbx-dundi/conffiles +/etc/asterisk/dundi.conf +endef + +define Package/asterisk14-pbx-dundi/install + $(INSTALL_DIR) $(1)/etc/asterisk + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/dundi.conf $(1)/etc/asterisk/ + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/pbx_dundi.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-res-agi/install + $(INSTALL_DIR) $(1)/usr/lib/asterisk/agi-bin + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_agi.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-res-crypto/install + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_crypto.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-pgsql/conffiles +/etc/asterisk/cdr_pgsql.conf +/etc/asterisk/res_pgsql.conf +endef + +define Package/asterisk14-pgsql/install + $(INSTALL_DIR) $(1)/etc/asterisk + install -m0600 $(PKG_INSTALL_DIR)/etc/asterisk/cdr_pgsql.conf $(1)/etc/asterisk/ + install -m0600 $(PKG_INSTALL_DIR)/etc/asterisk/res_pgsql.conf $(1)/etc/asterisk/ + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/cdr_pgsql.so $(1)/usr/lib/asterisk/modules/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_config_pgsql.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-sqlite/install + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/cdr_sqlite.so $(1)/usr/lib/asterisk/modules/ +endef + + +define Package/asterisk14-sounds/install + $(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds + $(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/* $(1)/usr/lib/asterisk/sounds/ + rm -f $(1)/usr/lib/asterisk/sounds/vm-* + rm -f $(1)/usr/lib/asterisk/sounds/x +endef + + +define Package/asterisk14-voicemail/conffiles +/etc/asterisk/voicemail.conf +endef + +define Package/asterisk14-voicemail/install + $(INSTALL_DIR) $(1)/etc/asterisk + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/voicemail.conf $(1)/etc/asterisk/ + $(INSTALL_DIR) $(1)/usr/lib/asterisk/modules + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/*voicemail.so $(1)/usr/lib/asterisk/modules/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_adsi.so $(1)/usr/lib/asterisk/modules/ + $(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds + $(CP) $(PKG_INSTALL_DIR)//usr/lib/asterisk/sounds/vm-*.gsm $(1)/usr/lib/asterisk/sounds/ +endef + + +$(eval $(call BuildPackage,asterisk14)) +$(eval $(call BuildPackage,asterisk14-mini)) +$(eval $(call BuildPackage,asterisk14-chan-alsa)) +$(eval $(call BuildPackage,asterisk14-chan-gtalk)) +$(eval $(call BuildPackage,asterisk14-chan-h323)) +$(eval $(call BuildPackage,asterisk14-chan-mgcp)) +$(eval $(call BuildPackage,asterisk14-chan-skinny)) +$(eval $(call BuildPackage,asterisk14-codec-ilbc)) +$(eval $(call BuildPackage,asterisk14-codec-lpc10)) +$(eval $(call BuildPackage,asterisk14-codec-speex)) +$(eval $(call BuildPackage,asterisk14-pbx-dundi)) +$(eval $(call BuildPackage,asterisk14-res-agi)) +$(eval $(call BuildPackage,asterisk14-res-crypto)) +$(eval $(call BuildPackage,asterisk14-pgsql)) +$(eval $(call BuildPackage,asterisk14-sqlite)) +$(eval $(call BuildPackage,asterisk14-voicemail)) +$(eval $(call BuildPackage,asterisk14-sounds)) diff --git a/net/asterisk-1.4.x/files/asterisk.default b/net/asterisk-1.4.x/files/asterisk.default new file mode 100644 index 000000000..9d046c42d --- /dev/null +++ b/net/asterisk-1.4.x/files/asterisk.default @@ -0,0 +1,4 @@ +## startup options for /etc/init.d/asterisk + +ENABLE_ASTERISK="yes" +OPTIONS="" diff --git a/net/asterisk-1.4.x/files/asterisk.init b/net/asterisk-1.4.x/files/asterisk.init new file mode 100755 index 000000000..e61aaf45e --- /dev/null +++ b/net/asterisk-1.4.x/files/asterisk.init @@ -0,0 +1,21 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org +START=50 + +DEST= +DEFAULT=$DEST/etc/default/asterisk +OPTIONS="" + +start() { + [ -f $DEFAULT ] && . $DEFAULT + [ -d $DEST/var/run ] || mkdir -p $DEST/var/run + [ -d $DEST/var/log/asterisk ] || mkdir -p $DEST/var/log/asterisk + [ -d $DEST/var/spool/asterisk ] || mkdir -p $DEST/var/spool/asterisk + [ -d /var/spool/asterisk ] || mkdir -p /var/spool/asterisk + [ -h $DEST/usr/lib/asterisk/astdb ] || ln -sf /var/spool/asterisk/astdb $DEST/usr/lib/asterisk/astdb + $DEST/usr/sbin/asterisk $OPTIONS +} + +stop() { + [ -f $DEST/var/run/asterisk.pid ] && kill $(cat $DEST/var/run/asterisk.pid) >/dev/null 2>&1 +} diff --git a/net/asterisk-1.4.x/files/modules.conf b/net/asterisk-1.4.x/files/modules.conf new file mode 100644 index 000000000..ce12c82dc --- /dev/null +++ b/net/asterisk-1.4.x/files/modules.conf @@ -0,0 +1,137 @@ +; +; Asterisk configuration file +; +; Module Loader configuration file +; + +[modules] +autoload=yes +; +; Any modules that need to be loaded before the Asterisk core has been +; initialized (just after the logger has been initialized) can be loaded +; using 'preload'. This will frequently be needed if you wish to map all +; module configuration files into Realtime storage, since the Realtime +; driver will need to be loaded before the modules using those configuration +; files are initialized. +; +; An example of loading ODBC support would be: +;preload => res_odbc.so +;preload => res_config_odbc.so +; +noload => res_config_mysql.so ; +noload => res_crypto.so ; Cryptographic Digital Signatures +; load => res_features.so ; Call Parking Resource +noload => res_indications.so ; Indications Configuration +noload => res_monitor.so ; Call Monitoring Resource +; load => res_musiconhold.so ; Music On Hold Resource +noload => cdr_csv.so ; Comma Separated Values CDR Backend +noload => cdr_custom.so ; Customizable Comma Separated Values CDR Backend +noload => cdr_manager.so ; Asterisk Call Manager CDR Backend +noload => cdr_mysql.so ; MySQL CDR Backend +noload => cdr_pgsql.so ; PostgreSQL CDR Backend +noload => cdr_sqlite.so ; SQLite CDR Backend +noload => chan_alsa.so ; Channel driver for GTalk +noload => chan_agent.so ; Agent Proxy Channel +noload => chan_gtalk.so ; Channel driver for GTalk +; load => chan_iax2.so ; Inter Asterisk eXchange (Ver 2) +; load => chan_local.so ; Local Proxy Channel +; load => chan_sip.so ; Session Initiation Protocol (SIP) +noload => codec_a_mu.so ; A-law and Mulaw direct Coder/Decoder +noload => codec_adpcm.so ; Adaptive Differential PCM Coder/Decoder +noload => codec_alaw.so ; A-law Coder/Decoder +noload => codec_g726.so ; ITU G.726-32kbps G726 Transcoder +; load => codec_gsm.so ; GSM/PCM16 (signed linear) Codec Translation +; load => codec_ulaw.so ; Mu-law Coder/Decoder +noload => codec_speex.so ; Speex/PCM16 (signed linear) Codec Translator +noload => format_au.so ; Sun Microsystems AU format (signed linear) +noload => format_g723.so ; G.723.1 Simple Timestamp File Format +noload => format_g726.so ; Raw G.726 (16/24/32/40kbps) data +noload => format_g729.so ; Raw G729 data +; load => format_gsm.so ; Raw GSM data +noload => format_h263.so ; Raw h263 data +noload => format_jpeg.so ; JPEG (Joint Picture Experts Group) Image +; load => format_pcm.so ; Raw uLaw 8khz Audio support (PCM) +noload => format_pcm_alaw.so ; Raw aLaw 8khz PCM Audio support +noload => format_sln.so ; Raw Signed Linear Audio support (SLN) +noload => format_vox.so ; Dialogic VOX (ADPCM) File Format +; load => format_wav.so ; Microsoft WAV format (8000hz Signed Line +; load => format_wav_gsm.so ; Microsoft WAV format (Proprietary GSM) +noload => app_alarmreceiver.so ; Alarm Receiver Application +noload => app_authenticate.so ; Authentication Application +noload => app_cdr.so ; Make sure asterisk doesn't save CDR +noload => app_chanisavail.so ; Check if channel is available +noload => app_chanspy.so ; Listen in on any channel +noload => app_controlplayback.so ; Control Playback Application +noload => app_cut.so ; Cuts up variables +noload => app_db.so ; Database access functions +; load => app_dial.so ; Dialing Application +noload => app_dictate.so ; Virtual Dictation Machine Application +noload => app_directory.so ; Extension Directory +noload => app_directed_pickup.so ; Directed Call Pickup Support +noload => app_disa.so ; DISA (Direct Inward System Access) Application +noload => app_dumpchan.so ; Dump channel variables Application +; load => app_echo.so ; Simple Echo Application +noload => app_enumlookup.so ; ENUM Lookup +noload => app_eval.so ; Reevaluates strings +noload => app_exec.so ; Executes applications +noload => app_externalivr.so ; External IVR application interface +noload => app_forkcdr.so ; Fork The CDR into 2 seperate entities +noload => app_getcpeid.so ; Get ADSI CPE ID +noload => app_groupcount.so ; Group Management Routines +noload => app_ices.so ; Encode and Stream via icecast and ices +noload => app_image.so ; Image Transmission Application +noload => app_lookupblacklist.so ; Look up Caller*ID name/number from black +noload => app_lookupcidname.so ; Look up CallerID Name from local databas +; load => app_macro.so ; Extension Macros +noload => app_math.so ; A simple math Application +noload => app_md5.so ; MD5 checksum Application +; load => app_milliwatt.so ; Digital Milliwatt (mu-law) Test Application +noload => app_mixmonitor.so ; Record a call and mix the audio during the recording +noload => app_parkandannounce.so ; Call Parking and Announce Application +; load => app_playback.so ; Trivial Playback Application +noload => app_privacy.so ; Require phone number to be entered +noload => app_queue.so ; True Call Queueing +noload => app_random.so ; Random goto +noload => app_read.so ; Read Variable Application +noload => app_readfile.so ; Read in a file +noload => app_realtime.so ; Realtime Data Lookup/Rewrite +noload => app_record.so ; Trivial Record Application +; load => app_sayunixtime.so ; Say time +noload => app_senddtmf.so ; Send DTMF digits Application +noload => app_sendtext.so ; Send Text Applications +noload => app_setcallerid.so ; Set CallerID Application +noload => app_setcdruserfield.so ; CDR user field apps +noload => app_setcidname.so ; Set CallerID Name +noload => app_setcidnum.so ; Set CallerID Number +noload => app_setrdnis.so ; Set RDNIS Number +noload => app_settransfercapability.so ; Set ISDN Transfer Capability +noload => app_sms.so ; SMS/PSTN handler +noload => app_softhangup.so ; Hangs up the requested channel +noload => app_stack.so ; Stack Routines +noload => app_system.so ; Generic System() application +noload => app_talkdetect.so ; Playback with Talk Detection +noload => app_test.so ; Interface Test Application +noload => app_transfer.so ; Transfer +noload => app_txtcidname.so ; TXTCIDName +noload => app_url.so ; Send URL Applications +noload => app_userevent.so ; Custom User Event Application +; load => app_verbose.so ; Send verbose output +noload => app_waitforring.so ; Waits until first ring after time +noload => app_waitforsilence.so ; Wait For Silence Application +noload => app_while.so ; While Loops and Conditional Execution +noload => func_callerid.so ; Caller ID related dialplan functions +noload => func_enum.so ; ENUM Functions +noload => func_uri.so ; URI encoding / decoding functions +noload => pbx_ael.so ; Asterisk Extension Language Compiler +; load => pbx_config.so ; Text Extension Configuration +noload => pbx_functions.so ; Builtin dialplan functions +noload => pbx_loopback.so ; Loopback Switch +noload => pbx_realtime.so ; Realtime Switch +noload => pbx_spool.so ; Outgoing Spool Support +noload => pbx_wilcalu.so ; Wil Cal U (Auto Dialer) +; +; Module names listed in "global" section will have symbols globally +; exported to modules loaded after them. +; +[global] +chan_modem.so=no diff --git a/net/asterisk-1.4.x/patches/011-Makefile-main.patch b/net/asterisk-1.4.x/patches/011-Makefile-main.patch new file mode 100644 index 000000000..2bc2e1e95 --- /dev/null +++ b/net/asterisk-1.4.x/patches/011-Makefile-main.patch @@ -0,0 +1,12 @@ +diff -Nru asterisk-1.4.5.org/main/Makefile asterisk-1.4.5/main/Makefile +--- asterisk-1.4.5.org/main/Makefile 2007-04-10 18:05:55.000000000 +0200 ++++ asterisk-1.4.5/main/Makefile 2007-06-22 08:59:22.000000000 +0200 +@@ -135,7 +135,7 @@ + @rm -f $(ASTTOPDIR)/include/asterisk/build.h.tmp + @$(CC) -c -o buildinfo.o $(ASTCFLAGS) buildinfo.c + $(ECHO_PREFIX) echo " [LD] $^ -> $@" +- $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) ++ $(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) + @$(ASTTOPDIR)/build_tools/strip_nonapi $@ + + clean:: diff --git a/net/asterisk-1.4.x/patches/013-chan_iax2-tmp_path.patch b/net/asterisk-1.4.x/patches/013-chan_iax2-tmp_path.patch new file mode 100644 index 000000000..b0a9c3712 --- /dev/null +++ b/net/asterisk-1.4.x/patches/013-chan_iax2-tmp_path.patch @@ -0,0 +1,12 @@ +diff -Nru asterisk-1.4.5.org/channels/chan_iax2.c asterisk-1.4.5/channels/chan_iax2.c +--- asterisk-1.4.5.org/channels/chan_iax2.c 2007-06-14 23:50:40.000000000 +0200 ++++ asterisk-1.4.5/channels/chan_iax2.c 2007-06-22 09:03:01.000000000 +0200 +@@ -1376,7 +1376,7 @@ + last++; + else + last = s; +- snprintf(s2, strlen(s) + 100, "/var/tmp/%s-%ld", last, (unsigned long)ast_random()); ++ snprintf(s2, strlen(s) + 100, "/tmp/%s-%ld", last, (unsigned long)ast_random()); + res = stat(s, &stbuf); + if (res < 0) { + ast_log(LOG_WARNING, "Failed to stat '%s': %s\n", s, strerror(errno)); diff --git a/net/asterisk-1.4.x/patches/014-openssl-configure_ac.patch b/net/asterisk-1.4.x/patches/014-openssl-configure_ac.patch new file mode 100644 index 000000000..d56de18d8 --- /dev/null +++ b/net/asterisk-1.4.x/patches/014-openssl-configure_ac.patch @@ -0,0 +1,11 @@ +--- asterisk-1.4.5.org/configure.ac 2007-06-04 18:02:31.000000000 +0200 ++++ asterisk-1.4.5/configure.ac 2007-06-22 08:47:51.000000000 +0200 +@@ -900,7 +900,7 @@ + + AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h]) + +-AST_EXT_LIB_CHECK([OPENSSL], [ssl], [ssl2_connect], [openssl/ssl.h], [-lcrypto]) ++AST_EXT_LIB_CHECK([OPENSSL], [ssl], [ssl23_connect], [openssl/ssl.h], [-lcrypto]) + if test "$PBX_OPENSSL" = "1"; + then + AST_EXT_LIB_CHECK([OSPTK], [osptk], [OSPPCryptoDecrypt], [osp/osp.h], [-lcrypto -lssl]) diff --git a/net/asterisk-1.4.x/patches/015-spandsp-app_fax.patch b/net/asterisk-1.4.x/patches/015-spandsp-app_fax.patch new file mode 100644 index 000000000..3df3941c1 --- /dev/null +++ b/net/asterisk-1.4.x/patches/015-spandsp-app_fax.patch @@ -0,0 +1,875 @@ +diff -Nru asterisk-1.4.5.org/apps/app_rxfax.c asterisk-1.4.5/apps/app_rxfax.c +--- asterisk-1.4.5.org/apps/app_rxfax.c 1970-01-01 01:00:00.000000000 +0100 ++++ asterisk-1.4.5/apps/app_rxfax.c 2007-06-22 09:05:59.000000000 +0200 +@@ -0,0 +1,376 @@ ++/* ++ * Asterisk -- A telephony toolkit for Linux. ++ * ++ * Trivial application to receive a TIFF FAX file ++ * ++ * Copyright (C) 2003, Steve Underwood ++ * ++ * Steve Underwood ++ * ++ * This program is free software, distributed under the terms of ++ * the GNU General Public License ++ */ ++ ++/*** MODULEINFO ++ spandsp ++***/ ++ ++#include "asterisk.h" ++ ++ASTERISK_FILE_VERSION(__FILE__, "$Revision:$") ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "asterisk/lock.h" ++#include "asterisk/file.h" ++#include "asterisk/logger.h" ++#include "asterisk/channel.h" ++#include "asterisk/pbx.h" ++#include "asterisk/module.h" ++#include "asterisk/translate.h" ++#include "asterisk/dsp.h" ++#include "asterisk/manager.h" ++ ++static char *app = "RxFAX"; ++ ++static char *synopsis = "Receive a FAX to a file"; ++ ++static char *descrip = ++" RxFAX(filename[|caller][|debug]): Receives a FAX from the channel into the\n" ++"given filename. If the file exists it will be overwritten. The file\n" ++"should be in TIFF/F format.\n" ++"The \"caller\" option makes the application behave as a calling machine,\n" ++"rather than the answering machine. The default behaviour is to behave as\n" ++"an answering machine.\n" ++"Uses LOCALSTATIONID to identify itself to the remote end.\n" ++" LOCALHEADERINFO to generate a header line on each page.\n" ++"Sets REMOTESTATIONID to the sender CSID.\n" ++" FAXPAGES to the number of pages received.\n" ++" FAXBITRATE to the transmition rate.\n" ++" FAXRESOLUTION to the resolution.\n" ++"Returns -1 when the user hangs up.\n" ++"Returns 0 otherwise.\n"; ++ ++#define MAX_BLOCK_SIZE 240 ++ ++static void span_message(int level, const char *msg) ++{ ++ int ast_level; ++ ++ if (level == SPAN_LOG_WARNING) ++ ast_level = __LOG_WARNING; ++ else if (level == SPAN_LOG_WARNING) ++ ast_level = __LOG_WARNING; ++ else ++ ast_level = __LOG_DEBUG; ++ ast_log(ast_level, __FILE__, __LINE__, __PRETTY_FUNCTION__, msg); ++} ++/*- End of function --------------------------------------------------------*/ ++ ++static void t30_flush(t30_state_t *s, int which) ++{ ++ /* TODO: */ ++} ++/*- End of function --------------------------------------------------------*/ ++ ++static void phase_e_handler(t30_state_t *s, void *user_data, int result) ++{ ++ struct ast_channel *chan; ++ t30_stats_t t; ++ char local_ident[21]; ++ char far_ident[21]; ++ char buf[11]; ++ ++ chan = (struct ast_channel *) user_data; ++ if (result == T30_ERR_OK) ++ { ++ t30_get_transfer_statistics(s, &t); ++ t30_get_far_ident(s, far_ident); ++ t30_get_local_ident(s, local_ident); ++ ast_log(LOG_DEBUG, "==============================================================================\n"); ++ ast_log(LOG_DEBUG, "Fax successfully received.\n"); ++ ast_log(LOG_DEBUG, "Remote station id: %s\n", far_ident); ++ ast_log(LOG_DEBUG, "Local station id: %s\n", local_ident); ++ ast_log(LOG_DEBUG, "Pages transferred: %i\n", t.pages_transferred); ++ ast_log(LOG_DEBUG, "Image resolution: %i x %i\n", t.x_resolution, t.y_resolution); ++ ast_log(LOG_DEBUG, "Transfer Rate: %i\n", t.bit_rate); ++ ast_log(LOG_DEBUG, "==============================================================================\n"); ++ manager_event(EVENT_FLAG_CALL, ++ "FaxReceived", "Channel: %s\nExten: %s\nCallerID: %s\nRemoteStationID: %s\nLocalStationID: %s\nPagesTransferred: %i\nResolution: %i\nTransferRate: %i\nFileName: %s\n", ++ chan->name, ++ chan->exten, ++ (chan->cid.cid_num) ? chan->cid.cid_num : "", ++ far_ident, ++ local_ident, ++ t.pages_transferred, ++ t.y_resolution, ++ t.bit_rate, ++ s->rx_file); ++ pbx_builtin_setvar_helper(chan, "REMOTESTATIONID", far_ident); ++ snprintf(buf, sizeof(buf), "%i", t.pages_transferred); ++ pbx_builtin_setvar_helper(chan, "FAXPAGES", buf); ++ snprintf(buf, sizeof(buf), "%i", t.y_resolution); ++ pbx_builtin_setvar_helper(chan, "FAXRESOLUTION", buf); ++ snprintf(buf, sizeof(buf), "%i", t.bit_rate); ++ pbx_builtin_setvar_helper(chan, "FAXBITRATE", buf); ++ } ++ else ++ { ++ ast_log(LOG_DEBUG, "==============================================================================\n"); ++ ast_log(LOG_DEBUG, "Fax receive not successful - result (%d) %s.\n", result, t30_completion_code_to_str(result)); ++ ast_log(LOG_DEBUG, "==============================================================================\n"); ++ } ++} ++/*- End of function --------------------------------------------------------*/ ++ ++static void phase_d_handler(t30_state_t *s, void *user_data, int result) ++{ ++ struct ast_channel *chan; ++ t30_stats_t t; ++ ++ chan = (struct ast_channel *) user_data; ++ if (result) ++ { ++ t30_get_transfer_statistics(s, &t); ++ ast_log(LOG_DEBUG, "==============================================================================\n"); ++ ast_log(LOG_DEBUG, "Pages transferred: %i\n", t.pages_transferred); ++ ast_log(LOG_DEBUG, "Image size: %i x %i\n", t.width, t.length); ++ ast_log(LOG_DEBUG, "Image resolution %i x %i\n", t.x_resolution, t.y_resolution); ++ ast_log(LOG_DEBUG, "Transfer Rate: %i\n", t.bit_rate); ++ ast_log(LOG_DEBUG, "Bad rows %i\n", t.bad_rows); ++ ast_log(LOG_DEBUG, "Longest bad row run %i\n", t.longest_bad_row_run); ++ ast_log(LOG_DEBUG, "Compression type %i\n", t.encoding); ++ ast_log(LOG_DEBUG, "Image size (bytes) %i\n", t.image_size); ++ ast_log(LOG_DEBUG, "==============================================================================\n"); ++ } ++} ++/*- End of function --------------------------------------------------------*/ ++ ++static int rxfax_exec(struct ast_channel *chan, void *data) ++{ ++ int res = 0; ++ char template_file[256]; ++ char target_file[256]; ++ char *s; ++ char *t; ++ char *v; ++ const char *x; ++ int option; ++ int len; ++ int i; ++ fax_state_t fax; ++ int calling_party; ++ int verbose; ++ int samples; ++ ++ struct ast_module_user *u; ++ struct ast_frame *inf = NULL; ++ struct ast_frame outf; ++ ++ int original_read_fmt; ++ int original_write_fmt; ++ ++ uint8_t __buf[sizeof(uint16_t)*MAX_BLOCK_SIZE + 2*AST_FRIENDLY_OFFSET]; ++ uint8_t *buf = __buf + AST_FRIENDLY_OFFSET; ++ ++ if (chan == NULL) ++ { ++ ast_log(LOG_WARNING, "Fax receive channel is NULL. Giving up.\n"); ++ return -1; ++ } ++ ++ span_set_message_handler(span_message); ++ ++ /* The next few lines of code parse out the filename and header from the input string */ ++ if (data == NULL) ++ { ++ /* No data implies no filename or anything is present */ ++ ast_log(LOG_WARNING, "Rxfax requires an argument (filename)\n"); ++ return -1; ++ } ++ ++ calling_party = FALSE; ++ verbose = FALSE; ++ target_file[0] = '\0'; ++ ++ for (option = 0, v = s = data; v; option++, s++) ++ { ++ t = s; ++ v = strchr(s, '|'); ++ s = (v) ? v : s + strlen(s); ++ strncpy((char *) buf, t, s - t); ++ buf[s - t] = '\0'; ++ if (option == 0) ++ { ++ /* The first option is always the file name */ ++ len = s - t; ++ if (len > 255) ++ len = 255; ++ strncpy(target_file, t, len); ++ target_file[len] = '\0'; ++ /* Allow the use of %d in the file name for a wild card of sorts, to ++ create a new file with the specified name scheme */ ++ if ((x = strchr(target_file, '%')) && x[1] == 'd') ++ { ++ strcpy(template_file, target_file); ++ i = 0; ++ do ++ { ++ snprintf(target_file, 256, template_file, 1); ++ i++; ++ } ++ while (ast_fileexists(target_file, "", chan->language) != -1); ++ } ++ } ++ else if (strncmp("caller", t, s - t) == 0) ++ { ++ calling_party = TRUE; ++ } ++ else if (strncmp("debug", t, s - t) == 0) ++ { ++ verbose = TRUE; ++ } ++ } ++ ++ /* Done parsing */ ++ ++ u = ast_module_user_add(chan); ++ ++ if (chan->_state != AST_STATE_UP) ++ { ++ /* Shouldn't need this, but checking to see if channel is already answered ++ * Theoretically asterisk should already have answered before running the app */ ++ res = ast_answer(chan); ++ } ++ ++ if (!res) ++ { ++ original_read_fmt = chan->readformat; ++ if (original_read_fmt != AST_FORMAT_SLINEAR) ++ { ++ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR); ++ if (res < 0) ++ { ++ ast_log(LOG_WARNING, "Unable to set to linear read mode, giving up\n"); ++ return -1; ++ } ++ } ++ original_write_fmt = chan->writeformat; ++ if (original_write_fmt != AST_FORMAT_SLINEAR) ++ { ++ res = ast_set_write_format(chan, AST_FORMAT_SLINEAR); ++ if (res < 0) ++ { ++ ast_log(LOG_WARNING, "Unable to set to linear write mode, giving up\n"); ++ res = ast_set_read_format(chan, original_read_fmt); ++ if (res) ++ ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", chan->name); ++ return -1; ++ } ++ } ++ fax_init(&fax, calling_party); ++ if (verbose) ++ fax.logging.level = SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW; ++ x = pbx_builtin_getvar_helper(chan, "LOCALSTATIONID"); ++ if (x && x[0]) ++ t30_set_local_ident(&fax.t30_state, x); ++ x = pbx_builtin_getvar_helper(chan, "LOCALHEADERINFO"); ++ if (x && x[0]) ++ t30_set_header_info(&fax.t30_state, x); ++ t30_set_rx_file(&fax.t30_state, target_file, -1); ++ //t30_set_phase_b_handler(&fax.t30_state, phase_b_handler, chan); ++ t30_set_phase_d_handler(&fax.t30_state, phase_d_handler, chan); ++ t30_set_phase_e_handler(&fax.t30_state, phase_e_handler, chan); ++ t30_set_ecm_capability(&fax.t30_state, TRUE); ++ t30_set_supported_compressions(&fax.t30_state, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); ++ while (ast_waitfor(chan, -1) > -1) ++ { ++ inf = ast_read(chan); ++ if (inf == NULL) ++ { ++ res = -1; ++ break; ++ } ++ if (inf->frametype == AST_FRAME_VOICE) ++ { ++ if (fax_rx(&fax, inf->data, inf->samples)) ++ break; ++ samples = (inf->samples <= MAX_BLOCK_SIZE) ? inf->samples : MAX_BLOCK_SIZE; ++ len = fax_tx(&fax, (int16_t *) &buf[AST_FRIENDLY_OFFSET], samples); ++ if (len) ++ { ++ memset(&outf, 0, sizeof(outf)); ++ outf.frametype = AST_FRAME_VOICE; ++ outf.subclass = AST_FORMAT_SLINEAR; ++ outf.datalen = len*sizeof(int16_t); ++ outf.samples = len; ++ outf.data = &buf[AST_FRIENDLY_OFFSET]; ++ outf.offset = AST_FRIENDLY_OFFSET; ++ outf.src = "RxFAX"; ++ if (ast_write(chan, &outf) < 0) ++ { ++ ast_log(LOG_WARNING, "Unable to write frame to channel; %s\n", strerror(errno)); ++ break; ++ } ++ } ++ } ++ ast_frfree(inf); ++ } ++ if (inf == NULL) ++ { ++ ast_log(LOG_DEBUG, "Got hangup\n"); ++ res = -1; ++ } ++ if (original_read_fmt != AST_FORMAT_SLINEAR) ++ { ++ res = ast_set_read_format(chan, original_read_fmt); ++ if (res) ++ ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", chan->name); ++ } ++ if (original_write_fmt != AST_FORMAT_SLINEAR) ++ { ++ res = ast_set_write_format(chan, original_write_fmt); ++ if (res) ++ ast_log(LOG_WARNING, "Unable to restore write format on '%s'\n", chan->name); ++ } ++ t30_terminate(&fax.t30_state); ++ } ++ else ++ { ++ ast_log(LOG_WARNING, "Could not answer channel '%s'\n", chan->name); ++ } ++ ast_module_user_remove(u); ++ return res; ++} ++/*- End of function --------------------------------------------------------*/ ++ ++static int unload_module(void) ++{ ++ int res; ++ ++ ast_module_user_hangup_all(); ++ ++ res = ast_unregister_application(app); ++ ++ ++ return res; ++} ++/*- End of function --------------------------------------------------------*/ ++ ++static int load_module(void) ++{ ++ return ast_register_application(app, rxfax_exec, synopsis, descrip); ++} ++/*- End of function --------------------------------------------------------*/ ++ ++AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Trivial FAX Receive Application"); ++ ++/*- End of file ------------------------------------------------------------*/ +diff -Nru asterisk-1.4.5.org/apps/app_txfax.c asterisk-1.4.5/apps/app_txfax.c +--- asterisk-1.4.5.org/apps/app_txfax.c 1970-01-01 01:00:00.000000000 +0100 ++++ asterisk-1.4.5/apps/app_txfax.c 2007-06-22 09:05:59.000000000 +0200 +@@ -0,0 +1,303 @@ ++/* ++ * Asterisk -- A telephony toolkit for Linux. ++ * ++ * Trivial application to send a TIFF file as a FAX ++ * ++ * Copyright (C) 2003, Steve Underwood ++ * ++ * Steve Underwood ++ * ++ * This program is free software, distributed under the terms of ++ * the GNU General Public License ++ */ ++ ++/*** MODULEINFO ++ spandsp ++***/ ++ ++#include "asterisk.h" ++ ++ASTERISK_FILE_VERSION(__FILE__, "$Revision:$") ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "asterisk/lock.h" ++#include "asterisk/file.h" ++#include "asterisk/logger.h" ++#include "asterisk/channel.h" ++#include "asterisk/pbx.h" ++#include "asterisk/module.h" ++#include "asterisk/translate.h" ++ ++static char *app = "TxFAX"; ++ ++static char *synopsis = "Send a FAX file"; ++ ++static char *descrip = ++" TxFAX(filename[|caller][|debug]): Send a given TIFF file to the channel as a FAX.\n" ++"The \"caller\" option makes the application behave as a calling machine,\n" ++"rather than the answering machine. The default behaviour is to behave as\n" ++"an answering machine.\n" ++"Uses LOCALSTATIONID to identify itself to the remote end.\n" ++" LOCALHEADERINFO to generate a header line on each page.\n" ++"Sets REMOTESTATIONID to the receiver CSID.\n" ++"Returns -1 when the user hangs up, or if the file does not exist.\n" ++"Returns 0 otherwise.\n"; ++ ++#define MAX_BLOCK_SIZE 240 ++ ++static void span_message(int level, const char *msg) ++{ ++ int ast_level; ++ ++ if (level == SPAN_LOG_WARNING) ++ ast_level = __LOG_WARNING; ++ else if (level == SPAN_LOG_WARNING) ++ ast_level = __LOG_WARNING; ++ else ++ ast_level = __LOG_DEBUG; ++ ast_log(ast_level, __FILE__, __LINE__, __PRETTY_FUNCTION__, msg); ++} ++/*- End of function --------------------------------------------------------*/ ++ ++#if 0 ++static void t30_flush(t30_state_t *s, int which) ++{ ++ /* TODO: */ ++} ++/*- End of function --------------------------------------------------------*/ ++#endif ++ ++static void phase_e_handler(t30_state_t *s, void *user_data, int result) ++{ ++ struct ast_channel *chan; ++ char far_ident[21]; ++ ++ chan = (struct ast_channel *) user_data; ++ if (result == T30_ERR_OK) ++ { ++ t30_get_far_ident(s, far_ident); ++ pbx_builtin_setvar_helper(chan, "REMOTESTATIONID", far_ident); ++ } ++ else ++ { ++ ast_log(LOG_DEBUG, "==============================================================================\n"); ++ ast_log(LOG_DEBUG, "Fax send not successful - result (%d) %s.\n", result, t30_completion_code_to_str(result)); ++ ast_log(LOG_DEBUG, "==============================================================================\n"); ++ } ++} ++/*- End of function --------------------------------------------------------*/ ++ ++static int txfax_exec(struct ast_channel *chan, void *data) ++{ ++ int res = 0; ++ char source_file[256]; ++ char *s; ++ char *t; ++ char *v; ++ const char *x; ++ int option; ++ int len; ++ fax_state_t fax; ++ int calling_party; ++ int verbose; ++ int samples; ++ ++ struct ast_module_user *u; ++ struct ast_frame *inf = NULL; ++ struct ast_frame outf; ++ ++ int original_read_fmt; ++ int original_write_fmt; ++ ++ uint8_t __buf[sizeof(uint16_t)*MAX_BLOCK_SIZE + 2*AST_FRIENDLY_OFFSET]; ++ uint8_t *buf = __buf + AST_FRIENDLY_OFFSET; ++ ++ if (chan == NULL) ++ { ++ ast_log(LOG_WARNING, "Fax transmit channel is NULL. Giving up.\n"); ++ return -1; ++ } ++ ++ span_set_message_handler(span_message); ++ ++ /* The next few lines of code parse out the filename and header from the input string */ ++ if (data == NULL) ++ { ++ /* No data implies no filename or anything is present */ ++ ast_log(LOG_WARNING, "Txfax requires an argument (filename)\n"); ++ return -1; ++ } ++ ++ calling_party = FALSE; ++ verbose = FALSE; ++ source_file[0] = '\0'; ++ ++ for (option = 0, v = s = data; v; option++, s++) ++ { ++ t = s; ++ v = strchr(s, '|'); ++ s = (v) ? v : s + strlen(s); ++ strncpy((char *) buf, t, s - t); ++ buf[s - t] = '\0'; ++ if (option == 0) ++ { ++ /* The first option is always the file name */ ++ len = s - t; ++ if (len > 255) ++ len = 255; ++ strncpy(source_file, t, len); ++ source_file[len] = '\0'; ++ } ++ else if (strncmp("caller", t, s - t) == 0) ++ { ++ calling_party = TRUE; ++ } ++ else if (strncmp("debug", t, s - t) == 0) ++ { ++ verbose = TRUE; ++ } ++ } ++ ++ /* Done parsing */ ++ ++ u = ast_module_user_add(chan); ++ ++ if (chan->_state != AST_STATE_UP) ++ { ++ /* Shouldn't need this, but checking to see if channel is already answered ++ * Theoretically asterisk should already have answered before running the app */ ++ res = ast_answer(chan); ++ } ++ ++ if (!res) ++ { ++ original_read_fmt = chan->readformat; ++ if (original_read_fmt != AST_FORMAT_SLINEAR) ++ { ++ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR); ++ if (res < 0) ++ { ++ ast_log(LOG_WARNING, "Unable to set to linear read mode, giving up\n"); ++ return -1; ++ } ++ } ++ original_write_fmt = chan->writeformat; ++ if (original_write_fmt != AST_FORMAT_SLINEAR) ++ { ++ res = ast_set_write_format(chan, AST_FORMAT_SLINEAR); ++ if (res < 0) ++ { ++ ast_log(LOG_WARNING, "Unable to set to linear write mode, giving up\n"); ++ res = ast_set_read_format(chan, original_read_fmt); ++ if (res) ++ ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", chan->name); ++ return -1; ++ } ++ } ++ fax_init(&fax, calling_party); ++ if (verbose) ++ fax.logging.level = SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW; ++ ++ x = pbx_builtin_getvar_helper(chan, "LOCALSTATIONID"); ++ if (x && x[0]) ++ t30_set_local_ident(&fax.t30_state, x); ++ x = pbx_builtin_getvar_helper(chan, "LOCALHEADERINFO"); ++ if (x && x[0]) ++ t30_set_header_info(&fax.t30_state, x); ++ t30_set_tx_file(&fax.t30_state, source_file, -1, -1); ++ //t30_set_phase_b_handler(&fax.t30_state, phase_b_handler, chan); ++ //t30_set_phase_d_handler(&fax.t30_state, phase_d_handler, chan); ++ t30_set_phase_e_handler(&fax.t30_state, phase_e_handler, chan); ++ t30_set_ecm_capability(&fax.t30_state, TRUE); ++ t30_set_supported_compressions(&fax.t30_state, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); ++ while (ast_waitfor(chan, -1) > -1) ++ { ++ inf = ast_read(chan); ++ if (inf == NULL) ++ { ++ res = -1; ++ break; ++ } ++ if (inf->frametype == AST_FRAME_VOICE) ++ { ++ if (fax_rx(&fax, inf->data, inf->samples)) ++ break; ++ samples = (inf->samples <= MAX_BLOCK_SIZE) ? inf->samples : MAX_BLOCK_SIZE; ++ len = fax_tx(&fax, (int16_t *) &buf[AST_FRIENDLY_OFFSET], samples); ++ if (len) ++ { ++ memset(&outf, 0, sizeof(outf)); ++ outf.frametype = AST_FRAME_VOICE; ++ outf.subclass = AST_FORMAT_SLINEAR; ++ outf.datalen = len*sizeof(int16_t); ++ outf.samples = len; ++ outf.data = &buf[AST_FRIENDLY_OFFSET]; ++ outf.offset = AST_FRIENDLY_OFFSET; ++ if (ast_write(chan, &outf) < 0) ++ { ++ ast_log(LOG_WARNING, "Unable to write frame to channel; %s\n", strerror(errno)); ++ break; ++ } ++ } ++ } ++ ast_frfree(inf); ++ } ++ if (inf == NULL) ++ { ++ ast_log(LOG_DEBUG, "Got hangup\n"); ++ res = -1; ++ } ++ if (original_read_fmt != AST_FORMAT_SLINEAR) ++ { ++ res = ast_set_read_format(chan, original_read_fmt); ++ if (res) ++ ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", chan->name); ++ } ++ if (original_write_fmt != AST_FORMAT_SLINEAR) ++ { ++ res = ast_set_write_format(chan, original_write_fmt); ++ if (res) ++ ast_log(LOG_WARNING, "Unable to restore write format on '%s'\n", chan->name); ++ } ++ t30_terminate(&fax.t30_state); ++ } ++ else ++ { ++ ast_log(LOG_WARNING, "Could not answer channel '%s'\n", chan->name); ++ } ++ ast_module_user_remove(u); ++ return res; ++} ++/*- End of function --------------------------------------------------------*/ ++ ++static int unload_module(void) ++{ ++ int res; ++ ++ ast_module_user_hangup_all(); ++ ++ res = ast_unregister_application(app); ++ ++ ++ return res; ++} ++/*- End of function --------------------------------------------------------*/ ++ ++static int load_module(void) ++{ ++ return ast_register_application(app, txfax_exec, synopsis, descrip); ++} ++/*- End of function --------------------------------------------------------*/ ++ ++AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Trivial FAX Transmit Application"); ++ ++/*- End of file ------------------------------------------------------------*/ +diff -Nru asterisk-1.4.5.org/build_tools/menuselect-deps.in asterisk-1.4.5/build_tools/menuselect-deps.in +--- asterisk-1.4.5.org/build_tools/menuselect-deps.in 2007-03-16 00:53:26.000000000 +0100 ++++ asterisk-1.4.5/build_tools/menuselect-deps.in 2007-06-22 09:05:59.000000000 +0200 +@@ -21,6 +21,7 @@ + PRI=@PBX_PRI@ + QT=@PBX_QT@ + RADIUS=@PBX_RADIUS@ ++SPANDSP=@PBX_SPANDSP@ + SPEEX=@PBX_SPEEX@ + SQLITE=@PBX_SQLITE@ + SSL=@PBX_OPENSSL@ +diff -Nru asterisk-1.4.5.org/configure.ac asterisk-1.4.5/configure.ac +--- asterisk-1.4.5.org/configure.ac 2007-06-04 18:02:31.000000000 +0200 ++++ asterisk-1.4.5/configure.ac 2007-06-22 09:05:59.000000000 +0200 +@@ -195,6 +195,7 @@ + AST_EXT_LIB_SETUP([OPENH323], [OpenH323], [h323]) + AST_EXT_LIB_SETUP([QT], [Qt], [qt]) + AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius]) ++AST_EXT_LIB_SETUP([SPANDSP], [spandsp Library], [spandsp]) + AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex]) + AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite]) + AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv]) +@@ -896,6 +897,8 @@ + + AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h]) + ++AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [fax_init], [spandsp.h], [-ltiff -ljpeg -lz]) ++ + AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm]) + + AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h]) +diff -Nru asterisk-1.4.5.org/include/asterisk/plc.h asterisk-1.4.5/include/asterisk/plc.h +--- asterisk-1.4.5.org/include/asterisk/plc.h 2006-06-14 16:12:56.000000000 +0200 ++++ asterisk-1.4.5/include/asterisk/plc.h 2007-06-22 09:07:42.000000000 +0200 +@@ -1,18 +1,17 @@ +-/*! \file +- * \brief SpanDSP - a series of DSP components for telephony ++/* ++ * SpanDSP - a series of DSP components for telephony + * + * plc.h + * +- * \author Steve Underwood ++ * Written by Steve Underwood + * + * Copyright (C) 2004 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. ++ * it under the terms of the GNU General Public License version 2, as ++ * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of +@@ -23,37 +22,36 @@ + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * +- * This version may be optionally licenced under the GNU LGPL licence. +- * +- * A license has been granted to Digium (via disclaimer) for the use of +- * this code. ++ * $Id: plc.h,v 1.15 2007/04/08 08:16:18 steveu Exp $ + */ + ++/*! \file */ + +-#if !defined(_PLC_H_) +-#define _PLC_H_ +- +-#ifdef SOLARIS +-#include +-#else +-#if defined(__OpenBSD__) || defined( __FreeBSD__) +-#include +-#else +-#include +-#endif +-#endif ++#if !defined(_SPANDSP_PLC_H_) ++#define _SPANDSP_PLC_H_ + + /*! \page plc_page Packet loss concealment + \section plc_page_sec_1 What does it do? +-The packet loss concealment module provides a suitable synthetic fill-in signal, +-to minimise the audible effect of lost packets in VoIP applications. It is not +-tied to any particular codec, and could be used with almost any codec which does not ++The packet loss concealment module provides a synthetic fill-in signal, to minimise ++the audible effect of lost packets in VoIP applications. It is not tied to any ++particular codec, and could be used with almost any codec which does not + specify its own procedure for packet loss concealment. + +-Where a codec specific concealment procedure exists, the algorithm is usually built ++Where a codec specific concealment procedure exists, that algorithm is usually built + around knowledge of the characteristics of the particular codec. It will, therefore, + generally give better results for that particular codec than this generic concealer will. + ++The PLC code implements an algorithm similar to the one described in Appendix 1 of G.711. ++However, the G.711 algorithm is optimised for 10ms packets. Few people use such small ++packets. 20ms is a much more common value, and longer packets are also quite common. The ++algorithm has been adjusted with this in mind. Also, the G.711 approach causes an ++algorithmic delay, and requires significant buffer manipulation when there is no packet ++loss. The algorithm used here avoids this. It causes no delay, and achieves comparable ++quality with normal speech. ++ ++Note that both this algorithm, and the one in G.711 are optimised for speech. For most kinds ++of music a much slower decay on bursts of lost packets give better results. ++ + \section plc_page_sec_2 How does it work? + While good packets are being received, the plc_rx() routine keeps a record of the trailing + section of the known speech signal. If a packet is missed, plc_fillin() is called to produce +@@ -83,7 +81,7 @@ + correct steadily fall. Therefore, the volume of the synthesized signal is made to decay + linearly, such that after 50ms of missing audio it is reduced to silence. + +-- When real speech resumes, an extra 1/4 pitch period of sythetic speech is blended with the ++- When real speech resumes, an extra 1/4 pitch period of synthetic speech is blended with the + start of the real speech. If the erasure is small, this smoothes the transition. If the erasure + is long, and the synthetic signal has faded to zero, the blending softens the start up of the + real signal, avoiding a kind of "click" or "pop" effect that might occur with a sudden onset. +@@ -110,6 +108,9 @@ + the pitch assessment. */ + #define PLC_HISTORY_LEN (CORRELATION_SPAN + PLC_PITCH_MIN) + ++/*! ++ The generic packet loss concealer context. ++*/ + typedef struct + { + /*! Consecutive erased samples */ +@@ -127,12 +128,13 @@ + } plc_state_t; + + +-#ifdef __cplusplus +-extern "C" { ++#if defined(__cplusplus) ++extern "C" ++{ + #endif + +-/*! Process a block of received audio samples. +- \brief Process a block of received audio samples. ++/*! Process a block of received audio samples for PLC. ++ \brief Process a block of received audio samples for PLC. + \param s The packet loss concealer context. + \param amp The audio sample buffer. + \param len The number of samples in the buffer. +@@ -147,13 +149,18 @@ + \return The number of samples synthesized. */ + int plc_fillin(plc_state_t *s, int16_t amp[], int len); + +-/*! Process a block of received V.29 modem audio samples. +- \brief Process a block of received V.29 modem audio samples. ++/*! Initialise a packet loss concealer context. ++ \brief Initialise a PLC context. + \param s The packet loss concealer context. +- \return A pointer to the he packet loss concealer context. */ ++ \return A pointer to the the packet loss concealer context. */ + plc_state_t *plc_init(plc_state_t *s); + +-#ifdef __cplusplus ++/*! Free a packet loss concealer context. ++ \param s The packet loss concealer context. ++ \return 0 for OK. */ ++int plc_release(plc_state_t *s); ++ ++#if defined(__cplusplus) + } + #endif + +diff -Nru asterisk-1.4.5.org/makeopts.in asterisk-1.4.5/makeopts.in +--- asterisk-1.4.5.org/makeopts.in 2007-05-25 16:28:46.000000000 +0200 ++++ asterisk-1.4.5/makeopts.in 2007-06-22 09:05:59.000000000 +0200 +@@ -138,6 +138,9 @@ + RADIUS_INCLUDE=@RADIUS_INCLUDE@ + RADIUS_LIB=@RADIUS_LIB@ + ++SPANDSP_INCLUDE=@SPANDSP_INCLUDE@ ++SPANDSP_LIB=@SPANDSP_LIB@ ++ + SPEEX_INCLUDE=@SPEEX_INCLUDE@ + SPEEX_LIB=@SPEEX_LIB@ + diff --git a/net/asterisk-1.4.x/patches/016-iksemel-configure_ac.patch b/net/asterisk-1.4.x/patches/016-iksemel-configure_ac.patch new file mode 100644 index 000000000..f660857c8 --- /dev/null +++ b/net/asterisk-1.4.x/patches/016-iksemel-configure_ac.patch @@ -0,0 +1,12 @@ +diff -Nru asterisk-1.4.5.org/configure.ac asterisk-1.4.5/configure.ac +--- asterisk-1.4.5.org/configure.ac 2007-06-04 18:02:31.000000000 +0200 ++++ asterisk-1.4.5/configure.ac 2007-06-22 09:09:03.000000000 +0200 +@@ -419,7 +419,7 @@ + fi + fi + +-AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h]) ++AST_EXT_LIB_CHECK([IKSEMEL], [iksemel], [iks_start_sasl], [iksemel.h], [-lgnutls -lgcrypt -lgpg-error]) + + if test "${PBX_IKSEMEL}" = 1; then + AST_EXT_LIB_CHECK([GNUTLS], [gnutls], [gnutls_bye], [gnutls/gnutls.h], [-lz -lgcrypt -lgpg-error]) diff --git a/net/asterisk-1.4.x/patches/017-Makefile-no_march.patch b/net/asterisk-1.4.x/patches/017-Makefile-no_march.patch new file mode 100644 index 000000000..b7fa811fa --- /dev/null +++ b/net/asterisk-1.4.x/patches/017-Makefile-no_march.patch @@ -0,0 +1,12 @@ +diff -Nru asterisk-1.4.5.org/Makefile asterisk-1.4.5/Makefile +--- asterisk-1.4.5.org/Makefile 2007-05-24 21:05:08.000000000 +0200 ++++ asterisk-1.4.5/Makefile 2007-06-22 09:10:18.000000000 +0200 +@@ -200,7 +200,7 @@ + endif + + ifneq ($(PROC),ultrasparc) +- ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi) ++ #ASTCFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi) + endif + + ifeq ($(PROC),ppc) diff --git a/net/asterisk-1.4.x/patches/023-autoconf-chan_h323.patch b/net/asterisk-1.4.x/patches/023-autoconf-chan_h323.patch new file mode 100644 index 000000000..92f1a2dab --- /dev/null +++ b/net/asterisk-1.4.x/patches/023-autoconf-chan_h323.patch @@ -0,0 +1,23 @@ +diff -ruN asterisk-1.4.9-old/acinclude.m4 asterisk-1.4.9-new/acinclude.m4 +--- asterisk-1.4.9-old/acinclude.m4 2007-09-04 17:20:27.000000000 +0200 ++++ asterisk-1.4.9-new/acinclude.m4 2007-09-04 17:17:04.000000000 +0200 +@@ -496,6 +496,7 @@ + ;; + esac + AC_MSG_RESULT(${OPENH323_BUILD}) ++ OPENH323_SUFFIX="n_s" + + AC_SUBST([OPENH323_SUFFIX]) + AC_SUBST([OPENH323_BUILD]) +diff -ruN asterisk-1.4.9-old/configure.ac asterisk-1.4.9-new/configure.ac +--- asterisk-1.4.9-old/configure.ac 2007-09-04 17:20:27.000000000 +0200 ++++ asterisk-1.4.9-new/configure.ac 2007-09-04 17:22:08.000000000 +0200 +@@ -807,7 +807,7 @@ + if test "${HAS_PWLIB:-unset}" != "unset"; then + AST_CHECK_OPENH323_PLATFORM() + +- PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r" ++ PLATFORM_PWLIB="pt_${PWLIB_PLATFORM}_r_s" + + AST_CHECK_PWLIB_BUILD([PWLib], [PWLIB], + [Define if your system has the PWLib libraries.], diff --git a/net/asterisk-1.4.x/patches/026-gsm-mips.patch b/net/asterisk-1.4.x/patches/026-gsm-mips.patch new file mode 100644 index 000000000..8291ef26a --- /dev/null +++ b/net/asterisk-1.4.x/patches/026-gsm-mips.patch @@ -0,0 +1,30 @@ +diff -Nru asterisk-1.4.5.org/codecs/gsm/Makefile asterisk-1.4.5/codecs/gsm/Makefile +--- asterisk-1.4.5.org/codecs/gsm/Makefile 2007-02-17 01:31:42.000000000 +0100 ++++ asterisk-1.4.5/codecs/gsm/Makefile 2007-06-22 09:13:13.000000000 +0200 +@@ -38,7 +38,7 @@ + ######### probably require gcc. + + ifeq (, $(findstring $(OSARCH) , Darwin SunOS )) +-ifeq (, $(findstring $(PROC) , x86_64 amd64 ultrasparc sparc64 arm armv5b armeb ppc powerpc ppc64 ia64 s390 bfin mipsel )) ++ifeq (, $(findstring $(PROC) , x86_64 amd64 ultrasparc sparc64 arm armv5b armeb ppc powerpc ppc64 ia64 s390 bfin mipsel mips )) + ifeq (, $(findstring $(shell uname -m) , ppc ppc64 alpha armv4l s390 )) + OPTIMIZE+=-march=$(PROC) + endif +@@ -209,7 +209,7 @@ + # XXX should merge with GSM_OBJECTS + ifeq ($(OSARCH),linux-gnu) + ifeq (,$(findstring $(shell uname -m) , x86_64 amd64 ppc ppc64 alpha armv4l sparc64 parisc s390 )) +-ifeq (,$(findstring $(PROC) , arm armv5b armeb powerpc ia64 s390 bfin mipsel )) ++ifeq (,$(findstring $(PROC) , arm armv5b armeb powerpc ia64 s390 bfin mipsel mips )) + GSM_SOURCES+= $(SRC)/k6opt.s + endif + endif +@@ -261,7 +261,7 @@ + + ifeq ($(OSARCH),linux-gnu) + ifeq (,$(findstring $(shell uname -m) , x86_64 amd64 ppc ppc64 alpha armv4l sparc64 parisc )) +-ifeq (,$(findstring $(PROC) , arm armv5b armeb powerpc ia64 bfin mipsel )) ++ifeq (,$(findstring $(PROC) , arm armv5b armeb powerpc ia64 bfin mipsel mips )) + GSM_OBJECTS+= $(SRC)/k6opt.o + endif + endif -- 2.30.2