aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>1999-12-05 07:09:27 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>1999-12-05 07:09:27 +0000
commitcf38740db3247ad69d6c6ad5a2b9693aadefca02 (patch)
treede8b284e53e13ef2e2a40b595eac7d961aed9d44
parent8e2d6060131752f269b65bcb7bc5077a772a31c4 (diff)
Version 0.1.0 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@90 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xcodecs/gsm/Makefile494
-rwxr-xr-xconfigs/adtranvofr.conf.sample37
-rwxr-xr-xconfigs/extensions.conf.sample118
-rwxr-xr-xconfigs/ixj.conf.sample19
-rwxr-xr-xconfigs/modules.conf.sample14
-rwxr-xr-xconfigs/voicemail.conf.sample14
-rwxr-xr-xformats/format_wav.c355
7 files changed, 1051 insertions, 0 deletions
diff --git a/codecs/gsm/Makefile b/codecs/gsm/Makefile
new file mode 100755
index 000000000..4af3788f6
--- /dev/null
+++ b/codecs/gsm/Makefile
@@ -0,0 +1,494 @@
+# Copyright 1992-1996 by Jutta Degener and Carsten Bormann, Technische
+# Universitaet Berlin. See the accompanying file "COPYRIGHT" for
+# details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+
+# Machine- or installation dependent flags you should configure to port
+
+SASR = -DSASR
+######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)
+
+MULHACK = -DUSE_FLOAT_MUL
+######### Define this if your host multiplies floats faster than integers,
+######### e.g. on a SPARCstation.
+
+FAST = -DFAST
+######### Define together with USE_FLOAT_MUL to enable the GSM library's
+######### approximation option for incorrect, but good-enough results.
+
+# LTP_CUT = -DLTP_CUT
+LTP_CUT =
+######### Define to enable the GSM library's long-term correlation
+######### approximation option---faster, but worse; works for
+######### both integer and floating point multiplications.
+######### This flag is still in the experimental stage.
+
+WAV49 = -DWAV49
+#WAV49 =
+######### Define to enable the GSM library's option to pack GSM frames
+######### in the style used by the WAV #49 format. If you want to write
+######### a tool that produces .WAV files which contain GSM-encoded data,
+######### define this, and read about the GSM_OPT_WAV49 option in the
+######### manual page on gsm_option(3).
+
+# Choose a compiler. The code works both with ANSI and K&R-C.
+# Use -DNeedFunctionPrototypes to compile with, -UNeedFunctionPrototypes to
+# compile without, function prototypes in the header files.
+#
+# You can use the -DSTUPID_COMPILER to circumvent some compilers'
+# static limits regarding the number of subexpressions in a statement.
+
+# CC = cc
+# CCFLAGS = -c -DSTUPID_COMPILER
+
+# CC = /usr/lang/acc
+# CCFLAGS = -c -O
+
+CC = gcc -ansi -pedantic
+CCFLAGS += -c -DNeedFunctionPrototypes=1 -finline-functions -funroll-loops
+
+LD = $(CC)
+
+# LD = gcc
+# LDFLAGS =
+
+
+# If your compiler needs additional flags/libraries, regardless of
+# the source compiled, configure them here.
+
+# CCINC = -I/usr/gnu/lib/gcc-2.1/gcc-lib/sparc-sun-sunos4.1.2/2.1/include
+######### Includes needed by $(CC)
+
+# LDINC = -L/usr/gnu/lib/gcc-2.1/gcc-lib/sparc-sun-sunos4.1.2/2.1
+######### Library paths needed by $(LD)
+
+# LDLIB = -lgcc
+######### Additional libraries needed by $(LD)
+
+
+# Where do you want to install libraries, binaries, a header file
+# and the manual pages?
+#
+# Leave INSTALL_ROOT empty (or just don't execute "make install") to
+# not install gsm and toast outside of this directory.
+
+INSTALL_ROOT =
+
+# Where do you want to install the gsm library, header file, and manpages?
+#
+# Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of
+# this directory.
+
+GSM_INSTALL_ROOT = $(INSTALL_ROOT)
+GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
+GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
+GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
+
+
+# Where do you want to install the toast binaries and their manpage?
+#
+# Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside
+# of this directory.
+
+TOAST_INSTALL_ROOT = $(INSTALL_ROOT)
+TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
+TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
+
+# Other tools
+
+SHELL = /bin/sh
+LN = ln
+BASENAME = basename
+AR = ar
+ARFLAGS = cr
+RMFLAGS = -f
+FIND = find
+COMPRESS = compress
+COMPRESSFLAGS =
+# RANLIB = true
+RANLIB = ranlib
+
+#
+# You shouldn't have to configure below this line if you're porting.
+#
+
+
+# Local Directories
+
+ROOT = .
+ADDTST = $(ROOT)/add-test
+TST = $(ROOT)/tst
+MAN = $(ROOT)/man
+BIN = $(ROOT)/bin
+SRC = $(ROOT)/src
+LIB = $(ROOT)/lib
+TLS = $(ROOT)/tls
+INC = $(ROOT)/inc
+
+# Flags
+
+# DEBUG = -DNDEBUG
+######### Remove -DNDEBUG to enable assertions.
+
+CFLAGS = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
+ $(WAV49) $(CCINC) -I$(INC)
+######### It's $(CC) $(CFLAGS)
+
+LFLAGS = $(LDFLAGS) $(LDINC)
+######### It's $(LD) $(LFLAGS)
+
+
+# Targets
+
+LIBGSM = $(LIB)/libgsm.a
+
+TOAST = $(BIN)/toast
+UNTOAST = $(BIN)/untoast
+TCAT = $(BIN)/tcat
+
+# Headers
+
+GSM_HEADERS = $(INC)/gsm.h
+
+HEADERS = $(INC)/proto.h \
+ $(INC)/unproto.h \
+ $(INC)/config.h \
+ $(INC)/private.h \
+ $(INC)/gsm.h \
+ $(INC)/toast.h \
+ $(TLS)/taste.h
+
+# Sources
+
+GSM_SOURCES = $(SRC)/add.c \
+ $(SRC)/code.c \
+ $(SRC)/debug.c \
+ $(SRC)/decode.c \
+ $(SRC)/long_term.c \
+ $(SRC)/lpc.c \
+ $(SRC)/preprocess.c \
+ $(SRC)/rpe.c \
+ $(SRC)/gsm_destroy.c \
+ $(SRC)/gsm_decode.c \
+ $(SRC)/gsm_encode.c \
+ $(SRC)/gsm_explode.c \
+ $(SRC)/gsm_implode.c \
+ $(SRC)/gsm_create.c \
+ $(SRC)/gsm_print.c \
+ $(SRC)/gsm_option.c \
+ $(SRC)/short_term.c \
+ $(SRC)/table.c
+
+TOAST_SOURCES = $(SRC)/toast.c \
+ $(SRC)/toast_lin.c \
+ $(SRC)/toast_ulaw.c \
+ $(SRC)/toast_alaw.c \
+ $(SRC)/toast_audio.c
+
+SOURCES = $(GSM_SOURCES) \
+ $(TOAST_SOURCES) \
+ $(ADDTST)/add_test.c \
+ $(TLS)/sour.c \
+ $(TLS)/ginger.c \
+ $(TLS)/sour1.dta \
+ $(TLS)/sour2.dta \
+ $(TLS)/bitter.c \
+ $(TLS)/bitter.dta \
+ $(TLS)/taste.c \
+ $(TLS)/sweet.c \
+ $(TST)/cod2lin.c \
+ $(TST)/cod2txt.c \
+ $(TST)/gsm2cod.c \
+ $(TST)/lin2cod.c \
+ $(TST)/lin2txt.c
+
+# Object files
+
+GSM_OBJECTS = $(SRC)/add.o \
+ $(SRC)/code.o \
+ $(SRC)/debug.o \
+ $(SRC)/decode.o \
+ $(SRC)/long_term.o \
+ $(SRC)/lpc.o \
+ $(SRC)/preprocess.o \
+ $(SRC)/rpe.o \
+ $(SRC)/gsm_destroy.o \
+ $(SRC)/gsm_decode.o \
+ $(SRC)/gsm_encode.o \
+ $(SRC)/gsm_explode.o \
+ $(SRC)/gsm_implode.o \
+ $(SRC)/gsm_create.o \
+ $(SRC)/gsm_print.o \
+ $(SRC)/gsm_option.o \
+ $(SRC)/short_term.o \
+ $(SRC)/table.o
+
+TOAST_OBJECTS = $(SRC)/toast.o \
+ $(SRC)/toast_lin.o \
+ $(SRC)/toast_ulaw.o \
+ $(SRC)/toast_alaw.o \
+ $(SRC)/toast_audio.o
+
+OBJECTS = $(GSM_OBJECTS) $(TOAST_OBJECTS)
+
+# Manuals
+
+GSM_MANUALS = $(MAN)/gsm.3 \
+ $(MAN)/gsm_explode.3 \
+ $(MAN)/gsm_option.3 \
+ $(MAN)/gsm_print.3
+
+TOAST_MANUALS = $(MAN)/toast.1
+
+MANUALS = $(GSM_MANUALS) $(TOAST_MANUALS) $(MAN)/bitter.1
+
+# Other stuff in the distribution
+
+STUFF = ChangeLog \
+ INSTALL \
+ MACHINES \
+ MANIFEST \
+ Makefile \
+ README \
+ $(ADDTST)/add_test.dta \
+ $(TLS)/bitter.dta \
+ $(TST)/run
+
+
+# Install targets
+
+GSM_INSTALL_TARGETS = \
+ $(GSM_INSTALL_LIB)/libgsm.a \
+ $(GSM_INSTALL_INC)/gsm.h \
+ $(GSM_INSTALL_MAN)/gsm.3 \
+ $(GSM_INSTALL_MAN)/gsm_explode.3 \
+ $(GSM_INSTALL_MAN)/gsm_option.3 \
+ $(GSM_INSTALL_MAN)/gsm_print.3
+
+TOAST_INSTALL_TARGETS = \
+ $(TOAST_INSTALL_BIN)/toast \
+ $(TOAST_INSTALL_BIN)/tcat \
+ $(TOAST_INSTALL_BIN)/untoast \
+ $(TOAST_INSTALL_MAN)/toast.1
+
+
+# Default rules
+
+.c.o:
+ $(CC) $(CFLAGS) $?
+ @-mv `$(BASENAME) $@` $@ > /dev/null 2>&1
+
+# Target rules
+
+all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
+ @-echo $(ROOT): Done.
+
+tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
+ @-echo tst: Done.
+
+addtst: $(ADDTST)/add $(ADDTST)/add_test.dta
+ $(ADDTST)/add < $(ADDTST)/add_test.dta > /dev/null
+ @-echo addtst: Done.
+
+misc: $(TLS)/sweet $(TLS)/bitter $(TLS)/sour $(TLS)/ginger \
+ $(TST)/lin2txt $(TST)/cod2txt $(TST)/gsm2cod
+ @-echo misc: Done.
+
+install: toastinstall gsminstall
+ @-echo install: Done.
+
+
+# The basic API: libgsm
+
+$(LIBGSM): $(LIB) $(GSM_OBJECTS)
+ -rm $(RMFLAGS) $(LIBGSM)
+ $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
+ $(RANLIB) $(LIBGSM)
+
+
+# Toast, Untoast and Tcat -- the compress-like frontends to gsm.
+
+$(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM)
+ $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
+
+$(UNTOAST): $(BIN) $(TOAST)
+ -rm $(RMFLAGS) $(UNTOAST)
+ $(LN) $(TOAST) $(UNTOAST)
+
+$(TCAT): $(BIN) $(TOAST)
+ -rm $(RMFLAGS) $(TCAT)
+ $(LN) $(TOAST) $(TCAT)
+
+
+# The local bin and lib directories
+
+$(BIN):
+ if [ ! -d $(BIN) ] ; then mkdir $(BIN) ; fi
+
+$(LIB):
+ if [ ! -d $(LIB) ] ; then mkdir $(LIB) ; fi
+
+
+# Installation
+
+gsminstall:
+ -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then \
+ make $(GSM_INSTALL_TARGETS) ; \
+ fi
+
+toastinstall:
+ -if [ x"$(TOAST_INSTALL_ROOT)" != x ]; then \
+ make $(TOAST_INSTALL_TARGETS); \
+ fi
+
+gsmuninstall:
+ -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then \
+ rm $(RMFLAGS) $(GSM_INSTALL_TARGETS) ; \
+ fi
+
+toastuninstall:
+ -if [ x"$(TOAST_INSTALL_ROOT)" != x ] ; then \
+ rm $(RMFLAGS) $(TOAST_INSTALL_TARGETS); \
+ fi
+
+$(TOAST_INSTALL_BIN)/toast: $(TOAST)
+ -rm $@
+ cp $(TOAST) $@
+ chmod 755 $@
+
+$(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast
+ -rm $@
+ ln $? $@
+
+$(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast
+ -rm $@
+ ln $? $@
+
+$(TOAST_INSTALL_MAN)/toast.1: $(MAN)/toast.1
+ -rm $@
+ cp $? $@
+ chmod 444 $@
+
+$(GSM_INSTALL_MAN)/gsm.3: $(MAN)/gsm.3
+ -rm $@
+ cp $? $@
+ chmod 444 $@
+
+$(GSM_INSTALL_MAN)/gsm_option.3: $(MAN)/gsm_option.3
+ -rm $@
+ cp $? $@
+ chmod 444 $@
+
+$(GSM_INSTALL_MAN)/gsm_explode.3: $(MAN)/gsm_explode.3
+ -rm $@
+ cp $? $@
+ chmod 444 $@
+
+$(GSM_INSTALL_MAN)/gsm_print.3: $(MAN)/gsm_print.3
+ -rm $@
+ cp $? $@
+ chmod 444 $@
+
+$(GSM_INSTALL_INC)/gsm.h: $(INC)/gsm.h
+ -rm $@
+ cp $? $@
+ chmod 444 $@
+
+$(GSM_INSTALL_LIB)/libgsm.a: $(LIBGSM)
+ -rm $@
+ cp $? $@
+ chmod 444 $@
+
+
+# Distribution
+
+dist: gsm-1.0.tar.Z
+ @echo dist: Done.
+
+gsm-1.0.tar.Z: $(STUFF) $(SOURCES) $(HEADERS) $(MANUALS)
+ ( cd $(ROOT)/..; \
+ tar cvf - `cat $(ROOT)/gsm-1.0/MANIFEST \
+ | sed '/^#/d'` \
+ ) | $(COMPRESS) $(COMPRESSFLAGS) > $(ROOT)/gsm-1.0.tar.Z
+
+# Clean
+
+uninstall: toastuninstall gsmuninstall
+ @-echo uninstall: Done.
+
+semi-clean:
+ -rm $(RMFLAGS) */*.o \
+ $(TST)/lin2cod $(TST)/lin2txt \
+ $(TST)/cod2lin $(TST)/cod2txt \
+ $(TST)/gsm2cod \
+ $(TST)/*.*.*
+ -$(FIND) . \( -name core -o -name foo \) \
+ -print | xargs rm $(RMFLAGS)
+
+clean: semi-clean
+ -rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \
+ $(TOAST) $(TCAT) $(UNTOAST) \
+ $(ROOT)/gsm-1.0.tar.Z
+
+
+# Two tools that helped me generate gsm_encode.c and gsm_decode.c,
+# but aren't generally needed to port this.
+
+$(TLS)/sweet: $(TLS)/sweet.o $(TLS)/taste.o
+ $(LD) $(LFLAGS) -o $(TLS)/sweet \
+ $(TLS)/sweet.o $(TLS)/taste.o $(LDLIB)
+
+$(TLS)/bitter: $(TLS)/bitter.o $(TLS)/taste.o
+ $(LD) $(LFLAGS) -o $(TLS)/bitter \
+ $(TLS)/bitter.o $(TLS)/taste.o $(LDLIB)
+
+# A version of the same family that Jeff Chilton used to implement
+# the WAV #49 GSM format.
+
+$(TLS)/ginger: $(TLS)/ginger.o $(TLS)/taste.o
+ $(LD) $(LFLAGS) -o $(TLS)/ginger \
+ $(TLS)/ginger.o $(TLS)/taste.o $(LDLIB)
+
+$(TLS)/sour: $(TLS)/sour.o $(TLS)/taste.o
+ $(LD) $(LFLAGS) -o $(TLS)/sour \
+ $(TLS)/sour.o $(TLS)/taste.o $(LDLIB)
+
+# Run $(ADDTST)/add < $(ADDTST)/add_test.dta to make sure the
+# basic arithmetic functions work as intended.
+
+$(ADDTST)/add: $(ADDTST)/add_test.o
+ $(LD) $(LFLAGS) -o $(ADDTST)/add $(ADDTST)/add_test.o $(LDLIB)
+
+
+# Various conversion programs between linear, text, .gsm and the code
+# format used by the tests we ran (.cod). We paid for the test data,
+# so I guess we can't just provide them with this package. Still,
+# if you happen to have them lying around, here's the code.
+#
+# You can use gsm2cod | cod2txt independently to look at what's
+# coded inside the compressed frames, although this shouldn't be
+# hard to roll on your own using the gsm_print() function from
+# the API.
+
+
+$(TST)/test-result: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/run
+ ( cd $(TST); ./run )
+
+$(TST)/lin2txt: $(TST)/lin2txt.o $(LIBGSM)
+ $(LD) $(LFLAGS) -o $(TST)/lin2txt \
+ $(TST)/lin2txt.o $(LIBGSM) $(LDLIB)
+
+$(TST)/lin2cod: $(TST)/lin2cod.o $(LIBGSM)
+ $(LD) $(LFLAGS) -o $(TST)/lin2cod \
+ $(TST)/lin2cod.o $(LIBGSM) $(LDLIB)
+
+$(TST)/gsm2cod: $(TST)/gsm2cod.o $(LIBGSM)
+ $(LD) $(LFLAGS) -o $(TST)/gsm2cod \
+ $(TST)/gsm2cod.o $(LIBGSM) $(LDLIB)
+
+$(TST)/cod2txt: $(TST)/cod2txt.o $(LIBGSM)
+ $(LD) $(LFLAGS) -o $(TST)/cod2txt \
+ $(TST)/cod2txt.o $(LIBGSM) $(LDLIB)
+
+$(TST)/cod2lin: $(TST)/cod2lin.o $(LIBGSM)
+ $(LD) $(LFLAGS) -o $(TST)/cod2lin \
+ $(TST)/cod2lin.o $(LIBGSM) $(LDLIB)
diff --git a/configs/adtranvofr.conf.sample b/configs/adtranvofr.conf.sample
new file mode 100755
index 000000000..df19e094e
--- /dev/null
+++ b/configs/adtranvofr.conf.sample
@@ -0,0 +1,37 @@
+;
+; Voice over Frame Relay (Adtran style)
+;
+; Configuration file
+;
+[interfaces]
+;
+; Lines for which we are the user termination. They accept incoming
+; and outgoing calls.
+;
+;user=voice00
+;user=voice01
+;user=voice02
+;user=voice03
+;user=voice04
+;user=voice05
+;user=voice06
+;user=voice07
+context=default
+user=voice13
+user=voice14
+user=voice15
+; Calls on 16 and 17 come from the outside world, so they get
+; a little bit special treatment
+context=remote
+user=voice16
+user=voice17
+;
+; Next we have lines which we only accept calls on, and typically
+; do not send outgoing calls on (i.e. these are where we are the
+; network termination)
+;
+;network=voice08
+;network=voice09
+;network=voice10
+;network=voice11
+;network=voice12
diff --git a/configs/extensions.conf.sample b/configs/extensions.conf.sample
new file mode 100755
index 000000000..e654c4597
--- /dev/null
+++ b/configs/extensions.conf.sample
@@ -0,0 +1,118 @@
+;
+; Static extension configuration files, used by
+; the pbx_config module.
+;
+; The "General" category is for certain variables. All other categories
+; are interpreted as extension contexts
+;
+[general]
+;
+; If static is set to no, or omitted, then the pbx_config will rewrite
+; this file when extensions are modified. Remember that all comments
+; made in the file will be lost when that happens.
+;
+static=yes
+
+; Remote things always ring all phones first.
+[remote]
+exten=s,1,Dial,AdtranVoFR/4200&AdtranVoFR/4151&AdtranVoFR/4300|15
+exten=s,2,Goto,default|s|2
+
+; Local stuff
+[local]
+exten=s,1,Goto,defaults|s|2
+; Special extension for local phone numbers, long distance, etc, going
+; out via the Frame Relay interface. Patterns are prefixed with "_", which
+; is ignored.
+exten=_9NXXXXXX,1,Dial,AdtranVoFR/BYEXTENSION
+exten=_91NXXNXXXXXX,1,Dial,AdtranVoFR/BYEXTENSION
+exten=_9911,1,Dial,AdtranVoFR/BYEXTENSION
+
+[default]
+exten=s,1,Wait,0
+exten=s,2,Answer
+exten=s,3,DigitTimeout,5
+exten=s,4,ResponseTimeout,10
+exten=s,5,BackGround,welcome
+exten=*,1,Directory,default
+exten=*,2,Goto,s|4
+exten=#,1,Playback,goodbye
+exten=#,2,Hangup
+exten=100,1,Goto,other|s|1
+exten=200,1,Intercom
+exten=400,1,MP3Player,song8.mp3
+exten=401,1,MP3Player,sample.mp3
+exten=402,1,MP3Player,sunscreen.mp3
+exten=403,1,MP3Player,http://trode.vergenet.net:8000
+exten=404,1,MP3Player,http://216.32.166.94:14900
+exten=405,1,Playback,sample
+;
+; Here's the template for a typical extension, carefully broken apart
+; for analysis. The others are pretty much the same, but not as well
+; documented.
+;
+; Step 1: Play back a "Please hold while I try that extension" message
+exten=4300,1,Playback,transfer
+; Step 2: Dial the numbers where Ben is likely to be. Try for no more
+; than 15 seconds.
+exten=4300,2,Dial,AdtranVoFR/4300|15
+; Step 3: If there is no answer, play back a message stating that Ben is
+; unavailable. Alternatively, we could have rung an operator first.
+exten=4300,3,Playback,vm/4300/unavail
+; Step 4: Send them to voicemail.
+exten=4300,4,Voicemail,4300
+; Step 5: If they return from voicemail, go back to the top
+exten=4300,5,Goto,s|4
+; Step 103: If the Dialing is busy, it will try here first. We'll play a
+; special "I'm busy" message...
+exten=4300,103,Playback,vm/4300/busy
+; Step 104: And then continue as if it had been busy in the first place.
+exten=4300,104,Goto,4
+; Exten. 4301: Provide a short-circuit so we can transfer striaght to
+; voicemail.
+exten=4301,1,Goto,4300|3
+; Exten. 4302: Provide a way to ring a given phone indefinitely
+exten=4302,1,Dial,AdtranVoFR/4300
+
+exten=4200,1,Playback,transfer
+exten=4200,2,Dial,AdtranVoFR/4200|15
+exten=4200,3,Playback,vm/4200/unavail
+exten=4200,4,Voicemail,4200
+exten=4200,5,Goto,s|4
+exten=4200,103,Playback,vm/4200/busy
+exten=4200,104,Goto,4
+exten=4201,1,Goto,4200|3
+exten=4202,1,Dial,AdtranVoFR/4200
+
+exten=4230,1,Dial,PhoneJack/ixj0
+
+exten=4110,1,Playback,transfer
+;exten=4110,2,Dial,AdtranVoFR/4110|15
+exten=4110,2,Wait,5
+exten=4110,3,Playback,vm/4110/unavail
+exten=4110,4,Voicemail,4110
+exten=4110,5,Goto,s|4
+exten=4110,103,Playback,vm/4110/busy
+exten=4110,104,Goto,4
+exten=4111,1,Goto,4110|3
+exten=4112,1,Dial,AdtranVoFR/4110
+exten=4113,1,Voicemail,s4110
+
+exten=8500,1,VoicemailMain
+exten=8500,2,Goto,s|4
+exten=762,1,Playback,somepeople
+exten=762,2,Wait,4
+exten=762,3,Goto,s|4
+
+; Timeout stuff... We could send to an operator, or just ditch them.
+exten=t,1,Goto,#|1
+exten=i,1,BackGround,invalid
+
+[other]
+exten=s,1,Playback,digits/9
+exten=s,2,Playback,digits/8
+exten=s,3,Playback,digits/7
+exten=s,4,Goto,100|1
+exten=100,1,Playback,digits/6
+exten=100,2,Playback,digits/5
+exten=100,3,Goto,default|s|4
diff --git a/configs/ixj.conf.sample b/configs/ixj.conf.sample
new file mode 100755
index 000000000..ed6be96c1
--- /dev/null
+++ b/configs/ixj.conf.sample
@@ -0,0 +1,19 @@
+;
+; Internet Phone Jack
+;
+; Configuration file
+;
+[interfaces]
+;
+; Select a mode, either the line jack provides dialtone, reads digits,
+; then starts PBX with the given extension (dialtone mode), or
+; immediately provides the PBX without reading any digits or providing
+; any dialtone (this is the immediate mode, the default)
+;
+;mode=immediate
+mode=dialtone
+;
+; List all devices we can use.
+;
+context=local
+device=/dev/ixj0
diff --git a/configs/modules.conf.sample b/configs/modules.conf.sample
new file mode 100755
index 000000000..2fe03093b
--- /dev/null
+++ b/configs/modules.conf.sample
@@ -0,0 +1,14 @@
+;
+; Asterisk configuration file
+;
+; Module Loader configuration file
+;
+[modules]
+autoload=yes
+;load=pbx_gtkconsole.so
+noload=pbx_gtkconsole.so
+noload=pbx_kdeconsole.so
+noload=app_intercom.so
+;load=chan_vofr.so
+;load=chan_h323.so
+
diff --git a/configs/voicemail.conf.sample b/configs/voicemail.conf.sample
new file mode 100755
index 000000000..2d30f3fa0
--- /dev/null
+++ b/configs/voicemail.conf.sample
@@ -0,0 +1,14 @@
+;
+; Voicemail Configuration
+;
+[general]
+; Default format for writing Voicemail
+; format=g723sf|rawgsm|mp3|wav
+format=g723sf|wav
+
+[default]
+4200=2345,Mark Spencer,markster@linux-support.net
+4300=2345,Ben Rigas,ben@american-computer.net
+4310=2345,Sales,sales@marko.net
+4069=2345,Matt Brooks,matt@marko.net
+4110=1379,Rob Flynn,rflynn@blueridge.net
diff --git a/formats/format_wav.c b/formats/format_wav.c
new file mode 100755
index 000000000..e3265d379
--- /dev/null
+++ b/formats/format_wav.c
@@ -0,0 +1,355 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * Microsoft WAV File Format using libaudiofile
+ *
+ * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ *
+ * Mark Spencer <markster@linux-support.net>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ */
+
+#include <asterisk/channel.h>
+#include <asterisk/file.h>
+#include <asterisk/logger.h>
+#include <asterisk/sched.h>
+#include <asterisk/module.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <pthread.h>
+#include <audiofile.h>
+
+
+/* Read 320 samples at a time, max */
+#define WAV_MAX_SIZE 320
+
+/* Fudge in milliseconds */
+#define WAV_FUDGE 2
+
+struct ast_filestream {
+ /* First entry MUST be reserved for the channel type */
+ void *reserved[AST_RESERVED_POINTERS];
+ /* This is what a filestream means to us */
+ int fd; /* Descriptor */
+ /* Audio File */
+ AFfilesetup afs;
+ AFfilehandle af;
+ int lasttimeout;
+ struct ast_channel *owner;
+ struct ast_filestream *next;
+ struct ast_frame fr; /* Frame information */
+ char waste[AST_FRIENDLY_OFFSET]; /* Buffer for sending frames, etc */
+ short samples[WAV_MAX_SIZE];
+};
+
+
+static struct ast_filestream *glist = NULL;
+static pthread_mutex_t wav_lock = PTHREAD_MUTEX_INITIALIZER;
+static int glistcnt = 0;
+
+static char *name = "wav";
+static char *desc = "Microsoft WAV format (PCM/16, 8000Hz mono)";
+static char *exts = "wav";
+
+static struct ast_filestream *wav_open(int fd)
+{
+ /* We don't have any header to read or anything really, but
+ if we did, it would go here. We also might want to check
+ and be sure it's a valid file. */
+ struct ast_filestream *tmp;
+ int notok = 0;
+ int fmt, width;
+ double rate;
+ if ((tmp = malloc(sizeof(struct ast_filestream)))) {
+ tmp->afs = afNewFileSetup();
+ if (!tmp->afs) {
+ ast_log(LOG_WARNING, "Unable to create file setup\n");
+ free(tmp);
+ return NULL;
+ }
+ afInitFileFormat(tmp->afs, AF_FILE_WAVE);
+ tmp->af = afOpenFD(fd, "r", tmp->afs);
+ if (!tmp->af) {
+ afFreeFileSetup(tmp->afs);
+ ast_log(LOG_WARNING, "Unable to open file descriptor\n");
+ free(tmp);
+ return NULL;
+ }
+#if 0
+ afGetFileFormat(tmp->af, &version);
+ if (version != AF_FILE_WAVE) {
+ ast_log(LOG_WARNING, "This is not a wave file (%d)\n", version);
+ notok++;
+ }
+#endif
+ /* Read the format and make sure it's exactly what we seek. */
+ if (afGetChannels(tmp->af, AF_DEFAULT_TRACK) != 1) {
+ ast_log(LOG_WARNING, "Invalid number of channels %d. Should be mono (1)\n", afGetChannels(tmp->af, AF_DEFAULT_TRACK));
+ notok++;
+ }
+ afGetSampleFormat(tmp->af, AF_DEFAULT_TRACK, &fmt, &width);
+ if (fmt != AF_SAMPFMT_TWOSCOMP) {
+ ast_log(LOG_WARNING, "Input file is not signed\n");
+ notok++;
+ }
+ rate = afGetRate(tmp->af, AF_DEFAULT_TRACK);
+ if ((rate < 7900) || (rate > 8100)) {
+ ast_log(LOG_WARNING, "Rate %f is not close enough to 8000 Hz\n", rate);
+ notok++;
+ }
+ if (width != 16) {
+ ast_log(LOG_WARNING, "Input file is not 16-bit\n");
+ notok++;
+ }
+ if (notok) {
+ afCloseFile(tmp->af);
+ afFreeFileSetup(tmp->afs);
+ free(tmp);
+ return NULL;
+ }
+ if (pthread_mutex_lock(&wav_lock)) {
+ afCloseFile(tmp->af);
+ afFreeFileSetup(tmp->afs);
+ ast_log(LOG_WARNING, "Unable to lock wav list\n");
+ free(tmp);
+ return NULL;
+ }
+ tmp->next = glist;
+ glist = tmp;
+ tmp->fd = fd;
+ tmp->owner = NULL;
+ tmp->fr.data = tmp->samples;
+ tmp->fr.frametype = AST_FRAME_VOICE;
+ tmp->fr.subclass = AST_FORMAT_SLINEAR;
+ /* datalen will vary for each frame */
+ tmp->fr.src = name;
+ tmp->fr.mallocd = 0;
+ tmp->lasttimeout = -1;
+ glistcnt++;
+ pthread_mutex_unlock(&wav_lock);
+ ast_update_use_count();
+ }
+ return tmp;
+}
+
+static struct ast_filestream *wav_rewrite(int fd, char *comment)
+{
+ /* We don't have any header to read or anything really, but
+ if we did, it would go here. We also might want to check
+ and be sure it's a valid file. */
+ struct ast_filestream *tmp;
+ if ((tmp = malloc(sizeof(struct ast_filestream)))) {
+ tmp->afs = afNewFileSetup();
+ if (!tmp->afs) {
+ ast_log(LOG_WARNING, "Unable to create file setup\n");
+ free(tmp);
+ return NULL;
+ }
+ /* WAV format */
+ afInitFileFormat(tmp->afs, AF_FILE_WAVE);
+ /* Mono */
+ afInitChannels(tmp->afs, AF_DEFAULT_TRACK, 1);
+ /* Signed linear, 16-bit */
+ afInitSampleFormat(tmp->afs, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
+ /* 8000 Hz */
+ afInitRate(tmp->afs, AF_DEFAULT_TRACK, (double)8000.0);
+ tmp->af = afOpenFD(fd, "w", tmp->afs);
+ if (!tmp->af) {
+ afFreeFileSetup(tmp->afs);
+ ast_log(LOG_WARNING, "Unable to open file descriptor\n");
+ free(tmp);
+ return NULL;
+ }
+ if (pthread_mutex_lock(&wav_lock)) {
+ ast_log(LOG_WARNING, "Unable to lock wav list\n");
+ free(tmp);
+ return NULL;
+ }
+ tmp->next = glist;
+ glist = tmp;
+ tmp->fd = fd;
+ tmp->owner = NULL;
+ tmp->lasttimeout = -1;
+ glistcnt++;
+ pthread_mutex_unlock(&wav_lock);
+ ast_update_use_count();
+ } else
+ ast_log(LOG_WARNING, "Out of memory\n");
+ return tmp;
+}
+
+static struct ast_frame *wav_read(struct ast_filestream *s)
+{
+ return NULL;
+}
+
+static void wav_close(struct ast_filestream *s)
+{
+ struct ast_filestream *tmp, *tmpl = NULL;
+ if (pthread_mutex_lock(&wav_lock)) {
+ ast_log(LOG_WARNING, "Unable to lock wav list\n");
+ return;
+ }
+ tmp = glist;
+ while(tmp) {
+ if (tmp == s) {
+ if (tmpl)
+ tmpl->next = tmp->next;
+ else
+ glist = tmp->next;
+ break;
+ }
+ tmpl = tmp;
+ tmp = tmp->next;
+ }
+ glistcnt--;
+ if (s->owner) {
+ s->owner->stream = NULL;
+ if (s->owner->streamid > -1)
+ ast_sched_del(s->owner->sched, s->owner->streamid);
+ s->owner->streamid = -1;
+ }
+ pthread_mutex_unlock(&wav_lock);
+ ast_update_use_count();
+ if (!tmp)
+ ast_log(LOG_WARNING, "Freeing a filestream we don't seem to own\n");
+ afCloseFile(tmp->af);
+ afFreeFileSetup(tmp->afs);
+ close(s->fd);
+ free(s);
+}
+
+static int ast_read_callback(void *data)
+{
+ u_int32_t delay = -1;
+ int retval = 0;
+ int res;
+ struct ast_filestream *s = data;
+ /* Send a frame from the file to the appropriate channel */
+
+ if ((res = afReadFrames(s->af, AF_DEFAULT_TRACK, s->samples, sizeof(s->samples)/2)) < 1) {
+ if (res)
+ ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno));
+ s->owner->streamid = -1;
+ return 0;
+ }
+ /* Per 8 samples, one milisecond */
+ delay = res / 8;
+ s->fr.frametype = AST_FRAME_VOICE;
+ s->fr.subclass = AST_FORMAT_SLINEAR;
+ s->fr.offset = AST_FRIENDLY_OFFSET;
+ s->fr.datalen = res * 2;
+ s->fr.data = s->samples;
+ s->fr.mallocd = 0;
+ s->fr.timelen = delay;
+ /* Unless there is no delay, we're going to exit out as soon as we
+ have processed the current frame. */
+ /* If there is a delay, lets schedule the next event */
+ if (delay != s->lasttimeout) {
+ /* We'll install the next timeout now. */
+ s->owner->streamid = ast_sched_add(s->owner->sched,
+ delay,
+ ast_read_callback, s);
+
+ s->lasttimeout = delay;
+ } else {
+ /* Just come back again at the same time */
+ retval = -1;
+ }
+ /* Lastly, process the frame */
+ if (ast_write(s->owner, &s->fr)) {
+ ast_log(LOG_WARNING, "Failed to write frame\n");
+ s->owner->streamid = -1;
+ return 0;
+ }
+
+ return retval;
+}
+
+static int wav_apply(struct ast_channel *c, struct ast_filestream *s)
+{
+ /* Select our owner for this stream, and get the ball rolling. */
+ s->owner = c;
+ ast_read_callback(s);
+ return 0;
+}
+
+static int wav_write(struct ast_filestream *fs, struct ast_frame *f)
+{
+ int res;
+ if (f->frametype != AST_FRAME_VOICE) {
+ ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
+ return -1;
+ }
+ if (f->subclass != AST_FORMAT_SLINEAR) {
+ ast_log(LOG_WARNING, "Asked to write non-signed linear frame (%d)!\n", f->subclass);
+ return -1;
+ }
+ if ((res = afWriteFrames(fs->af, AF_DEFAULT_TRACK, f->data, f->datalen/2)) != f->datalen/2) {
+ ast_log(LOG_WARNING, "Unable to write frame: res=%d (%s)\n", res, strerror(errno));
+ return -1;
+ }
+ return 0;
+}
+
+char *wav_getcomment(struct ast_filestream *s)
+{
+ return NULL;
+}
+
+int load_module()
+{
+ return ast_format_register(name, exts, AST_FORMAT_SLINEAR,
+ wav_open,
+ wav_rewrite,
+ wav_apply,
+ wav_write,
+ wav_read,
+ wav_close,
+ wav_getcomment);
+
+
+}
+
+int unload_module()
+{
+ struct ast_filestream *tmp, *tmpl;
+ if (pthread_mutex_lock(&wav_lock)) {
+ ast_log(LOG_WARNING, "Unable to lock wav list\n");
+ return -1;
+ }
+ tmp = glist;
+ while(tmp) {
+ if (tmp->owner)
+ ast_softhangup(tmp->owner);
+ tmpl = tmp;
+ tmp = tmp->next;
+ free(tmpl);
+ }
+ pthread_mutex_unlock(&wav_lock);
+ return ast_format_unregister(name);
+}
+
+int usecount()
+{
+ int res;
+ if (pthread_mutex_lock(&wav_lock)) {
+ ast_log(LOG_WARNING, "Unable to lock wav list\n");
+ return -1;
+ }
+ res = glistcnt;
+ pthread_mutex_unlock(&wav_lock);
+ return res;
+}
+
+char *description()
+{
+ return desc;
+}
+