diff options
Diffstat (limited to 'openwrt/package/asterisk')
13 files changed, 1917 insertions, 0 deletions
diff --git a/openwrt/package/asterisk/Config.in b/openwrt/package/asterisk/Config.in new file mode 100644 index 0000000000..7cf258cc10 --- /dev/null +++ b/openwrt/package/asterisk/Config.in @@ -0,0 +1,48 @@ +config BR2_PACKAGE_ASTERISK + tristate "Asterisk" + default m + help + 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. + +config BR2_PACKAGE_ASTERISK_SPEEX + tristate "Speex codec" + default m + depends BR2_PACKAGE_ASTERISK + select BR2_PACKAGE_SPEEX + help + The Speex speech compression codec for Asterisk + + +config BR2_PACKAGE_ASTERISK_MYSQL + tristate "MySQL plugins" + default m + depends BR2_PACKAGE_ASTERISK + select BR2_PACKAGE_LIBMYSQLCLIENT + help + MySQL plugins for Asterisk + +config BR2_PACKAGE_ASTERISK_PGSQL + tristate "PostgreSQL plugins" + default m + depends BR2_PACKAGE_ASTERISK + select BR2_PACKAGE_LIBPQ + help + PostgreSQL plugins for Asterisk + +config BR2_PACKAGE_ASTERISK_VOICEMAIL + tristate "Voicemail support" + default m + depends BR2_PACKAGE_ASTERISK + help + Voicemail related plugins for Asterisk + +config BR2_PACKAGE_ASTERISK_SOUNDS + tristate "Sound files" + default m + depends BR2_PACKAGE_ASTERISK + help + Sound files for Asterisk + diff --git a/openwrt/package/asterisk/Makefile b/openwrt/package/asterisk/Makefile new file mode 100644 index 0000000000..169e3915d8 --- /dev/null +++ b/openwrt/package/asterisk/Makefile @@ -0,0 +1,208 @@ +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=asterisk +PKG_VERSION:=1.0.7 +PKG_RELEASE:=1 +PKG_MD5SUM:=4cc3c1e4a1b12e0e4c748326ad153291 + +PKG_SOURCE_URL:=http://www.asterisk.org/html/downloads ftp://ftp.asterisk.org/pub/asterisk +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_CAT:=zcat + +PKG_APP:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk +PKG_APP_DIR:=$(PKG_BUILD_DIR)/ipkg/asterisk + +PKG_MYSQL:=$(PACKAGE_DIR)/$(PKG_NAME)-mysql_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk +PKG_MYSQL_DIR:=$(PKG_BUILD_DIR)/ipkg/mysql + +PKG_PGSQL:=$(PACKAGE_DIR)/$(PKG_NAME)-pgsql_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk +PKG_PGSQL_DIR:=$(PKG_BUILD_DIR)/ipkg/pgsql + +PKG_SPEEX:=$(PACKAGE_DIR)/$(PKG_NAME)-codec-speex_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk +PKG_SPEEX_DIR:=$(PKG_BUILD_DIR)/ipkg/speex + +PKG_SOUNDS:=$(PACKAGE_DIR)/$(PKG_NAME)-sounds_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk +PKG_SOUNDS_DIR:=$(PKG_BUILD_DIR)/ipkg/sounds + +PKG_VOICEMAIL:=$(PACKAGE_DIR)/$(PKG_NAME)-voicemail_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk +PKG_VOICEMAIL_DIR:=$(PKG_BUILD_DIR)/ipkg/voicemail + +APPS:= +MODS:= +COMPILE_TARGETS:=$(PKG_APP) +INSTALL_TARGETS:=$(IPKG_STATE_DIR)/info/$(PKG_NAME).list +ifneq ($(BR2_PACKAGE_ASTERISK_MYSQL),) +APPS += app_sql_mysql.so +MODS += cdr_mysql.so +COMPILE_TARGETS += $(PKG_MYSQL) +endif +ifneq ($(BR2_PACKAGE_ASTERISK_PGSQL),) +APPS += app_sql_postgres.so +MODS += cdr_pgsql.so +COMPILE_TARGETS += $(PKG_PGSQL) +endif +ifneq ($(BR2_PACKAGE_ASTERISK_SOUNDS),) +COMPILE_TARGETS += $(PKG_SOUNDS) +endif +ifneq ($(BR2_PACKAGE_ASTERISK_SPEEX),) +SPEEX:=codec_speex.so +COMPILE_TARGETS += $(PKG_SPEEX) +endif +ifneq ($(BR2_PACKAGE_ASTERISK_VOICEMAIL),) +COMPILE_TARGETS += $(PKG_VOICEMAIL) +endif +ifeq ($(BR2_PACKAGE_ASTERISK_MYSQL),y) +INSTALL_TARGETS:=$(IPKG_STATE_DIR)/info/$(PKG_NAME)-mysql.list +endif +ifeq ($(BR2_PACKAGE_ASTERISK_PGSQL),y) +INSTALL_TARGETS:=$(IPKG_STATE_DIR)/info/$(PKG_NAME)-pgsql.list +endif +ifeq ($(BR2_PACKAGE_ASTERISK_VOICEMAIL),y) +INSTALL_TARGETS:=$(IPKG_STATE_DIR)/info/$(PKG_NAME)-voicemail.list +endif +ifeq ($(BR2_PACKAGE_ASTERISK_SOUNDS),y) +INSTALL_TARGETS:=$(IPKG_STATE_DIR)/info/$(PKG_NAME)-sounds.list +endif +ifeq ($(BR2_PACKAGE_ASTERISK_SPEEX),y) +INSTALL_TARGETS:=$(IPKG_STATE_DIR)/info/$(PKG_NAME)-codec-speex.list +endif + +$(DL_DIR)/$(PKG_SOURCE): + $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL) + +$(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE) + $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - + $(PATCH) $(PKG_BUILD_DIR) ./patches + touch $(PKG_BUILD_DIR)/.patched + + +asterisk-compile: $(PKG_BUILD_DIR)/.patched + $(MAKE) -C "$(PKG_BUILD_DIR)/channels" \ + CC="$(HOSTCC)" \ + gentone + $(MAKE) -C "$(PKG_BUILD_DIR)" \ + CC_FOR_BUILD="$(HOSTCC)" \ + $(TARGET_CONFIGURE_OPTS) \ + OPTIMIZE="$(TARGET_CFLAGS)" \ + PROC="$(ARCH)" \ + CFLAGS_EXTRA="-I$(STAGING_DIR)/usr/include" \ + LDFLAGS_EXTRA="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/usr/lib/mysql" \ + CRYPTO_LIBS="-L$(STAGING_DIR)/usr/lib -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic" \ + EXTRA_APPS="$(APPS)" \ + EXTRA_MODS="$(MODS)" \ + MODSPEEX="$(SPEEX)" + +$(PKG_APP): asterisk-compile + $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_APP_DIR) control/$(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_APP_DIR)" \ + install samples + rm -rf $(PKG_APP_DIR)/usr/sbin/astgenkey + rm -rf $(PKG_APP_DIR)/usr/bin + rm -rf $(PKG_APP_DIR)/usr/share + rm -rf $(PKG_APP_DIR)/usr/include + rm -rf $(PKG_APP_DIR)/var + (cd $(PKG_APP_DIR)/usr/lib/asterisk; \ + rm -rf agi-bin/*; \ + rm -rf firmware; \ + rm -rf images; \ + rm -rf keys/*; \ + rm -rf mohmp3; \ + rm -rf sounds/*; \ + cd modules; \ + rm -rf *adsi* *festival* *modem* *meetme* *oss* *phone* *intercom* \ + *mp3* *nbscat* *mysql* *postgres* *pgsql* *voicemail* *speex* \ + *musiconhold* *zapateller* *jpeg*; \ + ) + (cd $(PKG_APP_DIR)/etc/asterisk; \ + rm -f *odbc* *mysql* *postgres* *pgsql* *voicemail* *adsi* *oss* *alsa* \ + *festival* *modem* *meetme* *phone* *tds* *vofr* *rpt* *vpb* \ + *zapata* *musiconhold*; \ + ) + -$(STRIP) $(PKG_APP_DIR)/usr/sbin/asterisk + -$(STRIP) $(PKG_APP_DIR)/usr/lib/asterisk/modules/* + cp -a ./files/* $(PKG_APP_DIR)/ + find $(PKG_APP_DIR) -name CVS | xargs rm -rf + chmod +x $(PKG_APP_DIR)/etc/init.d/* + mkdir -p $(PACKAGE_DIR) + $(IPKG_BUILD) $(PKG_APP_DIR) $(PACKAGE_DIR) + +$(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_APP) + $(IPKG) install $(PKG_APP) + +$(PKG_MYSQL): asterisk-compile + $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_MYSQL_DIR) control/$(PKG_NAME)-mysql.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) + mkdir -p $(PKG_MYSQL_DIR)/usr/lib/asterisk/modules + mkdir -p $(PKG_MYSQL_DIR)/etc/asterisk + cp $(PKG_BUILD_DIR)/apps/app_sql_mysql.so $(PKG_MYSQL_DIR)/usr/lib/asterisk/modules/ + cp $(PKG_BUILD_DIR)/cdr/cdr_mysql.so $(PKG_MYSQL_DIR)/usr/lib/asterisk/modules/ + $(STRIP) $(PKG_MYSQL_DIR)/usr/lib/asterisk/modules/* + echo /etc/asterisk/cdr_mysql.conf > $(PKG_MYSQL_DIR)/CONTROL/conffiles + cp $(PKG_BUILD_DIR)/configs/cdr_mysql.conf.sample $(PKG_MYSQL_DIR)/etc/asterisk/cdr_mysql.conf + mkdir -p $(PACKAGE_DIR) + $(IPKG_BUILD) $(PKG_MYSQL_DIR) $(PACKAGE_DIR) + +$(IPKG_STATE_DIR)/info/$(PKG_NAME)-mysql.list: $(PKG_MYSQL) + $(IPKG) install $(PKG_MYSQL) + +$(PKG_PGSQL): asterisk-compile + $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_PGSQL_DIR) control/$(PKG_NAME)-pgsql.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) + mkdir -p $(PKG_PGSQL_DIR)/usr/lib/asterisk/modules + mkdir -p $(PKG_PGSQL_DIR)/etc/asterisk + cp $(PKG_BUILD_DIR)/apps/app_sql_postgres.so $(PKG_PGSQL_DIR)/usr/lib/asterisk/modules/ + cp $(PKG_BUILD_DIR)/cdr/cdr_pgsql.so $(PKG_PGSQL_DIR)/usr/lib/asterisk/modules/ + $(STRIP) $(PKG_PGSQL_DIR)/usr/lib/asterisk/modules/* + echo /etc/asterisk/cdr_pgsql.conf > $(PKG_PGSQL_DIR)/CONTROL/conffiles + cp $(PKG_BUILD_DIR)/configs/cdr_pgsql.conf.sample $(PKG_PGSQL_DIR)/etc/asterisk/cdr_pgsql.conf + mkdir -p $(PACKAGE_DIR) + $(IPKG_BUILD) $(PKG_PGSQL_DIR) $(PACKAGE_DIR) + +$(IPKG_STATE_DIR)/info/$(PKG_NAME)-pgsql.list: $(PKG_PGSQL) + $(IPKG) install $(PKG_PGSQL) + +$(PKG_SOUNDS): asterisk-compile + $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_SOUNDS_DIR) control/$(PKG_NAME)-sounds.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) + mkdir -p $(PKG_SOUNDS_DIR)/usr/lib/asterisk/sounds + cp -a $(PKG_BUILD_DIR)/sounds/* $(PKG_SOUNDS_DIR)/usr/lib/asterisk/sounds/ + mkdir -p $(PACKAGE_DIR) + $(IPKG_BUILD) $(PKG_SOUNDS_DIR) $(PACKAGE_DIR) + +$(IPKG_STATE_DIR)/info/$(PKG_NAME)-sounds.list: $(PKG_SOUNDS) + $(IPKG) install $(PKG_SOUNDS) + +$(PKG_SPEEX): asterisk-compile + $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_SPEEX_DIR) control/$(PKG_NAME)-codec-speex.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) + mkdir -p $(PKG_SPEEX_DIR)/usr/lib/asterisk/modules + cp $(PKG_BUILD_DIR)/codecs/*speex.so $(PKG_SPEEX_DIR)/usr/lib/asterisk/modules + $(STRIP) $(PKG_SPEEX_DIR)/usr/lib/asterisk/modules/* + mkdir -p $(PACKAGE_DIR) + $(IPKG_BUILD) $(PKG_SPEEX_DIR) $(PACKAGE_DIR) + +$(IPKG_STATE_DIR)/info/$(PKG_NAME)-speex.list: $(PKG_SPEEX) + $(IPKG) install $(PKG_SPEEX) + +$(PKG_VOICEMAIL): asterisk-compile + $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_VOICEMAIL_DIR) control/$(PKG_NAME)-voicemail.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH) + echo /etc/asterisk/voicemail.conf > $(PKG_VOICEMAIL_DIR)/CONTROL/conffiles + mkdir -p $(PKG_VOICEMAIL_DIR)/etc/asterisk + cp $(PKG_BUILD_DIR)/configs/voicemail.conf.sample $(PKG_VOICEMAIL_DIR)/etc/asterisk/voicemail.conf + mkdir -p $(PKG_VOICEMAIL_DIR)/usr/lib/asterisk/modules + cp $(PKG_BUILD_DIR)/apps/*voicemail.so $(PKG_VOICEMAIL_DIR)/usr/lib/asterisk/modules + $(STRIP) $(PKG_VOICEMAIL_DIR)/usr/lib/asterisk/modules/* + mkdir -p $(PACKAGE_DIR) + $(IPKG_BUILD) $(PKG_VOICEMAIL_DIR) $(PACKAGE_DIR) + +$(IPKG_STATE_DIR)/info/$(PKG_NAME)-voicemail.list: $(PKG_VOICEMAIL) + $(IPKG) install $(PKG_VOICEMAIL) + +source: $(DL_DIR)/$(PKG_SOURCE) +prepare: $(PKG_BUILD_DIR)/.patched +compile: $(COMPILE_TARGETS) +install: $(INSTALL_TARGETS) + +clean: + rm -rf $(PKG_BUILD_DIR) + rm -f $(PKG_APP) diff --git a/openwrt/package/asterisk/control/asterisk-codec-speex.control b/openwrt/package/asterisk/control/asterisk-codec-speex.control new file mode 100644 index 0000000000..24ef1c7f28 --- /dev/null +++ b/openwrt/package/asterisk/control/asterisk-codec-speex.control @@ -0,0 +1,7 @@ +Package: asterisk-codec-speex +Priority: optional +Section: net +Maintainer: Felix Fietkau <nbd@vd-s.ath.cx> +Source: buildroot internal +Description: a Speex/PCM16 Codec Translator for Asterisk +Depends: asterisk, libspeex diff --git a/openwrt/package/asterisk/control/asterisk-mysql.control b/openwrt/package/asterisk/control/asterisk-mysql.control new file mode 100644 index 0000000000..0eaa4719e5 --- /dev/null +++ b/openwrt/package/asterisk/control/asterisk-mysql.control @@ -0,0 +1,7 @@ +Package: asterisk-mysql +Priority: optional +Section: net +Maintainer: Felix Fietkau <nbd@vd-s.ath.cx> +Source: buildroot internal +Description: MySQL modules for Asterisk +Depends: asterisk, libmysqlclient, zlib diff --git a/openwrt/package/asterisk/control/asterisk-pgsql.control b/openwrt/package/asterisk/control/asterisk-pgsql.control new file mode 100644 index 0000000000..907d30a834 --- /dev/null +++ b/openwrt/package/asterisk/control/asterisk-pgsql.control @@ -0,0 +1,7 @@ +Package: asterisk-pgsql +Priority: optional +Section: net +Maintainer: Felix Fietkau <nbd@vd-s.ath.cx> +Source: buildroot internal +Description: PostgreSQL modules for Asterisk +Depends: asterisk, libpq, zlib diff --git a/openwrt/package/asterisk/control/asterisk-sounds.control b/openwrt/package/asterisk/control/asterisk-sounds.control new file mode 100644 index 0000000000..e297e582a7 --- /dev/null +++ b/openwrt/package/asterisk/control/asterisk-sounds.control @@ -0,0 +1,7 @@ +Package: asterisk-sounds +Priority: optional +Section: net +Maintainer: Felix Fietkau <nbd@vd-s.ath.cx> +Source: buildroot internal +Description: a sounds collection for Asterisk +Depends: asterisk diff --git a/openwrt/package/asterisk/control/asterisk-voicemail.control b/openwrt/package/asterisk/control/asterisk-voicemail.control new file mode 100644 index 0000000000..7614e890e7 --- /dev/null +++ b/openwrt/package/asterisk/control/asterisk-voicemail.control @@ -0,0 +1,7 @@ +Package: asterisk-voicemail +Priority: optional +Section: net +Maintainer: Felix Fietkau <nbd@vd-s.ath.cx> +Source: buildroot internal +Description: VoiceMail related modules for Asterisk +Depends: asterisk diff --git a/openwrt/package/asterisk/control/asterisk.control b/openwrt/package/asterisk/control/asterisk.control new file mode 100644 index 0000000000..ac2bf39d2e --- /dev/null +++ b/openwrt/package/asterisk/control/asterisk.control @@ -0,0 +1,6 @@ +Package: asterisk +Priority: optional +Section: net +Maintainer: Felix Fietkau <nbd@vd-s.ath.cx> +Source: buildroot internal +Description: An open source PBX diff --git a/openwrt/package/asterisk/files/CONTROL/conffiles b/openwrt/package/asterisk/files/CONTROL/conffiles new file mode 100644 index 0000000000..2f2314ed8f --- /dev/null +++ b/openwrt/package/asterisk/files/CONTROL/conffiles @@ -0,0 +1,22 @@ +/etc/asterisk/agents.conf +/etc/asterisk/alarmreceiver.conf +/etc/asterisk/asterisk.conf +/etc/asterisk/cdr_manager.conf +/etc/asterisk/enum.conf +/etc/asterisk/extconfig.conf +/etc/asterisk/extensions.conf +/etc/asterisk/features.conf +/etc/asterisk/iax.conf +/etc/asterisk/iaxprov.conf +/etc/asterisk/indications.conf +/etc/asterisk/logger.conf +/etc/asterisk/manager.conf +/etc/asterisk/mgcp.conf +/etc/asterisk/modules.conf +/etc/asterisk/osp.conf +/etc/asterisk/privacy.conf +/etc/asterisk/queues.conf +/etc/asterisk/rtp.conf +/etc/asterisk/sip.conf +/etc/asterisk/skinny.conf +/etc/default/asterisk diff --git a/openwrt/package/asterisk/files/etc/default/asterisk b/openwrt/package/asterisk/files/etc/default/asterisk new file mode 100644 index 0000000000..bbcb3cc86a --- /dev/null +++ b/openwrt/package/asterisk/files/etc/default/asterisk @@ -0,0 +1,4 @@ +## startup options for /etc/init.d/asterisk + +ENABLE_ASTERISK="no" +OPTIONS="" diff --git a/openwrt/package/asterisk/files/etc/init.d/S60asterisk b/openwrt/package/asterisk/files/etc/init.d/S60asterisk new file mode 100755 index 0000000000..698c3dfa82 --- /dev/null +++ b/openwrt/package/asterisk/files/etc/init.d/S60asterisk @@ -0,0 +1,23 @@ +#!/bin/sh + +DEFAULT=/etc/default/asterisk +OPTIONS="" +[ -f $DEFAULT ] && . $DEFAULT +[ "$ENABLE_ASTERISK" = "yes" ] || exit 0 + +case $1 in + start) + [ -d /var/run ] || mkdir -p /var/run + [ -d /var/log/asterisk ] || mkdir -p /var/log/asterisk + [ -d /var/spool/asterisk ] || mkdir -p /var/spool/asterisk + /usr/sbin/asterisk $OPTIONS + ;; + stop) + [ -f /var/run/asterisk.pid ] && kill $(cat /var/run/asterisk.pid) >/dev/null 2>&1 + ;; + *) + echo "usage: $0 (start|stop)" + exit 1 +esac + +exit $? diff --git a/openwrt/package/asterisk/patches/makefiles.diff b/openwrt/package/asterisk/patches/makefiles.diff new file mode 100644 index 0000000000..973b8c704c --- /dev/null +++ b/openwrt/package/asterisk/patches/makefiles.diff @@ -0,0 +1,547 @@ +diff -ruN asterisk-1.0.7-orig/Makefile asterisk-1.0.7-2/Makefile +--- asterisk-1.0.7-orig/Makefile 2005-03-10 09:15:05.000000000 +0100 ++++ asterisk-1.0.7-2/Makefile 2005-03-19 17:38:06.000000000 +0100 +@@ -63,10 +63,10 @@ + #K6OPT = -DK6OPT + + #Tell gcc to optimize the asterisk's code +-OPTIMIZE+=-O6 ++#OPTIMIZE+=-O6 + + #Include debug symbols in the executables (-g) and profiling info (-pg) +-DEBUG=-g #-pg ++#DEBUG=-g #-pg + + # If you are running a radio application, define RADIO_RELAX so that the DTMF + # will be received more reliably +@@ -74,7 +74,7 @@ + + # If you don't have a lot of memory (e.g. embedded Asterisk), uncomment the + # following to reduce the size of certain static buffers +-#OPTIONS += -DLOW_MEMORY ++OPTIONS += -DLOW_MEMORY + + # Optional debugging parameters + DEBUG_THREADS = #-DDEBUG_THREADS #-DDO_CRASH +@@ -112,7 +112,7 @@ + BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE + + ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk +-ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk ++ASTVARLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk + ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk + ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk + ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk +@@ -128,7 +128,7 @@ + + INCLUDE=-Iinclude -I../include + CFLAGS=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY +-CFLAGS+=$(OPTIMIZE) ++CFLAGS+=$(OPTIMIZE) $(CFLAGS_EXTRA) + + ifneq ($(PROC),ultrasparc) + CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi) +@@ -187,7 +187,7 @@ + CFLAGS+=# -fomit-frame-pointer + SUBDIRS=res channels pbx apps codecs formats agi cdr astman stdtime + ifeq (${OSARCH},Linux) +-LIBS=-ldl -lpthread ++LIBS=$(LDFLAGS_EXTRA) -ldl -lpthread + endif + LIBS+=-lncurses -lm + ifeq (${OSARCH},Linux) +@@ -205,7 +205,7 @@ + ifeq (${OSARCH},OpenBSD) + LIBS=-lcrypto -lpthread -lm -lncurses + endif +-LIBS+=-lssl ++LIBS+=-Wl,-Bstatic -lssl -Wl,-Bdynamic + 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 \ +@@ -240,12 +240,12 @@ + cd editline && unset CFLAGS LIBS && ./configure ; \ + + editline/libedit.a: FORCE +- cd editline && unset CFLAGS LIBS && test -f config.h || ./configure +- $(MAKE) -C editline libedit.a ++ cd editline && unset CFLAGS LIBS && test -f config.h || CFLAGS="$(OPTIMIZE) $(CFLAGS_EXTRA)" LDFLAGS="$(LDFLAGS_EXTRA)" ./configure ++ $(MAKE) PROC=$(PROC) CFLAGS="$(OPTIMIZE)" -C editline libedit.a + + db1-ast/libdb1.a: FORCE + @if [ -d db1-ast ]; then \ +- $(MAKE) -C db1-ast libdb1.a ; \ ++ $(MAKE) PROC=$(PROC) OORG="$(OPTIMIZE)" -C db1-ast libdb1.a ; \ + else \ + echo "You need to do a cvs update -d not just cvs update"; \ + exit 1; \ +@@ -289,7 +289,7 @@ + + stdtime/libtime.a: FORCE + @if [ -d stdtime ]; then \ +- $(MAKE) -C stdtime libtime.a ; \ ++ $(MAKE) PROC=$(PROC) -C stdtime libtime.a ; \ + else \ + echo "You need to do a cvs update -d not just cvs update"; \ + exit 1; \ +@@ -381,7 +381,7 @@ + if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \ + install -m 755 contrib/scripts/safe_asterisk $(DESTDIR)$(ASTSBINDIR)/ ;\ + fi +- for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done ++ for x in $(SUBDIRS); do $(MAKE) PROC=$(PROC) -C $$x install || exit 1 ; done + install -d $(DESTDIR)$(ASTHEADERDIR) + install -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR) + rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm +@@ -519,8 +519,8 @@ + __rpm: _version + rm -rf /tmp/asterisk ; \ + mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \ +- $(MAKE) DESTDIR=/tmp/asterisk install ; \ +- $(MAKE) DESTDIR=/tmp/asterisk samples ; \ ++ $(MAKE) PROC=$(PROC) DESTDIR=/tmp/asterisk install ; \ ++ $(MAKE) PROC=$(PROC) DESTDIR=/tmp/asterisk samples ; \ + mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \ + cp -f redhat/asterisk /tmp/asterisk/etc/rc.d/init.d/ ; \ + sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \ +@@ -544,12 +544,12 @@ + fi + + dont-optimize: +- $(MAKE) OPTIMIZE= K6OPT= install ++ $(MAKE) PROC=$(PROC) OPTIMIZE= K6OPT= install + + valgrind: dont-optimize + + depend: .depend +- for x in $(SUBDIRS); do $(MAKE) -C $$x depend || exit 1 ; done ++ for x in $(SUBDIRS); do $(MAKE) PROC=$(PROC) -C $$x depend || exit 1 ; done + + .depend: + @if ! which mpg123 &>/dev/null ; then \ +diff -ruN asterisk-1.0.7-orig/apps/Makefile asterisk-1.0.7-2/apps/Makefile +--- asterisk-1.0.7-orig/apps/Makefile 2004-09-24 23:32:56.000000000 +0200 ++++ asterisk-1.0.7-2/apps/Makefile 2005-03-19 17:38:06.000000000 +0100 +@@ -35,13 +35,14 @@ + APPS+=app_intercom.so + endif + +-#APPS+=app_sql_postgres.so ++# add extra apps ++APPS+=$(EXTRA_APPS) + #APPS+=app_sql_odbc.so + #APPS+=app_rpt.so + +-APPS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so" ; fi) +-APPS+=$(shell if [ -f /usr/local/include/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so" ; fi) +-APPS+=$(shell if [ -f /usr/include/osp/osp.h ]; then echo "app_osplookup.so" ; fi) ++#APPS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so" ; fi) ++#APPS+=$(shell if [ -f /usr/local/include/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so app_zapscan.so" ; fi) ++#APPS+=$(shell if [ -f /usr/include/osp/osp.h ]; then echo "app_osplookup.so" ; fi) + + CFLAGS+=-fPIC + +diff -ruN asterisk-1.0.7-orig/cdr/Makefile asterisk-1.0.7-2/cdr/Makefile +--- asterisk-1.0.7-orig/cdr/Makefile 2004-08-31 18:33:00.000000000 +0200 ++++ asterisk-1.0.7-2/cdr/Makefile 2005-03-19 17:38:06.000000000 +0100 +@@ -12,7 +12,7 @@ + # + + #ADD cdr_pgsql.so to MODS= to include PostgreSQL support: REQUIRES PostgreSQL libs +-MODS=cdr_csv.so cdr_manager.so ++MODS=cdr_csv.so cdr_manager.so $(EXTRA_MODS) + + + CFLAGS+=-fPIC +diff -ruN asterisk-1.0.7-orig/channels/Makefile asterisk-1.0.7-2/channels/Makefile +--- asterisk-1.0.7-orig/channels/Makefile 2004-08-31 18:33:00.000000000 +0200 ++++ asterisk-1.0.7-2/channels/Makefile 2005-03-19 17:38:06.000000000 +0100 +@@ -71,25 +71,25 @@ + CHANNEL_LIBS+=chan_oss.so + endif + +-CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so) +-CHANNEL_LIBS+=$(shell [ -f /usr/local/include/ixjuser.h ] && echo chan_phone.so) +-CHANNEL_LIBS+=$(shell [ -f h323/libchanh323.a ] && echo chan_h323.so) +- +-CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations +-CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API") +-CHANNEL_LIBS+=$(shell [ -f /usr/include/alsa/asoundlib.h ] && echo "chan_alsa.so") +-CFLAGS+=$(shell [ -f /usr/lib/libpri.so.1 ] && echo " -DZAPATA_PRI") +-CFLAGS+=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo " -DZAPATA_R2") +-CFLAGS+=$(shell [ -f alsa-monitor.h ] && echo " -DALSA_MONITOR") +-ZAPPRI=$(shell [ -f /usr/lib/libpri.so.1 ] && echo "-lpri") +-ZAPR2=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo "-lmfcr2") +-CFLAGS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "-DIAX_TRUNKING") +-CFLAGS+=$(shell [ -f /usr/local/include/zaptel.h ] && echo "-DIAX_TRUNKING") +-CHANNEL_LIBS+=$(shell [ -f /usr/include/vpbapi.h ] && echo "chan_vpb.so" ) +-CFLAGS+=$(shell [ -f /usr/include/vpbapi.h ] && echo " -DLINUX") ++#CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so) ++#CHANNEL_LIBS+=$(shell [ -f /usr/local/include/ixjuser.h ] && echo chan_phone.so) ++#CHANNEL_LIBS+=$(shell [ -f h323/libchanh323.a ] && echo chan_h323.so) ++ ++#CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations ++#CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API") ++#CHANNEL_LIBS+=$(shell [ -f /usr/include/alsa/asoundlib.h ] && echo "chan_alsa.so") ++#CFLAGS+=$(shell [ -f /usr/lib/libpri.so.1 ] && echo " -DZAPATA_PRI") ++#CFLAGS+=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo " -DZAPATA_R2") ++#CFLAGS+=$(shell [ -f alsa-monitor.h ] && echo " -DALSA_MONITOR") ++#ZAPPRI=$(shell [ -f /usr/lib/libpri.so.1 ] && echo "-lpri") ++#ZAPR2=$(shell [ -f /usr/lib/libmfcr2.so.1 ] && echo "-lmfcr2") ++#CFLAGS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "-DIAX_TRUNKING") ++#CFLAGS+=$(shell [ -f /usr/local/include/zaptel.h ] && echo "-DIAX_TRUNKING") ++#CHANNEL_LIBS+=$(shell [ -f /usr/include/vpbapi.h ] && echo "chan_vpb.so" ) ++#CFLAGS+=$(shell [ -f /usr/include/vpbapi.h ] && echo " -DLINUX") + +-ALSA_SRC=chan_alsa.c +-ALSA_SRC+=$(shell [ -f alsa-monitor.h ] && echo "alsa-monitor.h") ++#ALSA_SRC=chan_alsa.c ++#ALSA_SRC+=$(shell [ -f alsa-monitor.h ] && echo "alsa-monitor.h") + + CFLAGS+=-DCRYPTO + CFLAGS+=-fPIC +@@ -106,10 +106,10 @@ + + ZAPDIR=/usr/lib + +-CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "chan_zap.so") +-CHANNEL_LIBS+=$(shell [ -f /usr/local/include/zaptel.h ] && echo "chan_zap.so") ++#CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/zaptel.h ] && echo "chan_zap.so") ++#CHANNEL_LIBS+=$(shell [ -f /usr/local/include/zaptel.h ] && echo "chan_zap.so") + +-CHANNEL_LIBS+=$(shell [ -f /usr/include/nbs.h ] && echo "chan_nbs.so" ) ++#CHANNEL_LIBS+=$(shell [ -f /usr/include/nbs.h ] && echo "chan_nbs.so" ) + + ifndef OPENH323DIR + OPENH323DIR=$(HOME)/openh323 +diff -ruN asterisk-1.0.7-orig/channels/h323/Makefile asterisk-1.0.7-2/channels/h323/Makefile +--- asterisk-1.0.7-orig/channels/h323/Makefile 2004-11-15 03:35:35.000000000 +0100 ++++ asterisk-1.0.7-2/channels/h323/Makefile 2005-03-19 17:38:06.000000000 +0100 +@@ -22,9 +22,11 @@ + OSARCH=$(shell uname -s) + ifneq (${OSARCH},FreeBSD) + ifneq (${OSARCH},NetBSD) ++ifneq ($(PROC),mipsel) + CFLAGS += -march=$(shell uname -m) + endif + endif ++endif + CFLAGS += -DPBYTE_ORDER=PLITTLE_ENDIAN + + ifeq (${OSARCH},Linux) +@@ -47,7 +49,7 @@ + + # Pre Janus release directives + CFLAGS += -DNDEBUG -DDO_CRASH -DDEBUG_THREADS +-CFLAGS += -pipe -Wall -fPIC ++CFLAGS += -pipe -Wall -fPIC $(OPTIMIZE) + ifeq (${OSARCH},Linux) + CFLAGS += -DP_LINUX + LIBS+=-lpthread +@@ -74,7 +76,7 @@ + + + libchanh323.a: ast_h323.o +- ar cr libchanh323.a ast_h323.o ++ $(AR) cr libchanh323.a ast_h323.o + + ast_h323.o: ast_h323.cpp + $(CXX) -g -c -fno-rtti -o $@ $(CFLAGS) $< +diff -ruN asterisk-1.0.7-orig/codecs/Makefile asterisk-1.0.7-2/codecs/Makefile +--- asterisk-1.0.7-orig/codecs/Makefile 2005-03-17 15:43:51.000000000 +0100 ++++ asterisk-1.0.7-2/codecs/Makefile 2005-03-22 23:26:20.000000000 +0100 +@@ -17,21 +17,21 @@ + # 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") +-MODSPEEX=$(shell [ -f /usr/include/speex.h ] || [ -f /usr/include/speex/speex.h ] || [ -f /usr/local/include/speex.h ] || [ -f /usr/local/include/speex/speex.h ] && echo "codec_speex.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=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+=$(shell [ -f /usr/local/include/speex/speex.h ] && echo "-I/usr/local/include/speex") +-CFLAGS+=$(shell [ -f /usr/include/speex/speex.h ] && echo "-I/usr/include/speex") ++#CFLAGS+=$(shell [ -f /usr/local/include/speex.h ] && echo "-I/usr/local/include") ++#CFLAGS+=$(shell [ -f /usr/local/include/speex/speex.h ] && echo "-I/usr/local/include/speex") ++#CFLAGS+=$(shell [ -f /usr/include/speex/speex.h ] && echo "-I/usr/include/speex") + + LIBG723=g723.1/libg723.a + LIBG723B=g723.1b/libg723b.a + LIBGSM=gsm/lib/libgsm.a + LIBGSMT=gsm/lib/libgsm.a + LIBLPC10=lpc10/liblpc10.a +-LIBSPEEX=$(shell [ -f /usr/local/lib/libspeex.a ] && echo "-L/usr/local/lib") ++LIBSPEEX=$(LDFLAGS_EXTRA) + LIBSPEEX+=-lspeex -lm + LIBILBC=ilbc/libilbc.a + +@@ -43,26 +43,26 @@ + + clean: + rm -f *.so *.o .depend +- ! [ -d g723.1 ] || $(MAKE) -C g723.1 clean +- ! [ -d g723.1b ] || $(MAKE) -C g723.1b clean +- $(MAKE) -C gsm clean +- $(MAKE) -C lpc10 clean +- $(MAKE) -C ilbc clean ++ ! [ -d g723.1 ] || $(MAKE) PROC=$(PROC) -C g723.1 clean ++ ! [ -d g723.1b ] || $(MAKE) PROC=$(PROC) -C g723.1b clean ++ $(MAKE) PROC=$(PROC) -C gsm clean ++ $(MAKE) PROC=$(PROC) -C lpc10 clean ++ $(MAKE) PROC=$(PROC) -C ilbc clean + + $(LIBG723): +- $(MAKE) -C g723.1 all ++ $(MAKE) PROC=$(PROC) -C g723.1 all + + gsm/lib/libgsm.a: +- $(MAKE) -C gsm lib/libgsm.a ++ $(MAKE) PROC=$(PROC) -C gsm lib/libgsm.a + + $(LIBG723B): +- $(MAKE) -C g723.1b all ++ $(MAKE) PROC=$(PROC) -C g723.1b all + + $(LIBLPC10): +- $(MAKE) -C lpc10 all ++ $(MAKE) PROC=$(PROC) -C lpc10 all + + $(LIBILBC): +- $(MAKE) -C ilbc all ++ $(MAKE) PROC=$(PROC) -C ilbc all + + codec_ilbc.so: codec_ilbc.o $(LIBILBC) + $(CC) $(SOLINK) -o $@ $< $(LIBILBC) +diff -ruN asterisk-1.0.7-orig/codecs/gsm/Makefile asterisk-1.0.7-2/codecs/gsm/Makefile +--- asterisk-1.0.7-orig/codecs/gsm/Makefile 2004-12-21 21:49:24.000000000 +0100 ++++ asterisk-1.0.7-2/codecs/gsm/Makefile 2005-03-19 17:38:06.000000000 +0100 +@@ -40,9 +40,10 @@ + ifneq (${OSARCH},Darwin) + ifneq (${PROC},x86_64) + ifneq (${PROC},ultrasparc) +-ifneq ($(shell uname -m),ppc) +-ifneq ($(shell uname -m),alpha) ++ifneq ($(PROC),ppc) ++ifneq ($(PROC),alpha) + ifneq (${PROC},sparc64) ++ifneq ($(PROC),mipsel) + OPTIMIZE+=-march=$(PROC) + endif + endif +@@ -50,6 +51,7 @@ + endif + endif + endif ++endif + + #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only. + #This works for even old (2.96) versions of gcc and provides a small boost either way. +@@ -78,7 +80,7 @@ + # CCFLAGS = -c -O + + CC ?= gcc +-CCFLAGS += -c -DNeedFunctionPrototypes=1 -funroll-loops -fPIC $(OPTIMIZE) -fomit-frame-pointer ++CCFLAGS += -c -DNeedFunctionPrototypes=1 -fPIC $(OPTIMIZE) + + LD = $(CC) + +@@ -213,16 +215,18 @@ + $(SRC)/short_term.c \ + $(SRC)/table.c + ifeq (${OSARCH},Linux) +-ifneq ($(shell uname -m),x86_64) +-ifneq ($(shell uname -m),ppc) +-ifneq ($(shell uname -m),alpha) +-ifneq ($(shell uname -m),sparc64) ++ifneq ($(PROC),x86_64) ++ifneq ($(PROC),ppc) ++ifneq ($(PROC),alpha) ++ifneq ($(PROC),sparc64) ++ifneq ($(PROC),mipsel) + GSM_SOURCES+= $(SRC)/k6opt.s + endif + endif + endif + endif + endif ++endif + + TOAST_SOURCES = $(SRC)/toast.c \ + $(SRC)/toast_lin.c \ +@@ -269,16 +273,18 @@ + $(SRC)/table.o + + ifeq (${OSARCH},Linux) +-ifneq ($(shell uname -m), x86_64) +-ifneq ($(shell uname -m), ppc) +-ifneq ($(shell uname -m), alpha) +-ifneq ($(shell uname -m), sparc64) ++ifneq ($(PROC), x86_64) ++ifneq ($(PROC), ppc) ++ifneq ($(PROC), alpha) ++ifneq ($(PROC), sparc64) ++ifneq ($(PROC), mipsel) + GSM_OBJECTS+= $(SRC)/k6opt.o + endif + endif + endif + endif + endif ++endif + + TOAST_OBJECTS = $(SRC)/toast.o \ + $(SRC)/toast_lin.o \ +diff -ruN asterisk-1.0.7-orig/codecs/ilbc/Makefile asterisk-1.0.7-2/codecs/ilbc/Makefile +--- asterisk-1.0.7-orig/codecs/ilbc/Makefile 2004-08-29 19:40:58.000000000 +0200 ++++ asterisk-1.0.7-2/codecs/ilbc/Makefile 2005-03-19 17:38:06.000000000 +0100 +@@ -1,5 +1,5 @@ + ARCH=$(PROC) +-CFLAGS+=-Wall -fPIC -O3 -funroll-loops -fomit-frame-pointer ++CFLAGS+=-Wall -fPIC $(OPTIMIZE) + LIB=libilbc.a + + OBJS= anaFilter.o iCBSearch.o packing.o \ +@@ -12,8 +12,8 @@ + + + $(LIB): $(OBJS) +- ar cr $(LIB) $(OBJS) +- ranlib $(LIB) ++ $(AR) cr $(LIB) $(OBJS) ++ $(RANLIB) $(LIB) + + clean: + rm -f $(LIB) *.o +diff -ruN asterisk-1.0.7-orig/codecs/lpc10/Makefile asterisk-1.0.7-2/codecs/lpc10/Makefile +--- asterisk-1.0.7-orig/codecs/lpc10/Makefile 2004-08-31 18:33:00.000000000 +0200 ++++ asterisk-1.0.7-2/codecs/lpc10/Makefile 2005-03-19 17:38:06.000000000 +0100 +@@ -31,6 +31,7 @@ + ifneq ($(PROC),ppc) + ifneq ($(PROC),x86_64) + ifneq ($(PROC),alpha) ++ifneq ($(PROC),mipsel) + #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only. + #This works for even old (2.96) versions of gcc and provides a small boost either way. + #A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn.t support it. +@@ -46,6 +47,7 @@ + endif + endif + endif ++endif + + LIB = $(LIB_TARGET_DIR)/liblpc10.a + +@@ -62,7 +64,7 @@ + + $(LIB): $(OBJ) + $(AR) cr $@ $(OBJ) +- ranlib $@ ++ $(RANLIB) $@ + + clean: + -rm -f *.o $(LIB) +diff -ruN asterisk-1.0.7-orig/configs/modules.conf.sample asterisk-1.0.7-2/configs/modules.conf.sample +--- asterisk-1.0.7-orig/configs/modules.conf.sample 2003-06-26 20:57:54.000000000 +0200 ++++ asterisk-1.0.7-2/configs/modules.conf.sample 2005-03-19 17:38:06.000000000 +0100 +@@ -23,8 +23,8 @@ + ; Explicitly load the chan_modem.so early on to be sure + ; it loads before any of the chan_modem_* 's afte rit + ; +-load => chan_modem.so +-load => res_musiconhold.so ++noload => chan_modem.so ++noload => res_musiconhold.so + ; + ; Load either OSS or ALSA, not both + ; By default, load OSS only (automatically) and do not load ALSA +@@ -36,4 +36,12 @@ + ; exported to modules loaded after them. + ; + [global] +-chan_modem.so=yes ++; chan_modem.so=yes ++noload => app_adsiprog.so ++noload => app_db.so ++noload => app_hasnewvoicemail.so ++noload => app_voicemail.so ++noload => chan_skinny.so ++noload => cdr_csv.so ++noload => res_adsi.so ++noload => res_agi.so +diff -ruN asterisk-1.0.7-orig/db1-ast/Makefile asterisk-1.0.7-2/db1-ast/Makefile +--- asterisk-1.0.7-orig/db1-ast/Makefile 2004-08-31 18:33:00.000000000 +0200 ++++ asterisk-1.0.7-2/db1-ast/Makefile 2005-03-19 17:38:06.000000000 +0100 +@@ -32,8 +32,8 @@ + + $(LIBDB): $(OBJS) + rm -f $@ +- ar cq $@ $(OBJS) +- ranlib $@ ++ $(AR) cq $@ $(OBJS) ++ $(RANLIB) $@ + + $(LIBDBSO): $(SHOBJS) + $(CC) -Wl,-O1 -Wl,--version-script=libdb.map -Wl,-soname=$(LIBDBSO) -shared -o $@ $^ +diff -ruN asterisk-1.0.7-orig/dns.c asterisk-1.0.7-2/dns.c +--- asterisk-1.0.7-orig/dns.c 2004-06-22 22:11:15.000000000 +0200 ++++ asterisk-1.0.7-2/dns.c 2005-03-19 17:38:06.000000000 +0100 +@@ -153,7 +153,13 @@ + + #if defined(res_ninit) + #define HAS_RES_NINIT +-#else ++#endif ++ ++#ifdef __UCLIBC__ ++#undef HAS_RES_NINIT ++#endif ++ ++#ifndef HAS_RES_NINIT + AST_MUTEX_DEFINE_STATIC(res_lock); + #if 0 + #warning "Warning, res_ninit is missing... Could have reentrancy issues" +diff -ruN asterisk-1.0.7-orig/res/Makefile asterisk-1.0.7-2/res/Makefile +--- asterisk-1.0.7-orig/res/Makefile 2004-07-17 22:58:01.000000000 +0200 ++++ asterisk-1.0.7-2/res/Makefile 2005-03-19 17:58:17.000000000 +0100 +@@ -13,9 +13,9 @@ + + MODS=res_adsi.so res_features.so res_crypto.so res_musiconhold.so res_indications.so res_monitor.so \ + res_agi.so +-MODS+=$(shell if [ -f "/usr/include/odbcinst.h" ]; then echo "res_odbc.so res_config_odbc.so"; fi) +-MODS+=$(shell if [ -f "/usr/local/include/odbcinst.h" ]; then echo "res_odbc.so res_config_odbc.so"; fi) +-MODS+=$(shell if [ -f "/usr/include/osp/osp.h" ]; then echo "res_osp.so"; fi) ++#MODS+=$(shell if [ -f "/usr/include/odbcinst.h" ]; then echo "res_odbc.so res_config_odbc.so"; fi) ++#MODS+=$(shell if [ -f "/usr/local/include/odbcinst.h" ]; then echo "res_odbc.so res_config_odbc.so"; fi) ++#MODS+=$(shell if [ -f "/usr/include/osp/osp.h" ]; then echo "res_osp.so"; fi) + + CRYPTO_LIBS=-lssl -lcrypto + +diff -ruN asterisk-1.0.7-orig/stdtime/Makefile asterisk-1.0.7-2/stdtime/Makefile +--- asterisk-1.0.7-orig/stdtime/Makefile 2003-11-05 07:19:41.000000000 +0100 ++++ asterisk-1.0.7-2/stdtime/Makefile 2005-03-19 17:38:06.000000000 +0100 +@@ -3,8 +3,8 @@ + all: libtime.a + + libtime.a: $(OBJS) +- ar rv $@ $(OBJS) +- ranlib $@ ++ $(AR) rv $@ $(OBJS) ++ $(RANLIB) $@ + + install: + +diff -urN asterisk-1.0.7.old/codecs/Makefile asterisk-1.0.7/codecs/Makefile +--- asterisk-1.0.7.old/codecs/Makefile 2005-04-10 19:40:28.000000000 +0200 ++++ asterisk-1.0.7/codecs/Makefile 2005-04-10 19:51:15.000000000 +0200 +@@ -19,7 +19,6 @@ + #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") +-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") diff --git a/openwrt/package/asterisk/patches/mysql+postgres-support.diff b/openwrt/package/asterisk/patches/mysql+postgres-support.diff new file mode 100644 index 0000000000..c9665fe7a0 --- /dev/null +++ b/openwrt/package/asterisk/patches/mysql+postgres-support.diff @@ -0,0 +1,1024 @@ +diff -ruN asterisk-1.0.7-orig/apps/Makefile asterisk-1.0.7-2/apps/Makefile +--- asterisk-1.0.7-orig/apps/Makefile 2004-09-24 23:32:56.000000000 +0200 ++++ asterisk-1.0.7-2/apps/Makefile 2005-03-19 17:38:06.000000000 +0100 +@@ -79,11 +80,17 @@ + endif + endif + ++app_sql_mysql.o: app_sql_mysql.c ++ $(CC) $(CFLAGS) $(MYSQL_CFLAGS) -c -o $@ $< ++ ++app_sql_mysql.so: app_sql_mysql.o ++ $(CC) $(SOLINK) -o $@ $< $(LDFLAGS_EXTRA) -lmysqlclient -lz $(MYSQL_LFLAGS) ++ + app_sql_postgres.o: app_sql_postgres.c +- $(CC) -pipe -I/usr/local/pgsql/include $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c ++ $(CC) $(CFLAGS) $(PGSQL_CFLAGS) -c -o $@ $< + + app_sql_postgres.so: app_sql_postgres.o +- $(CC) $(SOLINK) -o $@ $< -L/usr/local/pgsql/lib -lpq ++ $(CC) $(SOLINK) -o $@ $< $(LDFLAGS_EXTRA) -lpq -lz $(PGSQL_LFLAGS) + + app_sql_odbc.so: app_sql_odbc.o + $(CC) $(SOLINK) -o $@ $< -lodbc +diff -ruN asterisk-1.0.7-orig/apps/app_sql_mysql.c asterisk-1.0.7-2/apps/app_sql_mysql.c +--- asterisk-1.0.7-orig/apps/app_sql_mysql.c 1970-01-01 01:00:00.000000000 +0100 ++++ asterisk-1.0.7-2/apps/app_sql_mysql.c 2005-03-19 18:01:13.000000000 +0100 +@@ -0,0 +1,443 @@ ++/* ++ * Asterisk -- A telephony toolkit for Linux. ++ * ++ * Connect to PostgreSQL ++ * ++ * Copyright (C) 2004, Constantine Filin and Christos Ricudis ++ * ++ * Christos Ricudis <ricudis@itc.auth.gr> ++ * Constantine Filin <cf@intermedia.net> ++ * ++ * This program is free software, distributed under the terms of ++ * the GNU General Public License ++ */ ++ ++#include <asterisk/file.h> ++#include <asterisk/logger.h> ++#include <asterisk/channel.h> ++#include <asterisk/pbx.h> ++#include <asterisk/module.h> ++#include <asterisk/linkedlists.h> ++#include <asterisk/chanvars.h> ++#include <asterisk/lock.h> ++#include <stdlib.h> ++#include <unistd.h> ++#include <string.h> ++#include <stdlib.h> ++#include <sys/types.h> ++#include <stdio.h> ++#include <unistd.h> ++ ++#include <mysql/mysql.h> ++ ++#define EXTRA_LOG 0 ++ ++static char *tdesc = "Simple Mysql Interface"; ++ ++static char *app = "MYSQL"; ++ ++static char *synopsis = "Do several mySQLy things"; ++ ++static char *descrip = ++"MYSQL(): Do several mySQLy things\n" ++"Syntax:\n" ++" MYSQL(Connect connid dhhost dbuser dbpass dbname)\n" ++" Connects to a database. Arguments contain standard MySQL parameters\n" ++" passed to function mysql_real_connect. Connection identifer returned\n" ++" in ${var}\n" ++" MYSQL(Query resultid ${connid} query-string)\n" ++" Executes standard MySQL query contained in query-string using established\n" ++" connection identified by ${connection_identifier}. Result of query is\n" ++" is stored in ${var}.\n" ++" MYSQL(Fetch fetchid ${resultid} var1 var2 ... varN)\n" ++" Fetches a single row from a result set contained in ${result_identifier}.\n" ++" Assigns returned fields to ${var1} ... ${varn}. ${fetchid} is set TRUE\n" ++" if additional rows exist in result set.\n" ++" MYSQL(Clear ${resultid})\n" ++" Frees memory and datastructures associated with result set.\n" ++" MYSQL(Disconnect ${connid})\n" ++" Disconnects from named connection to MySQL.\n" ; ++ ++/* ++EXAMPLES OF USE : ++ ++exten => s,2,MYSQL(Connect connid localhost asterisk mypass credit) ++exten => s,3,MYSQL(Query resultid ${connid} SELECT username,credit FROM credit WHERE callerid=${CALLERIDNUM}) ++exten => s,4,MYSQL(Fetch fetchid ${resultid} datavar1 datavar2) ++exten => s,5,GotoIf(${fetchid}?6:8) ++exten => s,6,Festival("User ${datavar1} currently has credit balance of ${datavar2} dollars.") ++exten => s,7,Goto(s,4) ++exten => s,8,MYSQL(Clear ${resultid}) ++exten => s,9,MYSQL(Disconnect ${connid}) ++*/ ++ ++STANDARD_LOCAL_USER; ++LOCAL_USER_DECL; ++ ++AST_MUTEX_DEFINE_STATIC(_mysql_mutex); ++ ++extern void pbx_builtin_setvar_helper(struct ast_channel *chan, char *name, char *value); ++ ++#define AST_MYSQL_ID_DUMMY 0 ++#define AST_MYSQL_ID_CONNID 1 ++#define AST_MYSQL_ID_RESID 2 ++#define AST_MYSQL_ID_FETCHID 3 ++ ++struct ast_MYSQL_id { ++ int identifier_type; /* 0=dummy, 1=connid, 2=resultid */ ++ int identifier; ++ void *data; ++ AST_LIST_ENTRY(ast_MYSQL_id) entries; ++} *ast_MYSQL_id; ++ ++AST_LIST_HEAD(MYSQLidshead,ast_MYSQL_id) _mysql_ids_head; ++ ++/* helpful procs */ ++static void *find_identifier(int identifier,int identifier_type) { ++ struct MYSQLidshead *headp; ++ struct ast_MYSQL_id *i; ++ void *res=NULL; ++ int found=0; ++ ++ headp=&_mysql_ids_head; ++ ++ if (AST_LIST_LOCK(headp)) { ++ ast_log(LOG_WARNING,"Unable to lock identifiers list\n"); ++ } else { ++ AST_LIST_TRAVERSE(headp,i,entries) { ++ if ((i->identifier==identifier) && (i->identifier_type==identifier_type)) { ++ found=1; ++ res=i->data; ++ break; ++ } ++ } ++ if (!found) { ++ ast_log(LOG_WARNING,"Identifier %d, identifier_type %d not found in identifier list\n",identifier,identifier_type); ++ } ++ AST_LIST_UNLOCK(headp); ++ } ++ ++ return res; ++} ++ ++static int add_identifier(int identifier_type,void *data) { ++ struct ast_MYSQL_id *i,*j; ++ struct MYSQLidshead *headp; ++ int maxidentifier=0; ++ ++ headp=&_mysql_ids_head; ++ i=NULL; ++ j=NULL; ++ ++ if (AST_LIST_LOCK(headp)) { ++ ast_log(LOG_WARNING,"Unable to lock identifiers list\n"); ++ return(-1); ++ } else { ++ i=malloc(sizeof(struct ast_MYSQL_id)); ++ AST_LIST_TRAVERSE(headp,j,entries) { ++ if (j->identifier>maxidentifier) { ++ maxidentifier=j->identifier; ++ } ++ } ++ i->identifier=maxidentifier+1; ++ i->identifier_type=identifier_type; ++ i->data=data; ++ AST_LIST_INSERT_HEAD(headp,i,entries); ++ AST_LIST_UNLOCK(headp); ++ } ++ return i->identifier; ++} ++ ++static int del_identifier(int identifier,int identifier_type) { ++ struct ast_MYSQL_id *i; ++ struct MYSQLidshead *headp; ++ int found=0; ++ ++ headp=&_mysql_ids_head; ++ ++ if (AST_LIST_LOCK(headp)) { ++ ast_log(LOG_WARNING,"Unable to lock identifiers list\n"); ++ } else { ++ AST_LIST_TRAVERSE(headp,i,entries) { ++ if ((i->identifier==identifier) && ++ (i->identifier_type==identifier_type)) { ++ AST_LIST_REMOVE(headp,i,ast_MYSQL_id,entries); ++ free(i); ++ found=1; ++ break; ++ } ++ } ++ AST_LIST_UNLOCK(headp); ++ } ++ ++ if (found==0) { ++ ast_log(LOG_WARNING,"Could not find identifier %d, identifier_type %d in list to delete\n",identifier,identifier_type); ++ return(-1); ++ } else { ++ return(0); ++ } ++} ++ ++static int set_asterisk_int(struct ast_channel *chan, char *varname, int id) { ++ if( id>=0 ) { ++ char s[100] = ""; ++ snprintf(s, sizeof(s)-1, "%d", id); ++#if EXTRA_LOG ++ ast_log(LOG_WARNING,"MYSQL: setting var '%s' to value '%s'\n",varname,s); ++#endif ++ pbx_builtin_setvar_helper(chan,varname,s); ++ } ++ return id; ++} ++ ++static int add_identifier_and_set_asterisk_int(struct ast_channel *chan, char *varname, int identifier_type, void *data) { ++ return set_asterisk_int(chan,varname,add_identifier(identifier_type,data)); ++} ++ ++static int safe_scan_int( char** data, char* delim, int def ) { ++ char* end; ++ int res = def; ++ char* s = strsep(data,delim); ++ if( s ) { ++ res = strtol(s,&end,10); ++ if (*end) res = def; /* not an integer */ ++ } ++ return res; ++} ++ ++/* MYSQL operations */ ++static int aMYSQL_connect(struct ast_channel *chan, char *data) { ++ ++ MYSQL *mysql; ++ ++ char *connid_var; ++ char *dbhost; ++ char *dbuser; ++ char *dbpass; ++ char *dbname; ++ ++ strsep(&data," "); // eat the first token, we already know it :P ++ ++ connid_var=strsep(&data," "); ++ dbhost=strsep(&data," "); ++ dbuser=strsep(&data," "); ++ dbpass=strsep(&data," "); ++ dbname=strsep(&data,"\n"); ++ ++ if( connid_var && dbhost && dbuser && dbpass && dbname ) { ++ mysql = mysql_init(NULL); ++ if (mysql) { ++ if (mysql_real_connect(mysql,dbhost,dbuser,dbpass,dbname,0,NULL,0)) { ++ add_identifier_and_set_asterisk_int(chan,connid_var,AST_MYSQL_ID_CONNID,mysql); ++ return 0; ++ } ++ else { ++ ast_log(LOG_WARNING,"mysql_real_connect(mysql,%s,%s,dbpass,%s,...) failed\n",dbhost,dbuser,dbname); ++ } ++ } ++ else { ++ ast_log(LOG_WARNING,"myslq_init returned NULL\n"); ++ } ++ } ++ else { ++ ast_log(LOG_WARNING,"MYSQL(connect is missing some arguments\n"); ++ } ++ ++ return -1; ++} ++ ++static int aMYSQL_query(struct ast_channel *chan, char *data) { ++ ++ MYSQL *mysql; ++ MYSQL_RES *mysqlres; ++ ++ char *resultid_var; ++ int connid; ++ char *querystring; ++ ++ strsep(&data," "); // eat the first token, we already know it :P ++ ++ resultid_var = strsep(&data," "); ++ connid = safe_scan_int(&data," ",-1); ++ querystring = strsep(&data,"\n"); ++ ++ if (resultid_var && (connid>=0) && querystring) { ++ if ((mysql=find_identifier(connid,AST_MYSQL_ID_CONNID))!=NULL) { ++ mysql_query(mysql,querystring); ++ if ((mysqlres=mysql_use_result(mysql))!=NULL) { ++ add_identifier_and_set_asterisk_int(chan,resultid_var,AST_MYSQL_ID_RESID,mysqlres); ++ return 0; ++ } ++ else if( mysql_field_count(mysql)==0 ) { ++ return 0; // See http://dev.mysql.com/doc/mysql/en/mysql_field_count.html ++ } ++ else { ++ ast_log(LOG_WARNING,"aMYSQL_query: mysql_store_result() failed on query %s\n",querystring); ++ } ++ } ++ else { ++ ast_log(LOG_WARNING,"aMYSQL_query: Invalid connection identifier %d passed in aMYSQL_query\n",connid); ++ } ++ } ++ else { ++ ast_log(LOG_WARNING,"aMYSQL_query: missing some arguments\n"); ++ } ++ ++ return -1; ++} ++ ++ ++static int aMYSQL_fetch(struct ast_channel *chan, char *data) { ++ ++ MYSQL_RES *mysqlres; ++ MYSQL_ROW mysqlrow; ++ ++ char *fetchid_var,*s5,*s6; ++ int resultid,numFields,j; ++ ++ strsep(&data," "); // eat the first token, we already know it :P ++ ++ fetchid_var = strsep(&data," "); ++ resultid = safe_scan_int(&data," ",-1); ++ ++ if (fetchid_var && (resultid>=0) ) { ++ if ((mysqlres=find_identifier(resultid,AST_MYSQL_ID_RESID))!=NULL) { ++ /* Grab the next row */ ++ if ((mysqlrow=mysql_fetch_row(mysqlres))!=NULL) { ++ numFields=mysql_num_fields(mysqlres); ++ for (j=0;j<numFields;j++) { ++ s5=strsep(&data," "); ++ if (s5==NULL) { ++ ast_log(LOG_WARNING,"ast_MYSQL_fetch: More fields (%d) than variables (%d)\n",numFields,j); ++ break; ++ } ++ s6=mysqlrow[j]; ++ pbx_builtin_setvar_helper(chan,s5, s6 ? s6 : "NULL"); ++ } ++#ifdef EXTRA_LOG ++ ast_log(LOG_WARNING,"ast_MYSQL_fetch: numFields=%d\n",numFields); ++#endif ++ set_asterisk_int(chan,fetchid_var,1); // try more rows ++ } else { ++#if EXTRA_LOG ++ ast_log(LOG_WARNING,"ast_MYSQL_fetch : EOF\n"); ++#endif ++ set_asterisk_int(chan,fetchid_var,0); // no more rows ++ } ++ return 0; ++ } ++ else { ++ ast_log(LOG_WARNING,"aMYSQL_fetch: Invalid result identifier %d passed\n",resultid); ++ } ++ } ++ else { ++ ast_log(LOG_WARNING,"aMYSQL_fetch: missing some arguments\n"); ++ } ++ ++ return -1; ++} ++ ++static int aMYSQL_clear(struct ast_channel *chan, char *data) { ++ ++ MYSQL_RES *mysqlres; ++ ++ int id; ++ strsep(&data," "); // eat the first token, we already know it :P ++ id = safe_scan_int(&data," \n",-1); ++ if ((mysqlres=find_identifier(id,AST_MYSQL_ID_RESID))==NULL) { ++ ast_log(LOG_WARNING,"Invalid result identifier %d passed in aMYSQL_clear\n",id); ++ } else { ++ mysql_free_result(mysqlres); ++ del_identifier(id,AST_MYSQL_ID_RESID); ++ } ++ ++ return 0; ++} ++ ++static int aMYSQL_disconnect(struct ast_channel *chan, char *data) { ++ ++ MYSQL *mysql; ++ int id; ++ strsep(&data," "); // eat the first token, we already know it :P ++ ++ id = safe_scan_int(&data," \n",-1); ++ if ((mysql=find_identifier(id,AST_MYSQL_ID_CONNID))==NULL) { ++ ast_log(LOG_WARNING,"Invalid connection identifier %d passed in aMYSQL_disconnect\n",id); ++ } else { ++ mysql_close(mysql); ++ del_identifier(id,AST_MYSQL_ID_CONNID); ++ } ++ ++ return 0; ++} ++ ++static int MYSQL_exec(struct ast_channel *chan, void *data) ++{ ++ struct localuser *u; ++ int result; ++ ++#if EXTRA_LOG ++ fprintf(stderr,"MYSQL_exec: data=%s\n",(char*)data); ++#endif ++ ++ if (!data) { ++ ast_log(LOG_WARNING, "APP_MYSQL requires an argument (see manual)\n"); ++ return -1; ++ } ++ ++ LOCAL_USER_ADD(u); ++ result=0; ++ ++ ast_mutex_lock(&_mysql_mutex); ++ ++ if (strncasecmp("connect",data,strlen("connect"))==0) { ++ result=aMYSQL_connect(chan,ast_strdupa(data)); ++ } else if (strncasecmp("query",data,strlen("query"))==0) { ++ result=aMYSQL_query(chan,ast_strdupa(data)); ++ } else if (strncasecmp("fetch",data,strlen("fetch"))==0) { ++ result=aMYSQL_fetch(chan,ast_strdupa(data)); ++ } else if (strncasecmp("clear",data,strlen("clear"))==0) { ++ result=aMYSQL_clear(chan,ast_strdupa(data)); ++ } else if (strncasecmp("disconnect",data,strlen("disconnect"))==0) { ++ result=aMYSQL_disconnect(chan,ast_strdupa(data)); ++ } else { ++ ast_log(LOG_WARNING, "Unknown argument to MYSQL application : %s\n",(char *)data); ++ result=-1; ++ } ++ ++ ast_mutex_unlock(&_mysql_mutex); ++ ++ LOCAL_USER_REMOVE(u); ++ return result; ++ ++} ++ ++int unload_module(void) ++{ ++ STANDARD_HANGUP_LOCALUSERS; ++ return ast_unregister_application(app); ++} ++ ++int load_module(void) ++{ ++ struct MYSQLidshead *headp = &_mysql_ids_head; ++ AST_LIST_HEAD_INIT(headp); ++ return ast_register_application(app, MYSQL_exec, synopsis, descrip); ++} ++ ++char *description(void) ++{ ++ return tdesc; ++} ++ ++int usecount(void) ++{ ++ int res; ++ STANDARD_USECOUNT(res); ++ return res; ++} ++ ++char *key() ++{ ++ return ASTERISK_GPL_KEY; ++} +diff -ruN asterisk-1.0.7-orig/cdr/Makefile asterisk-1.0.7-2/cdr/Makefile +--- asterisk-1.0.7-orig/cdr/Makefile 2004-08-31 18:33:00.000000000 +0200 ++++ asterisk-1.0.7-2/cdr/Makefile 2005-03-19 17:38:06.000000000 +0100 +@@ -37,36 +37,36 @@ + # + # unixODBC stuff... + # +-MODS+=$(shell if [ -f "/usr/include/odbcinst.h" ]; then echo "cdr_odbc.so"; fi) +-MODS+=$(shell if [ -f "/usr/local/include/odbcinst.h" ]; then echo "cdr_odbc.so"; fi) ++#MODS+=$(shell if [ -f "/usr/include/odbcinst.h" ]; then echo "cdr_odbc.so"; fi) ++#MODS+=$(shell if [ -f "/usr/local/include/odbcinst.h" ]; then echo "cdr_odbc.so"; fi) + + # + # FreeTDS stuff... + # +-MODS+=$(shell if [ -f "/usr/include/tds.h" ]; then echo "cdr_tds.so"; fi) +-MODS+=$(shell if [ -f "/usr/local/include/tds.h" ]; then echo "cdr_tds.so"; fi) ++#MODS+=$(shell if [ -f "/usr/include/tds.h" ]; then echo "cdr_tds.so"; fi) ++#MODS+=$(shell if [ -f "/usr/local/include/tds.h" ]; then echo "cdr_tds.so"; fi) + + # + # PGSQL stuff... Autoconf anyone?? + # +-MODS+=$(shell if [ -d /usr/local/pgsql/include ] || [ -d /usr/include/pgsql ] || [ -d /usr/local/include/pgsql ] || [ -d /opt/pgsql/include ] || [ -f /usr/include/libpq-fe.h ] ; then echo "cdr_pgsql.so"; fi) +-CFLAGS+=$(shell if [ -d /usr/local/pgsql/include ]; then echo "-I/usr/local/pgsql/include"; fi) +-CFLAGS+=$(shell if [ -d /usr/include/pgsql ]; then echo "-I/usr/include/pgsql"; fi) +-CFLAGS+=$(shell if [ -d /usr/include/postgresql ]; then echo "-I/usr/include/postgresql"; fi) +-CFLAGS+=$(shell if [ -d /usr/local/include/pgsql ]; then echo "-I/usr/local/include/pgsql"; fi) +-CFLAGS+=$(shell if [ -d /opt/pgsql/include ]; then echo "-I/opt/pgsql/include"; fi) ++#MODS+=$(shell if [ -d /usr/local/pgsql/include ] || [ -d /usr/include/pgsql ] || [ -d /usr/local/include/pgsql ] || [ -d /opt/pgsql/include ] || [ -f /usr/include/libpq-fe.h ] ; then echo "cdr_pgsql.so"; fi) ++#CFLAGS+=$(shell if [ -d /usr/local/pgsql/include ]; then echo "-I/usr/local/pgsql/include"; fi) ++#CFLAGS+=$(shell if [ -d /usr/include/pgsql ]; then echo "-I/usr/include/pgsql"; fi) ++#CFLAGS+=$(shell if [ -d /usr/include/postgresql ]; then echo "-I/usr/include/postgresql"; fi) ++#CFLAGS+=$(shell if [ -d /usr/local/include/pgsql ]; then echo "-I/usr/local/include/pgsql"; fi) ++#CFLAGS+=$(shell if [ -d /opt/pgsql/include ]; then echo "-I/opt/pgsql/include"; fi) + #CFLAGS+=$(shell if [ -f /usr/include/libpq-fe.h ]; then echo "-I/usr/include"; fi) + MLFLAGS= +-MLFLAGS+=$(shell if [ -d /usr/lib/pgsql ]; then echo "-L/usr/lib/pgsql"; fi) +-MLFLAGS+=$(shell if [ -d /usr/local/pgsql/lib ]; then echo "-L/usr/local/pgsql/lib"; fi) +-MLFLAGS+=$(shell if [ -d /usr/local/lib/pgsql ]; then echo "-L/usr/local/lib/pgsql"; fi) +-MLFLAGS+=$(shell if [ -d /opt/pgsql/lib ]; then echo "-L/opt/pgsql/lib"; fi) +-MLFLAGS+=$(shell if [ -f /usr/lib/libpq.so ]; then echo "-L/usr/lib"; fi) ++#MLFLAGS+=$(shell if [ -d /usr/lib/pgsql ]; then echo "-L/usr/lib/pgsql"; fi) ++#MLFLAGS+=$(shell if [ -d /usr/local/pgsql/lib ]; then echo "-L/usr/local/pgsql/lib"; fi) ++#MLFLAGS+=$(shell if [ -d /usr/local/lib/pgsql ]; then echo "-L/usr/local/lib/pgsql"; fi) ++#MLFLAGS+=$(shell if [ -d /opt/pgsql/lib ]; then echo "-L/opt/pgsql/lib"; fi) ++#MLFLAGS+=$(shell if [ -f /usr/lib/libpq.so ]; then echo "-L/usr/lib"; fi) + + # + # SQLIte stuff... + # +-MODS+=$(shell if [ -f "/usr/include/sqlite.h" ]; then echo "cdr_sqlite.so"; fi) ++#MODS+=$(shell if [ -f "/usr/include/sqlite.h" ]; then echo "cdr_sqlite.so"; fi) + + all: depend $(MODS) + +@@ -89,8 +89,17 @@ + cdr_tds.so: cdr_tds.o + $(CC) $(SOLINK) -o $@ $< -ltds $(MLFLAGS) + ++cdr_mysql.o: cdr_mysql.c ++ $(CC) $(CFLAGS) $(MYSQL_CFLAGS) -c -o $@ $< ++ ++cdr_mysql.so: cdr_mysql.o ++ $(CC) $(SOLINK) -o $@ $< $(LDFLAGS_EXTRA) -lmysqlclient -lz $(MYSQL_LFLAGS) ++ ++cdr_pgsql.o: cdr_pgsql.c ++ $(CC) $(CFLAGS) $(PGSQL_CFLAGS) -c -o $@ $< ++ + cdr_pgsql.so: cdr_pgsql.o +- $(CC) $(SOLINK) -o $@ $< -lpq -lz $(MLFLAGS) ++ $(CC) $(SOLINK) -o $@ $< $(LDFLAGS_EXTRA) -lpq -lz $(PGSQL_LFLAGS) + + cdr_sqlite.so: cdr_sqlite.o + $(CC) $(SOLINK) -o $@ $< -lsqlite $(MLFLAGS) +diff -ruN asterisk-1.0.7-orig/cdr/cdr_mysql.c asterisk-1.0.7-2/cdr/cdr_mysql.c +--- asterisk-1.0.7-orig/cdr/cdr_mysql.c 1970-01-01 01:00:00.000000000 +0100 ++++ asterisk-1.0.7-2/cdr/cdr_mysql.c 2005-03-19 17:46:30.000000000 +0100 +@@ -0,0 +1,450 @@ ++/* ++ * Asterisk -- A telephony toolkit for Linux. ++ * ++ * MySQL CDR logger ++ * ++ * James Sharp <jsharp@psychoses.org> ++ * ++ * Modified August 2003 ++ * Tilghman Lesher <asterisk__cdr__cdr_mysql__200308@the-tilghman.com> ++ * ++ * This program is free software, distributed under the terms of ++ * the GNU General Public License. ++ * ++ */ ++ ++#include <sys/types.h> ++#include <asterisk/config.h> ++#include <asterisk/options.h> ++#include <asterisk/channel.h> ++#include <asterisk/cdr.h> ++#include <asterisk/module.h> ++#include <asterisk/logger.h> ++#include <asterisk/cli.h> ++#include "../asterisk.h" ++ ++#include <stdio.h> ++#include <string.h> ++ ++#include <stdlib.h> ++#include <unistd.h> ++#include <time.h> ++ ++#include <mysql/mysql.h> ++#include <mysql/errmsg.h> ++ ++#define DATE_FORMAT "%Y-%m-%d %T" ++ ++static char *desc = "MySQL CDR Backend"; ++static char *name = "mysql"; ++static char *config = "cdr_mysql.conf"; ++static char *hostname = NULL, *dbname = NULL, *dbuser = NULL, *password = NULL, *dbsock = NULL, *dbtable = NULL; ++static int hostname_alloc = 0, dbname_alloc = 0, dbuser_alloc = 0, password_alloc = 0, dbsock_alloc = 0, dbtable_alloc = 0; ++static int dbport = 0; ++static int connected = 0; ++static time_t connect_time = 0; ++static int records = 0; ++static int totalrecords = 0; ++static int userfield = 0; ++ ++AST_MUTEX_DEFINE_STATIC(mysql_lock); ++ ++static MYSQL mysql; ++ ++static char cdr_mysql_status_help[] = ++"Usage: cdr mysql status\n" ++" Shows current connection status for cdr_mysql\n"; ++ ++static int handle_cdr_mysql_status(int fd, int argc, char *argv[]) ++{ ++ if (connected) { ++ char status[256], status2[100] = ""; ++ int ctime = time(NULL) - connect_time; ++ if (dbport) ++ snprintf(status, 255, "Connected to %s@%s, port %d", dbname, hostname, dbport); ++ else if (dbsock) ++ snprintf(status, 255, "Connected to %s on socket file %s", dbname, dbsock); ++ else ++ snprintf(status, 255, "Connected to %s@%s", dbname, hostname); ++ ++ if (dbuser && *dbuser) ++ snprintf(status2, 99, " with username %s", dbuser); ++ if (dbtable && *dbtable) ++ snprintf(status2, 99, " using table %s", dbtable); ++ if (ctime > 31536000) { ++ ast_cli(fd, "%s%s for %d years, %d days, %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 31536000, (ctime % 31536000) / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60); ++ } else if (ctime > 86400) { ++ ast_cli(fd, "%s%s for %d days, %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 86400, (ctime % 86400) / 3600, (ctime % 3600) / 60, ctime % 60); ++ } else if (ctime > 3600) { ++ ast_cli(fd, "%s%s for %d hours, %d minutes, %d seconds.\n", status, status2, ctime / 3600, (ctime % 3600) / 60, ctime % 60); ++ } else if (ctime > 60) { ++ ast_cli(fd, "%s%s for %d minutes, %d seconds.\n", status, status2, ctime / 60, ctime % 60); ++ } else { ++ ast_cli(fd, "%s%s for %d seconds.\n", status, status2, ctime); ++ } ++ if (records == totalrecords) ++ ast_cli(fd, " Wrote %d records since last restart.\n", totalrecords); ++ else ++ ast_cli(fd, " Wrote %d records since last restart and %d records since last reconnect.\n", totalrecords, records); ++ return RESULT_SUCCESS; ++ } else { ++ ast_cli(fd, "Not currently connected to a MySQL server.\n"); ++ return RESULT_FAILURE; ++ } ++} ++ ++static struct ast_cli_entry cdr_mysql_status_cli = ++ { { "cdr", "mysql", "status", NULL }, ++ handle_cdr_mysql_status, "Show connection status of cdr_mysql", ++ cdr_mysql_status_help, NULL }; ++ ++static int mysql_log(struct ast_cdr *cdr) ++{ ++ struct tm tm; ++ struct timeval tv; ++ struct localuser *u; ++ char *userfielddata = NULL; ++ char sqlcmd[2048], timestr[128]; ++ ++ ast_mutex_lock(&mysql_lock); ++ ++ memset(sqlcmd,0,2048); ++ ++ localtime_r(&cdr->start.tv_sec,&tm); ++ strftime(timestr,128,DATE_FORMAT,&tm); ++ ++ if ((!connected) && (hostname || dbsock) && dbuser && password && dbname && dbtable ) { ++ /* Attempt to connect */ ++ mysql_init(&mysql); ++ if (mysql_real_connect(&mysql, hostname, dbuser, password, dbname, dbport, dbsock, 0)) { ++ connected = 1; ++ connect_time = time(NULL); ++ records = 0; ++ } else { ++ ast_log(LOG_ERROR, "cdr_mysql: cannot connect to database server %s. Call will not be logged\n", hostname); ++ } ++ } else { ++ /* Long connection - ping the server */ ++ int error; ++ if ((error = mysql_ping(&mysql))) { ++ connected = 0; ++ records = 0; ++ switch (error) { ++ case CR_SERVER_GONE_ERROR: ++ ast_log(LOG_ERROR, "cdr_mysql: Server has gone away\n"); ++ break; ++ default: ++ ast_log(LOG_ERROR, "cdr_mysql: Unknown connection error\n"); ++ } ++ } ++ } ++ ++ if (connected) { ++ char *clid=NULL, *dcontext=NULL, *channel=NULL, *dstchannel=NULL, *lastapp=NULL, *lastdata=NULL; ++#ifdef MYSQL_LOGUNIQUEID ++ char *uniqueid=NULL; ++#endif ++ ++ /* Maximum space needed would be if all characters needed to be escaped, plus a trailing NULL */ ++ if ((clid = alloca(strlen(cdr->clid) * 2 + 1)) != NULL) ++ mysql_real_escape_string(&mysql, clid, cdr->clid, strlen(cdr->clid)); ++ if ((dcontext = alloca(strlen(cdr->dcontext) * 2 + 1)) != NULL) ++ mysql_real_escape_string(&mysql, dcontext, cdr->dcontext, strlen(cdr->dcontext)); ++ if ((channel = alloca(strlen(cdr->channel) * 2 + 1)) != NULL) ++ mysql_real_escape_string(&mysql, channel, cdr->channel, strlen(cdr->channel)); ++ if ((dstchannel = alloca(strlen(cdr->dstchannel) * 2 + 1)) != NULL) ++ mysql_real_escape_string(&mysql, dstchannel, cdr->dstchannel, strlen(cdr->dstchannel)); ++ if ((lastapp = alloca(strlen(cdr->lastapp) * 2 + 1)) != NULL) ++ mysql_real_escape_string(&mysql, lastapp, cdr->lastapp, strlen(cdr->lastapp)); ++ if ((lastdata = alloca(strlen(cdr->lastdata) * 2 + 1)) != NULL) ++ mysql_real_escape_string(&mysql, lastdata, cdr->lastdata, strlen(cdr->lastdata)); ++#ifdef MYSQL_LOGUNIQUEID ++ if ((uniqueid = alloca(strlen(cdr->uniqueid) * 2 + 1)) != NULL) ++ mysql_real_escape_string(&mysql, uniqueid, cdr->uniqueid, strlen(cdr->uniqueid)); ++#endif ++ ++ if (userfield && ((userfielddata = alloca(strlen(cdr->userfield) * 2 + 1)) != NULL)) ++ mysql_real_escape_string(&mysql, userfielddata, cdr->userfield, strlen(cdr->userfield)); ++ ++ /* Check for all alloca failures above at once */ ++#ifdef MYSQL_LOGUNIQUEID ++ if ((!clid) || (!dcontext) || (!channel) || (!dstchannel) || (!lastapp) || (!lastdata) || (!uniqueid)) { ++#else ++ if ((!clid) || (!dcontext) || (!channel) || (!dstchannel) || (!lastapp) || (!lastdata)) { ++#endif ++ ast_log(LOG_ERROR, "cdr_mysql: Out of memory error (insert fails)\n"); ++ ast_mutex_unlock(&mysql_lock); ++ return -1; ++ } ++ ++ ast_log(LOG_DEBUG,"cdr_mysql: inserting a CDR record.\n"); ++ ++ if (userfield && userfielddata) ++ { ++#ifdef MYSQL_LOGUNIQUEID ++ sprintf(sqlcmd,"INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) VALUES ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%i,%i,'%s',%i,'%s','%s','%s')",dbtable,timestr,clid,cdr->src, cdr->dst, dcontext,channel, dstchannel, lastapp, lastdata,cdr->duration,cdr->billsec,ast_cdr_disp2str(cdr->disposition),cdr->amaflags, cdr->accountcode, uniqueid, userfielddata); ++#else ++ sprintf(sqlcmd,"INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,userfield) VALUES ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%i,%i,'%s',%i,'%s','%s')",dbtable,timestr,clid,cdr->src, cdr->dst, dcontext,channel, dstchannel, lastapp, lastdata,cdr->duration,cdr->billsec,ast_cdr_disp2str(cdr->disposition),cdr->amaflags, cdr->accountcode, userfielddata); ++#endif ++ } ++ else ++ { ++#ifdef MYSQL_LOGUNIQUEID ++ sprintf(sqlcmd,"INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid) VALUES ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%i,%i,'%s',%i,'%s','%s')",dbtable,timestr,clid,cdr->src, cdr->dst, dcontext,channel, dstchannel, lastapp, lastdata,cdr->duration,cdr->billsec,ast_cdr_disp2str(cdr->disposition),cdr->amaflags, cdr->accountcode, uniqueid); ++#else ++ sprintf(sqlcmd,"INSERT INTO %s (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode) VALUES ('%s','%s','%s','%s','%s', '%s','%s','%s','%s',%i,%i,'%s',%i,'%s')",dbtable,timestr,clid,cdr->src, cdr->dst, dcontext,channel, dstchannel, lastapp, lastdata,cdr->duration,cdr->billsec,ast_cdr_disp2str(cdr->disposition),cdr->amaflags, cdr->accountcode); ++#endif ++ } ++ ++ ast_log(LOG_DEBUG,"cdr_mysql: SQL command as follows: %s\n",sqlcmd); ++ ++ if (mysql_real_query(&mysql,sqlcmd,strlen(sqlcmd))) { ++ ast_log(LOG_ERROR,"Failed to insert into database."); ++ ast_mutex_unlock(&mysql_lock); ++ return -1; ++ } else { ++ records++; ++ totalrecords++; ++ } ++ } ++ ast_mutex_unlock(&mysql_lock); ++ return 0; ++} ++ ++char *description(void) ++{ ++ return desc; ++} ++ ++static int my_unload_module(void) ++{ ++ ast_cli_unregister(&cdr_mysql_status_cli); ++ if (connected) { ++ mysql_close(&mysql); ++ connected = 0; ++ records = 0; ++ } ++ if (hostname && hostname_alloc) { ++ free(hostname); ++ hostname = NULL; ++ hostname_alloc = 0; ++ } ++ if (dbname && dbname_alloc) { ++ free(dbname); ++ dbname = NULL; ++ dbname_alloc = 0; ++ } ++ if (dbuser && dbuser_alloc) { ++ free(dbuser); ++ dbuser = NULL; ++ dbuser_alloc = 0; ++ } ++ if (dbsock && dbsock_alloc) { ++ free(dbsock); ++ dbsock = NULL; ++ dbsock_alloc = 0; ++ } ++ if (dbtable && dbtable_alloc) { ++ free(dbtable); ++ dbtable = NULL; ++ dbtable_alloc = 0; ++ } ++ if (password && password_alloc) { ++ free(password); ++ password = NULL; ++ password_alloc = 0; ++ } ++ dbport = 0; ++ ast_cdr_unregister(name); ++ return 0; ++} ++ ++static int my_load_module(void) ++{ ++ int res; ++ struct ast_config *cfg; ++ struct ast_variable *var; ++ char *tmp; ++ ++ cfg = ast_config_load(config); ++ if (!cfg) { ++ ast_log(LOG_WARNING, "Unable to load config for mysql CDR's: %s\n", config); ++ return 0; ++ } ++ ++ var = ast_variable_browse(cfg, "global"); ++ if (!var) { ++ /* nothing configured */ ++ return 0; ++ } ++ ++ tmp = ast_variable_retrieve(cfg,"global","hostname"); ++ if (tmp) { ++ hostname = malloc(strlen(tmp) + 1); ++ if (hostname != NULL) { ++ hostname_alloc = 1; ++ strcpy(hostname,tmp); ++ } else { ++ ast_log(LOG_ERROR,"Out of memory error.\n"); ++ return -1; ++ } ++ } else { ++ ast_log(LOG_WARNING,"MySQL server hostname not specified. Assuming localhost\n"); ++ hostname = "localhost"; ++ } ++ ++ tmp = ast_variable_retrieve(cfg,"global","dbname"); ++ if (tmp) { ++ dbname = malloc(strlen(tmp) + 1); ++ if (dbname != NULL) { ++ dbname_alloc = 1; ++ strcpy(dbname,tmp); ++ } else { ++ ast_log(LOG_ERROR,"Out of memory error.\n"); ++ return -1; ++ } ++ } else { ++ ast_log(LOG_WARNING,"MySQL database not specified. Assuming asteriskcdrdb\n"); ++ dbname = "asteriskcdrdb"; ++ } ++ ++ tmp = ast_variable_retrieve(cfg,"global","user"); ++ if (tmp) { ++ dbuser = malloc(strlen(tmp) + 1); ++ if (dbuser != NULL) { ++ dbuser_alloc = 1; ++ strcpy(dbuser,tmp); ++ } else { ++ ast_log(LOG_ERROR,"Out of memory error.\n"); ++ return -1; ++ } ++ } else { ++ ast_log(LOG_WARNING,"MySQL database user not specified. Assuming root\n"); ++ dbuser = "root"; ++ } ++ ++ tmp = ast_variable_retrieve(cfg,"global","sock"); ++ if (tmp) { ++ dbsock = malloc(strlen(tmp) + 1); ++ if (dbsock != NULL) { ++ dbsock_alloc = 1; ++ strcpy(dbsock,tmp); ++ } else { ++ ast_log(LOG_ERROR,"Out of memory error.\n"); ++ return -1; ++ } ++ } else { ++ ast_log(LOG_WARNING,"MySQL database sock file not specified. Using default\n"); ++ dbsock = NULL; ++ } ++ ++ tmp = ast_variable_retrieve(cfg,"global","table"); ++ if (tmp) { ++ dbtable = malloc(strlen(tmp) + 1); ++ if (dbtable != NULL) { ++ dbtable_alloc = 1; ++ strcpy(dbtable,tmp); ++ } else { ++ ast_log(LOG_ERROR,"Out of memory error.\n"); ++ return -1; ++ } ++ } else { ++ ast_log(LOG_NOTICE,"MySQL database table not specified. Assuming \"cdr\"\n"); ++ dbtable = "cdr"; ++ } ++ ++ tmp = ast_variable_retrieve(cfg,"global","password"); ++ if (tmp) { ++ password = malloc(strlen(tmp) + 1); ++ if (password != NULL) { ++ password_alloc = 1; ++ strcpy(password,tmp); ++ } else { ++ ast_log(LOG_ERROR,"Out of memory error.\n"); ++ return -1; ++ } ++ } else { ++ ast_log(LOG_WARNING,"MySQL database password not specified. Assuming blank\n"); ++ password = ""; ++ } ++ ++ tmp = ast_variable_retrieve(cfg,"global","port"); ++ if (tmp) { ++ if (sscanf(tmp,"%d",&dbport) < 1) { ++ ast_log(LOG_WARNING,"Invalid MySQL port number. Using default\n"); ++ dbport = 0; ++ } ++ } ++ ++ tmp = ast_variable_retrieve(cfg,"global","userfield"); ++ if (tmp) { ++ if (sscanf(tmp,"%d",&userfield) < 1) { ++ ast_log(LOG_WARNING,"Invalid MySQL configurtation file\n"); ++ userfield = 0; ++ } ++ } ++ ++ ast_config_destroy(cfg); ++ ++ ast_log(LOG_DEBUG,"cdr_mysql: got hostname of %s\n",hostname); ++ ast_log(LOG_DEBUG,"cdr_mysql: got port of %d\n",dbport); ++ if (dbsock) ++ ast_log(LOG_DEBUG,"cdr_mysql: got sock file of %s\n",dbsock); ++ ast_log(LOG_DEBUG,"cdr_mysql: got user of %s\n",dbuser); ++ ast_log(LOG_DEBUG,"cdr_mysql: got dbname of %s\n",dbname); ++ ast_log(LOG_DEBUG,"cdr_mysql: got password of %s\n",password); ++ ++ mysql_init(&mysql); ++ ++ if (!mysql_real_connect(&mysql, hostname, dbuser, password, dbname, dbport, dbsock, 0)) { ++ ast_log(LOG_ERROR, "Failed to connect to mysql database %s on %s.\n", dbname, hostname); ++ connected = 0; ++ records = 0; ++ } else { ++ ast_log(LOG_DEBUG,"Successfully connected to MySQL database.\n"); ++ connected = 1; ++ records = 0; ++ connect_time = time(NULL); ++ } ++ ++ res = ast_cdr_register(name, desc, mysql_log); ++ if (res) { ++ ast_log(LOG_ERROR, "Unable to register MySQL CDR handling\n"); ++ } else { ++ res = ast_cli_register(&cdr_mysql_status_cli); ++ } ++ ++ return res; ++} ++ ++int load_module(void) ++{ ++ return my_load_module(); ++} ++ ++int unload_module(void) ++{ ++ return my_unload_module(); ++} ++ ++int reload(void) ++{ ++ my_unload_module(); ++ return my_load_module(); ++} ++ ++int usecount(void) ++{ ++ /* Simplistic use count */ ++ if (ast_mutex_trylock(&mysql_lock)) { ++ return 1; ++ } else { ++ ast_mutex_unlock(&mysql_lock); ++ return 0; ++ } ++} ++ ++char *key() ++{ ++ return ASTERISK_GPL_KEY; ++} +diff -ruN asterisk-1.0.7-orig/configs/cdr_mysql.conf.sample asterisk-1.0.7-2/configs/cdr_mysql.conf.sample +--- asterisk-1.0.7-orig/configs/cdr_mysql.conf.sample 1970-01-01 01:00:00.000000000 +0100 ++++ asterisk-1.0.7-2/configs/cdr_mysql.conf.sample 2005-01-21 02:43:19.000000000 +0100 +@@ -0,0 +1,21 @@ ++; ++; Note - if the database server is hosted on the same machine as the ++; asterisk server, you can achieve a local Unix socket connection by ++; setting hostname=localhost ++; ++; port and sock are both optional parameters. If hostname is specified ++; and is not "localhost", then cdr_mysql will attempt to connect to the ++; port specified or use the default port. If hostname is not specified ++; or if hostname is "localhost", then cdr_mysql will attempt to connect ++; to the socket file specified by sock or otherwise use the default socket ++; file. ++; ++;[global] ++;hostname=database.host.name ++;dbname=asteriskcdrdb ++;table=cdr ++;password=password ++;user=asteriskcdruser ++;port=3306 ++;sock=/tmp/mysql.sock ++;userfield=1 |