.EXPORT_ALL_VARIABLES:
+include makeopts
+
#Uncomment this to see all build commands instead of 'quiet' output
#NOISY_BUILD=yes
# Create OPTIONS variable
OPTIONS=
-# If cross compiling, define these to suit
-#CROSS_COMPILE=/opt/montavista/pro/devkit/arm/xscale_be/bin/xscale_be-
-#CROSS_COMPILE_BIN=/opt/montavista/pro/devkit/arm/xscale_be/bin/
-#CROSS_COMPILE_TARGET=/opt/montavista/pro/devkit/arm/xscale_be/target
-#CROSS_ARCH=Linux
-#CROSS_PROC=arm
-#SUB_PROC=xscale # or maverick
-
-ifeq ($(CROSS_COMPILE),)
- OSARCH:=$(shell uname -s)
- PROC?:=$(shell uname -m)
-else
- OSARCH=$(CROSS_ARCH)
- PROC=$(CROSS_PROC)
-endif
-
ASTTOPDIR:=$(shell pwd)
-# Remember the MAKELEVEL at the top
-MAKETOPLEVEL?=$(MAKELEVEL)
-
# Overwite config files on "make samples"
OVERWRITE=y
# For example, make DESTDIR=/tmp/asterisk woud put things in
# /tmp/asterisk/etc/asterisk
# !!! Watch out, put no spaces or comments after the value !!!
-DESTDIR?=
#DESTDIR?=/tmp/asterisk
-# Original busydetect routine
-#BUSYDETECT = -DBUSYDETECT
-
-# Improved busydetect routine, comment the previous one if you use this one
-#BUSYDETECT+= -DBUSYDETECT_MARTIN
-# Detect the busy signal looking only at tone lengths
-# For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
-#BUSYDETECT+= -DBUSYDETECT_TONEONLY
-# Enforce the detection of busy signal (get rid of false hangups)
-# Don't use together with -DBUSYDETECT_TONEONLY
-#BUSYDETECT+= -DBUSYDETECT_COMPARE_TONE_AND_SILENCE
-
# Define standard directories for various platforms
# These apply if they are not redefined in asterisk.conf
ifeq ($(OSARCH),SunOS)
GLOBAL_MAKEOPTS=$(wildcard /etc/asterisk.makeopts)
USER_MAKEOPTS=$(wildcard ~/.asterisk.makeopts)
-ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),)
- ifneq ($(wildcard menuselect.makeopts),)
- include menuselect.makeopts
- include menuselect.makedeps
- endif
-endif
-
-ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),)
- ifneq ($(wildcard makeopts),)
- include makeopts
- endif
-endif
-
-TOPDIR_CFLAGS=-Iinclude
-MOD_SUBDIR_CFLAGS=-I../include -I..
-OTHER_SUBDIR_CFLAGS=-I../include -I..
-
-ifeq ($(origin MENUSELECT_CFLAGS),undefined)
- MENUSELECT_CFLAGS:=$(shell grep MENUSELECT_CFLAGS $(USER_MAKEOPTS) .)
- ifeq ($(MENUSELECT_CFLAGS),)
- MENUSELECT_CFLAGS:=$(shell grep MENUSELECT_CFLAGS $(GLOBAL_MAKEOPTS) .)
- endif
- ifneq ($(MENUSELECT_CFLAGS),)
- MENUSELECT_CFLAGS:=$(shell echo $(MENUSELECT_CFLAGS) | cut -f2 -d'=')
- endif
-endif
-
-ifeq ($(findstring dont-optimize,$(MAKECMDGOALS)),$(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)))
-# More GSM codec optimization
-# Uncomment to enable MMXTM optimizations for x86 architecture CPU's
-# which support MMX instructions. This should be newer pentiums,
-# ppro's, etc, as well as the AMD K6 and K7.
-#K6OPT = -DK6OPT
-
-# Tell gcc to optimize the code
-OPTIMIZE+=-O6
-else
- # Stack backtraces, while useful for debugging, are incompatible with optimizations
- ifeq ($(OSARCH),Linux)
- CFLAGS+=-DSTACK_BACKTRACES
- endif
-endif
-
-# *CLI> show memory allocations [filename]
-# *CLI> show memory summary [filename]
-ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
- TOPDIR_CFLAGS+=-include include/asterisk/astmm.h
- MOD_SUBDIR_CFLAGS+=-include ../include/asterisk/astmm.h
-endif
+MOD_SUBDIR_CFLAGS=-I../include -I../main
+OTHER_SUBDIR_CFLAGS=-I../include
-MOD_SUBDIR_CFLAGS+=-fPIC
-
-ifeq ($(OSARCH),Linux)
+ifeq ($(OSARCH),linux-gnu)
ifeq ($(PROC),x86_64)
# You must have GCC 3.4 to use k8, otherwise use athlon
PROC=k8
endif
endif
-GREP=grep
ID=id
ifeq ($(OSARCH),SunOS)
- GREP=/usr/xpg4/bin/grep
M4=/usr/local/bin/m4
ID=/usr/xpg4/bin/id
endif
ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
-ifneq ($(OPTIMIZE),)
-ASTCFLAGS+=$(OPTIMIZE)
-endif
ifeq ($(AST_DEVMODE),yes)
ASTCFLAGS+=-Werror -Wunused
endif
-ASTOBJ=-o asterisk
-
-ifeq ($(findstring BSD,$(OSARCH)),BSD)
- ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
+ifneq ($(findstring BSD,$(OSARCH)),)
+ ASTCFLAGS+=-I/usr/local/include -L/usr/local/lib
endif
ifneq ($(PROC),ultrasparc)
endif
ifeq ($(OSARCH),FreeBSD)
- BSDVERSION=$(shell make -V OSVERSION -f $(CROSS_COMPILE_TARGET)/usr/share/mk/bsd.port.subdir.mk)
+ BSDVERSION=$(shell make -V OSVERSION -f /usr/share/mk/bsd.port.subdir.mk)
ASTCFLAGS+=$(shell if test $(BSDVERSION) -lt 500016 ; then echo "-D_THREAD_SAFE"; fi)
AST_LIBS+=$(shell if test $(BSDVERSION) -lt 502102 ; then echo "-lc_r"; else echo "-pthread"; fi)
-endif # FreeBSD
+endif
ifeq ($(OSARCH),NetBSD)
- AST_CFLAGS+=-pthread -I$(CROSS_COMPILE_TARGET)/usr/pkg/include
+ ASTCFLAGS+=-pthread -I/usr/pkg/include
endif
ifeq ($(OSARCH),OpenBSD)
endif
ifeq ($(OSARCH),SunOS)
- ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/opt/ssl/include -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
+ ASTCFLAGS+=-Wcast-align -DSOLARIS -Iinclude/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include
endif
-LIBEDIT=editline/libedit.a
-
ASTERISKVERSION:=$(shell build_tools/make_version .)
ifneq ($(wildcard .version),)
ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
-MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs
+MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
OTHER_SUBDIRS:=utils agi
+# Note: OTHER_SUBDIRS must be after MOD_SUBDIRS, because 'utils' uses files from 'main'
SUBDIRS:=$(MOD_SUBDIRS) $(OTHER_SUBDIRS)
SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)
SUBDIRS_CLEAN_DEPEND:=$(SUBDIRS:%=%-clean-depend)
MOD_SUBDIRS_DEPEND:=$(MOD_SUBDIRS:%=%-depend)
OTHER_SUBDIRS_DEPEND:=$(OTHER_SUBDIRS:%=%-depend)
-SUBDIRS_DEPEND:=$(MOD_SUBDIRS_DEPEND) $(OTHER_SUBDIRS_DEPEND)
+SUBDIRS_DEPEND:=$(OTHER_SUBDIRS_DEPEND) $(MOD_SUBDIRS_DEPEND)
SUBDIRS_UNINSTALL:=$(SUBDIRS:%=%-uninstall)
+MOD_SUBDIRS_EMBED_LDSCRIPT:=$(MOD_SUBDIRS:%=%-embed-ldscript)
+MOD_SUBDIRS_EMBED_LDFLAGS:=$(MOD_SUBDIRS:%=%-embed-ldflags)
+MOD_SUBDIRS_EMBED_LIBS:=$(MOD_SUBDIRS:%=%-embed-libs)
-OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
- translate.o file.o pbx.o cli.o md5.o term.o \
- ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
- cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
- dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
- astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
- utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
- netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
- cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o
-
-# we need to link in the objects statically, not as a library, because
-# otherwise modules will not have them available if none of the static
-# objects use it.
-OBJS+=stdtime/localtime.o
-
-# At the moment say.o is an optional component which can be overridden
-# by a module.
-OBJS+=say.o
-
-ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
- OBJS+= poll.o
- ASTCFLAGS+=-DPOLLCOMPAT
-endif
-
-ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),)
- OBJS+= dlfcn.o
- ASTCFLAGS+=-DDLFCNCOMPAT
-endif
-
-ifeq ($(OSARCH),Linux)
- AST_LIBS+=-ldl -lpthread $(EDITLINE_LIB) -lm -lresolv #-lnjamd
-else
- AST_LIBS+=$(EDITLINE_LIB) -lm
-endif
-
-ifeq ($(OSARCH),Darwin)
- AST_LIBS+=-lresolv
+ifneq ($(findstring darwin,$(OSARCH)),)
ASTCFLAGS+=-D__Darwin__
AUDIO_LIBS=-framework CoreAudio
- ASTLINK=-Wl,-dynamic
SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
- # Mac on Intel CoreDuo does not need poll compatibility layer
- ifneq ($(PROC),i386)
- OBJS+=poll.o
- ASTCFLAGS+=-DPOLLCOMPAT
- endif
else
# These are used for all but Darwin
- ASTLINK=-Wl,-E
SOLINK=-shared -Xlinker -x
- ifeq ($(findstring BSD,$(OSARCH)),BSD)
- LDFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
+ ifneq ($(findstring BSD,$(OSARCH)),)
+ LDFLAGS+=-L/usr/local/lib
endif
endif
-ifeq ($(OSARCH),FreeBSD)
- AST_LIBS+=-lcrypto
-endif
-
-ifeq ($(OSARCH),NetBSD)
- AST_LIBS+=-lpthread -lcrypto -lm -L$(CROSS_COMPILE_TARGET)/usr/pkg/lib $(EDITLINE_LIB)
-endif
-
-ifeq ($(OSARCH),OpenBSD)
- AST_LIBS+=-lcrypto -lpthread -lm $(EDITLINE_LIB)
-endif
-
ifeq ($(OSARCH),SunOS)
- AST_LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/opt/ssl/lib -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
- OBJS+=strcompat.o
- ASTLINK=
- SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
-endif
-
-ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))
- CFLAGS+=$(TOPDIR_CFLAGS)$(ASTCFLAGS)
+ SOLINK=-shared -fpic -L/usr/local/ssl/lib
endif
# This is used when generating the doxygen documentation
HAVEDOT=no
endif
-include Makefile.rules
-
-_all: all
+all: cleantest $(SUBDIRS)
@echo " +--------- Asterisk Build Complete ---------+"
@echo " + Asterisk has successfully been built, but +"
@echo " + cannot be run before being installed by +"
@echo " + make install +"
@echo " +-------------------------------------------+"
-all: cleantest config.status menuselect.makeopts depend $(SUBDIRS) asterisk
-
-$(MOD_SUBDIRS):
- @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
-
-$(OTHER_SUBDIRS):
- @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $@
-
-config.status: configure
- @CFLAGS="" ./configure
- @echo "****"
- @echo "**** The configure script was just executed, so 'make' needs to be"
- @echo "**** restarted."
- @echo "****"
- @exit 1
-
-makeopts: configure
- @CFLAGS="" ./configure
+makeopts:
@echo "****"
- @echo "**** The configure script was just executed, so 'make' needs to be"
- @echo "**** restarted."
+ @echo "**** The configure script must be executed before running 'make'."
@echo "****"
@exit 1
-menuselect.makeopts menuselect.makedeps: menuselect/menuselect menuselect-tree
+menuselect.makeopts: menuselect/menuselect menuselect-tree
menuselect/menuselect --check-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts
-#ifneq ($(wildcard tags),)
-ctags: tags
-#endif
-
-ifneq ($(wildcard TAGS),)
-all: TAGS
-endif
-
-editline/config.h:
- cd editline && unset CFLAGS AST_LIBS && CFLAGS="$(OPTIMIZE)" ./configure ; \
-
-editline/libedit.a:
- cd editline && unset CFLAGS AST_LIBS && test -f config.h || CFLAGS="$(OPTIMIZE)" ./configure
- $(MAKE) -C editline libedit.a
-
-db1-ast/libdb1.a:
- $(MAKE) -C db1-ast libdb1.a
-
-ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),)
- ifneq ($(wildcard .depend),)
- include .depend
- endif
-endif
-
-ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),)
- ifneq ($(wildcard .tags-depend),)
- include .tags-depend
- endif
-endif
+$(MOD_SUBDIRS_EMBED_LDSCRIPT):
+ @echo "EMBED_LDSCRIPTS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
-ast_expr2.c ast_expr2.h:
- bison -o $@ -d --name-prefix=ast_yy ast_expr2.y
+$(MOD_SUBDIRS_EMBED_LDFLAGS):
+ @echo "EMBED_LDFLAGS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
-ast_expr2f.c:
- flex -o $@ --full ast_expr2.fl
+$(MOD_SUBDIRS_EMBED_LIBS):
+ @echo "EMBED_LIBS+="`$(MAKE) --quiet --no-print-directory -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
-testexpr2: config.status include/asterisk/buildopts.h ast_expr2f.c ast_expr2.c ast_expr2.h
- $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c
- $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2.c
- $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o
- rm ast_expr2.o ast_expr2f.o
-
-manpage: asterisk.8
-
-asterisk.8: asterisk.sgml
- rm -f asterisk.8
- docbook2man asterisk.sgml
- mv ./*.8 asterisk.8
+makeopts.embed_rules: menuselect.makeopts
+ @echo "Generating embedded module rules ..."
+ @rm -f $@
+ @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDSCRIPT)
+ @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LDFLAGS)
+ @$(MAKE) --no-print-directory $(MOD_SUBDIRS_EMBED_LIBS)
-asterisk.pdf: asterisk.sgml
- docbook2pdf asterisk.sgml
+$(SUBDIRS): depend makeopts.embed_rules
-asterisk.ps: asterisk.sgml
- docbook2ps asterisk.sgml
+# ensure that all module subdirectories are processed before 'main' during
+# a parallel build, since if there are modules selected to be embedded the
+# directories containing them must be completed before the main Asterisk
+# binary can be built
+main: $(filter-out main,$(MOD_SUBDIRS))
-asterisk.html: asterisk.sgml
- docbook2html asterisk.sgml
- mv r1.html asterisk.html
+$(MOD_SUBDIRS):
+ @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
-asterisk.txt: asterisk.sgml
- docbook2txt asterisk.sgml
+$(OTHER_SUBDIRS):
+ @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $@ SUBDIR=$@ all
defaults.h: makeopts
@build_tools/make_defaults_h > $@.tmp
fi
@rm -f $@.tmp
-channel.o: CFLAGS+=$(ZAPTEL_INCLUDE)
-
-asterisk: include/asterisk/buildopts.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
- @build_tools/make_build_h > include/asterisk/build.h.tmp
- @if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
- mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
- fi
- @rm -f include/asterisk/build.h.tmp
- @$(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
- @echo " [LD] $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.1 $(AST_LIBS) -> $@"
- @$(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a $(AST_LIBS)
-
-muted: muted.o
-muted: LIBS+=$(AUDIO_LIBS)
-
$(SUBDIRS_CLEAN_DEPEND):
- @$(MAKE) -C $(@:-clean-depend=) clean-depend
+ @$(MAKE) --no-print-directory -C $(@:-clean-depend=) clean-depend
$(SUBDIRS_CLEAN):
- @$(MAKE) -C $(@:-clean=) clean
+ @$(MAKE) --no-print-directory -C $(@:-clean=) clean
clean-depend: $(SUBDIRS_CLEAN_DEPEND)
clean: $(SUBDIRS_CLEAN) clean-depend
- rm -f *.o *.so asterisk
rm -f defaults.h
rm -f include/asterisk/build.h
rm -f include/asterisk/version.h
- rm -f .tags-sources tags TAGS
- rm -f .depend .tags-depend
- @if [ -f editline/Makefile ]; then $(MAKE) -C editline distclean ; fi
- @$(MAKE) -C db1-ast clean
- @$(MAKE) -C stdtime clean
+ rm -f .depend
@$(MAKE) -C menuselect clean
dist-clean: distclean
@$(MAKE) -C mxml clean
@$(MAKE) -C menuselect dist-clean
@$(MAKE) -C sounds dist-clean
- rm -f menuselect.makeopts makeopts menuselect-tree menuselect.makedeps
+ rm -f menuselect.makeopts makeopts makeopts.xml menuselect.makedeps
+ rm -f makeopts.embed_rules
rm -f config.log config.status
rm -rf autom4te.cache
rm -f include/asterisk/autoconfig.h
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
- if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
- if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
+ $(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
$(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
$(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
$(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
mkdir -p $(DESTDIR)$(ASTMANDIR)/man8
$(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
$(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
- $(INSTALL) -m 644 asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
+ $(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
$(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
$(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
$(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
echo "PROJECT_NUMBER=$(ASTERISKVERSION)") | doxygen -
config:
- @if [ "${OSARCH}" = "Linux" ]; then \
+ @if [ "${OSARCH}" = "linux-gnu" ]; then \
if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
$(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
/sbin/chkconfig --add asterisk; \
echo "We could not install init scripts for your operating system."; \
fi
-dont-optimize: _all
-
-valgrind: dont-optimize
-
$(MOD_SUBDIRS_DEPEND):
- @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
+ @CFLAGS="$(MOD_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
$(OTHER_SUBDIRS_DEPEND):
- @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) -C $(@:-depend=) depend
+ @CFLAGS="$(OTHER_SUBDIR_CFLAGS)$(ASTCFLAGS)" $(MAKE) --no-print-directory -C $(@:-depend=) depend
-depend: include/asterisk/version.h include/asterisk/buildopts.h .depend defaults.h $(SUBDIRS_DEPEND)
-
-.depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h
- build_tools/mkdep $(CFLAGS) $(wildcard *.c)
-
-.tags-depend:
- @echo -n ".tags-depend: " > $@
- @$(FIND) . -maxdepth 1 -name \*.c -printf "\t%p \\\\\n" >> $@
- @$(FIND) . -maxdepth 1 -name \*.h -printf "\t%p \\\\\n" >> $@
- @$(FIND) $(SUBDIRS) -name \*.c -printf "\t%p \\\\\n" >> $@
- @$(FIND) $(SUBDIRS) -name \*.h -printf "\t%p \\\\\n" >> $@
- @$(FIND) include -name \*.h -printf "\t%p \\\\\n" >> $@
- @echo >> $@
-
-.tags-sources:
- @rm -f $@
- @$(FIND) . -maxdepth 1 -name \*.c -print >> $@
- @$(FIND) . -maxdepth 1 -name \*.h -print >> $@
- @$(FIND) $(SUBDIRS) -name \*.c -print >> $@
- @$(FIND) $(SUBDIRS) -name \*.h -print >> $@
- @$(FIND) include -name \*.h -print >> $@
-
-tags: .tags-depend .tags-sources
- ctags -L .tags-sources -o $@
-
-ctags: tags
-
-TAGS: .tags-depend .tags-sources
- etags -o $@ `cat .tags-sources`
-
-etags: TAGS
-
-%_env:
- $(MAKE) -C $(shell echo $@ | sed "s/_env//g") env
+depend: include/asterisk/version.h include/asterisk/buildopts.h defaults.h $(SUBDIRS_DEPEND)
sounds:
$(MAKE) -C sounds all
-env:
- env
-
# If the cleancount has been changed, force a make clean.
# .cleancount is the global clean count, and .lastclean is the
# last clean count we had
cleantest:
- @if cmp -s .cleancount .lastclean ; then echo ; else \
+ @if ! cmp -s .cleancount .lastclean ; then \
$(MAKE) clean; cp -f .cleancount .lastclean;\
$(MAKE) defaults.h;\
fi
$(SUBDIRS_UNINSTALL):
- @$(MAKE) -C $(@:-uninstall=) uninstall
+ @$(MAKE) --no-print-directory -C $(@:-uninstall=) uninstall
_uninstall: $(SUBDIRS_UNINSTALL)
rm -f $(DESTDIR)$(MODULES_DIR)/*
menuselect: menuselect/menuselect menuselect-tree
-@menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
-menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h config.status mxml/libmxml.a
- @CFLAGS="-include $(ASTTOPDIR)/include/asterisk/autoconfig.h -I$(ASTTOPDIR)/include" PARENTSRC="$(ASTTOPDIR)" $(MAKE) -C menuselect menuselect
+menuselect/menuselect: makeopts menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h makeopts mxml/libmxml.a
+ @CFLAGS="-include $(ASTTOPDIR)/include/asterisk/autoconfig.h -I$(ASTTOPDIR)/include" PARENTSRC="$(ASTTOPDIR)" $(MAKE) -C menuselect CC="$(HOST_CC)" menuselect
mxml/libmxml.a:
- @cd mxml && unset CFLAGS AST_LIBS && test -f config.h || ./configure
+ @cd mxml && unset CFLAGS AST_LIBS && test -f config.h || ./configure --build=$(BUILD_PLATFORM) --host=$(BUILD_PLATFORM)
$(MAKE) -C mxml libmxml.a
-menuselect-tree: $(foreach dir,$(MOD_SUBDIRS),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml sounds/sounds.xml
- @echo "Generating list of available modules ..."
+menuselect-tree: $(foreach dir,$(MOD_SUBDIRS),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml sounds/sounds.xml build_tools/embed_modules.xml
+ @echo "Generating input for menuselect ..."
@build_tools/prep_moduledeps > $@
-.PHONY: menuselect sounds clean clean-depend dist-clean distclean all _all depend cleantest uninstall _uninstall uninstall-all dont-optimize valgrind $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_CLEAN_DEPEND) $(SUBDIRS_DEPEND) $(SUBDIRS_UNINSTALL) $(SUBDIRS)
+.PHONY: menuselect main sounds clean clean-depend dist-clean distclean all prereqs depend cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_CLEAN) $(SUBDIRS_CLEAN_DEPEND) $(SUBDIRS_DEPEND) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS)
#
# Asterisk -- A telephony toolkit for Linux.
#
-# Makefile rules
+# Makefile rules for subdirectories containing modules
#
# Copyright (C) 2006, Digium, Inc.
#
# the GNU General Public License
#
+ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
+ CFLAGS+=-include $(ASTTOPDIR)/include/asterisk/astmm.h
+endif
+
+ifneq ($(findstring STATIC_BUILD,$(MENUSELECT_CFLAGS)),)
+ STATIC_BUILD=-static
+endif
+
include $(ASTTOPDIR)/Makefile.rules
-define module_o_c_template
-$(1).o: $(1).c
-$(1).o: CFLAGS+=$$(MENUSELECT_OPTS_$(1):%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_INCLUDE))
-endef
+comma:=,
-define module_oo_cc_template
-$(1).oo: $(1).cc
-$(1).oo: CFLAGS+=$$(MENUSELECT_OPTS_$(1):%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_INCLUDE))
+define module_o_template
+$(2): $(3)
+$(2): CFLAGS+=-DAST_MODULE=\"$(1)\" $$(MENUSELECT_OPTS_$(1):%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_INCLUDE))
endef
-define module_so_o_template
-$(1).so: $(1).o
+define module_so_template
+$(1)=$(1).so
+$(1).so: CFLAGS+=-fPIC
$(1).so: LIBS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LIB))
$(1).so: LDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LDFLAGS))
+$(1).so: $(2)
endef
-define module_so_oo_template
-$(1).so: $(1).oo
-$(1).so: LIBS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LIB))
-$(1).so: LDFLAGS+=$(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$$(value $(dep)_LDFLAGS))
+define module_a_template
+$(1)=modules.link
+modules.link: $(2)
endef
-$(foreach mod,$(C_MODS),$(eval $(call module_o_c_template,$(mod))))
+$(foreach mod,$(C_MODS),$(eval $(call module_o_template,$(mod),$(mod).o,$(mod).c)))
-$(foreach mod,$(C_MODS),$(eval $(call module_so_o_template,$(mod))))
+$(foreach mod,$(CC_MODS),$(eval $(call module_o_template,$(mod),$(mod).oo,$(mod).cc)))
-$(foreach mod,$(CC_MODS),$(eval $(call module_oo_cc_template,$(mod))))
+$(foreach mod,$(filter-out $(EMBEDDED_MODS),$(C_MODS)),$(eval $(call module_so_template,$(mod),$(mod).o)))
-$(foreach mod,$(CC_MODS),$(eval $(call module_so_oo_template,$(mod))))
+$(foreach mod,$(filter-out $(EMBEDDED_MODS),$(CC_MODS)),$(eval $(call module_so_template,$(mod),$(mod).oo)))
+
+$(foreach mod,$(filter $(EMBEDDED_MODS),$(C_MODS)),$(eval $(call module_a_template,$(mod),$(mod).o)))
+
+$(foreach mod,$(filter $(EMBEDDED_MODS),$(CC_MODS)),$(eval $(call module_a_template,$(mod),$(mod).oo)))
.PHONY: clean clean-depend depend uninstall _all
-_all: $(SELECTED_MODS:%=%.so)
+ifneq ($(LOADABLE_MODS),)
+_all: $(LOADABLE_MODS:%=%.so)
+endif
+
+ifneq ($(EMBEDDED_MODS),)
+_all: modules.link
+__embed_ldscript:
+ @echo "../$(SUBDIR)/modules.link"
+__embed_ldflags:
+ @echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(C_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LDFLAGS))"
+ @echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(CC_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LDFLAGS))"
+__embed_libs:
+ @echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(C_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LIB))"
+ @echo "$(foreach mod,$(filter $(EMBEDDED_MODS),$(CC_MODS)),$(foreach dep,$(MENUSELECT_DEPENDS_$(mod)),$(dep)_LIB))"
+else
+__embed_ldscript:
+__embed_ldflags:
+__embed_libs:
+endif
+
+modules.link:
+ @rm -f $@
+ @for file in $(patsubst $(ASTTOPDIR)/%,%,$(realpath $^)); do echo "INPUT (../$${file})" >> $@; done
clean-depend::
rm -f .depend
clean:: clean-depend
rm -f *.so *.o *.oo
+ rm -f modules.link
install:: all
- for x in $(SELECTED_MODS:%=%.so); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
+ for x in $(LOADABLE_MODS:%=%.so); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
uninstall::
depend: .depend
.depend:
- ../build_tools/mkdep $(CFLAGS) `ls *.c`
+ ../build_tools/mkdep $(CFLAGS) `ls *.c *.cc 2> /dev/null`
# Prefixing one or the other with @\# or @ or nothing makes the desired
# behaviour. ECHO_PREFIX prefixes the comment, CMD_PREFIX prefixes the command.
+include $(ASTTOPDIR)/makeopts
+
ifeq ($(NOISY_BUILD),)
ECHO_PREFIX=@
CMD_PREFIX=@
CMD_PREFIX=
endif
+ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS)),)
+# More GSM codec optimization
+# Uncomment to enable MMXTM optimizations for x86 architecture CPU's
+# which support MMX instructions. This should be newer pentiums,
+# ppro's, etc, as well as the AMD K6 and K7.
+#K6OPT=-DK6OPT
+
+OPTIMIZE?=-O6
+CFLAGS+=$(OPTIMIZE)
+endif
+
define ast_make_o_c
$(1): $(2)
$(ECHO_PREFIX) echo " [CC] $$< -> $$@"
define ast_make_so_o
$(1): $(2)
$(ECHO_PREFIX) echo " [LD] $$^ -> $$@"
- $(CMD_PREFIX) $$(CC) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
+ $(CMD_PREFIX) $$(CC) $$(STATIC_BUILD) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
endef
define ast_make_so_oo
$(1): $(2)
$(ECHO_PREFIX) echo " [LDXX] $$^ -> $$@"
- $(CMD_PREFIX) $$(CXX) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
+ $(CMD_PREFIX) $$(CXX) $$(STATIC_BUILD) -o $$@ $$(LDFLAGS) $$(SOLINK) $$^ $$(LIBS)
endef
define ast_make_a_o
define ast_make_final
$(1): $(2)
$(ECHO_PREFIX) echo " [LD] $$^ -> $$@"
- $(CMD_PREFIX) $$(CC) -o $$@ $$(LDFLAGS) $$^ $$(LIBS)
+ $(CMD_PREFIX) $$(CXX) $$(STATIC_BUILD) -o $$@ $$(LDFLAGS) $$^ $$(LIBS)
endef
define ast_make_final_host
$(1): $(2)
$(ECHO_PREFIX) echo " [LD] $$^ -> $$@"
- $(CMD_PREFIX) $$(HOST_CC) -o $$@ $$(CFLAGS) $$(LDFLAGS) $$^ $$(LIBS)
+ $(CMD_PREFIX) $$(HOST_CC) $$(STATIC_BUILD) -o $$@ $$(CFLAGS) $$(LDFLAGS) $$^ $$(LIBS)
endef
$(eval $(call ast_make_o_c,%.o,%.c))
$(eval $(call ast_make_so_o,%.so,%.o))
-$(eval $(call ast_make_so_oo,%.so,%.oo))
-
$(eval $(call ast_make_final,%,%.o))
$(eval $(call ast_make_c_y,%.c,%.y))
+# AST_GCC_ATTRIBUTE([attribute name])
+
+AC_DEFUN([AST_GCC_ATTRIBUTE],
+[
+AC_MSG_CHECKING(checking for compiler 'attribute $1' support)
+AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM([static int __attribute__(($1)) test(void) {}],
+ []),
+ AC_MSG_RESULT(yes)
+ AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
+ AC_MSG_RESULT(no))
+])
+
# AST_EXT_LIB_SETUP([package symbol name], [package friendly name], [package option name], [additional help text])
AC_DEFUN([AST_EXT_LIB_SETUP],
# the GNU General Public License
#
-ifneq ($(wildcard ../menuselect.makeopts),)
+ifneq ($(wildcard $(ASTTOPDIR)/menuselect.makeopts),)
include ../menuselect.makeopts
include ../menuselect.makedeps
endif
C_MODS:=$(filter-out $(MENUSELECT_APPS),$(patsubst %.c,%,$(wildcard app_*.c)))
CC_MODS:=$(filter-out $(MENUSELECT_APPS),$(patsubst %.cc,%,$(wildcard app_*.cc)))
-SELECTED_MODS:=$(C_MODS) $(CC_MODS)
+LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
+
+ifneq ($(findstring apps,$(MENUSELECT_EMBED)),)
+ EMBEDDED_MODS:=$(LOADABLE_MODS)
+ LOADABLE_MODS:=
+endif
ifneq ($(findstring ODBC_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),)
MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_ODBC_STORAGE)
endif
-ifneq ($(findstring EXTENDED_ODBC_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),)
-MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_EXTENDED_ODBC_STORAGE)
-endif
ifneq ($(findstring IMAP_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),)
MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_IMAP_STORAGE)
endif
+ifeq (SunOS,$(shell uname))
+MENUSELECT_DEPENDS_app_chanspy+=RT
+RT_LIB=-lrt
+endif
+
all: _all
include $(ASTTOPDIR)/Makefile.moddir_rules
-
-ifeq (SunOS,$(shell uname))
-app_chanspy.so: LIBS+=-lrt
-endif
static int adsi_exec(struct ast_channel *chan, void *data)
{
int res=0;
- struct localuser *u;
+ struct ast_module_user *u;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (ast_strlen_zero(data))
data = "asterisk.adsi";
res = adsi_prog(chan, data);
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
res = ast_unregister_application(app);
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
- __mod_desc = mod;
return ast_register_application(app, adsi_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Asterisk ADSI Programming Application";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1, NULL, NULL, NULL);
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Asterisk ADSI Programming Application");
static int alarmreceiver_exec(struct ast_channel *chan, void *data)
{
int res = 0;
- struct localuser *u;
+ struct ast_module_user *u;
event_node_t *elp, *efree;
char signalling_type[64] = "";
event_node_t *event_head = NULL;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
/* Set write and read formats to ULAW */
if (ast_set_write_format(chan,AST_FORMAT_ULAW)){
ast_log(LOG_WARNING, "AlarmReceiver: Unable to set write format to Mu-law on %s\n",chan->name);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if (ast_set_read_format(chan,AST_FORMAT_ULAW)){
ast_log(LOG_WARNING, "AlarmReceiver: Unable to set read format to Mu-law on %s\n",chan->name);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
res = ast_answer(chan);
if (res) {
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
}
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
*/
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
- __mod_desc = mod;
load_config();
return ast_register_application(app, alarmreceiver_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Alarm Receiver for Asterisk";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Alarm Receiver for Asterisk");
static int amd_exec(struct ast_channel *chan, void *data)
{
- struct localuser *u;
+ struct ast_module_user *u;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
isAnsweringMachine(chan, data);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
return;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return ast_unregister_application(app);
}
-static int load_module(void *mod)
+static int load_module(void)
{
- __mod_desc = mod;
load_config();
return ast_register_application(app, amd_exec, synopsis, descrip);
}
-static int reload(void *mod)
+static int reload(void)
{
load_config();
return 0;
}
-static const char *description(void)
-{
- return "Answering Machine Detection Application";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1, reload, NULL, NULL);
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Answering Machine Detection Application",
+ .load = load_module,
+ .unload = unload_module,
+ .reload = reload,
+ );
{
int res=0;
int retries;
- struct localuser *u;
+ struct ast_module_user *u;
char passwd[256];
char *prompt;
int maxdigits;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (chan->_state != AST_STATE_UP) {
res = ast_answer(chan);
if (res) {
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
}
res = -1;
}
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
res = ast_unregister_application(app);
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, auth_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Authentication Application";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1, NULL, NULL, NULL);
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Authentication Application");
static char *nocdr_app = "NoCDR";
static char *nocdr_synopsis = "Tell Asterisk to not maintain a CDR for the current call";
-LOCAL_USER_DECL;
static int nocdr_exec(struct ast_channel *chan, void *data)
{
- struct localuser *u;
+ struct ast_module_user *u;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (chan->cdr) {
ast_cdr_free(chan->cdr);
chan->cdr = NULL;
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(nocdr_app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(nocdr_app, nocdr_exec, nocdr_synopsis, nocdr_descrip);
}
-static const char *description(void)
-{
- return "Tell Asterisk to not maintain a CDR for the current call";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1, NULL, NULL, NULL);
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Tell Asterisk to not maintain a CDR for the current call");
" s - Consider the channel unavailable if the channel is in use at all\n"
" j - Support jumping to priority n+101 if no channel is available\n";
-LOCAL_USER_DECL;
static int chanavail_exec(struct ast_channel *chan, void *data)
{
int res=-1, inuse=-1, option_state=0, priority_jump=0;
int status;
- struct localuser *u;
+ struct ast_module_user *u;
char *info, tmp[512], trychan[512], *peers, *tech, *number, *rest, *cur;
struct ast_channel *tempchan;
AST_DECLARE_APP_ARGS(args,
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
info = ast_strdupa(data);
number = strchr(tech, '/');
if (!number) {
ast_log(LOG_WARNING, "ChanIsAvail argument takes format ([technology]/[device])\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
*number = '\0';
pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", "");
if (priority_jump || ast_opt_priority_jumping) {
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
}
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res = 0;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
- __mod_desc = mod;
return ast_register_application(app, chanavail_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Check channel availability";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Check channel availability");
"ChannelRedirect(channel|[[context|]extension|]priority):\n"
" Sends the specified channel to the specified extension priority\n";
-LOCAL_USER_DECL;
static int asyncgoto_exec(struct ast_channel *chan, void *data)
{
int res = -1;
- struct localuser *u;
+ struct ast_module_user *u;
char *info, *context, *exten, *priority;
int prio = 1;
struct ast_channel *chan2 = NULL;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
info = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, info);
chanquit:
ast_mutex_unlock(&chan2->lock);
quit:
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
- __mod_desc = mod;
return ast_register_application(app, asyncgoto_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Channel Redirect";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Channel Redirect");
AST_APP_OPTION_ARG('r', OPTION_RECORD, OPT_ARG_RECORD),
});
-LOCAL_USER_DECL;
struct chanspy_translation_helper {
/* spy data */
static int chanspy_exec(struct ast_channel *chan, void *data)
{
- struct localuser *u;
+ struct ast_module_user *u;
char *options = NULL;
char *spec = NULL;
char *argv[2];
data = ast_strdupa(data);
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if ((argc = ast_app_separate_args(data, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
spec = argv[0];
oldwf = chan->writeformat;
if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if (oldwf && ast_set_write_format(chan, oldwf) < 0)
ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
static int extenspy_exec(struct ast_channel *chan, void *data)
{
- struct localuser *u;
+ struct ast_module_user *u;
char *options = NULL;
char *exten = NULL;
char *context = NULL;
data = ast_strdupa(data);
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if ((argc = ast_app_separate_args(data, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
context = argv[0];
oldwf = chan->writeformat;
if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if (oldwf && ast_set_write_format(chan, oldwf) < 0)
ast_log(LOG_ERROR, "Could Not Set Write Format.\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res = 0;
res |= ast_unregister_application(app_chan);
res |= ast_unregister_application(app_ext);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
int res = 0;
- __mod_desc = mod;
-
res |= ast_register_application(app_chan, chanspy_exec, tdesc, desc_chan);
res |= ast_register_application(app_ext, extenspy_exec, tdesc, desc_ext);
return res;
}
-static const char *description(void)
-{
- return (char *) tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1, NULL, NULL, NULL);
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Listen to the audio of an active channel");
" CPLAYBACKSTATUS - This variable contains the status of the attempt as a text\n"
" string, one of: SUCCESS | USERSTOPPED | ERROR\n";
-LOCAL_USER_DECL;
static int is_on_phonepad(char key)
{
{
int res = 0, priority_jump = 0;
int skipms = 0;
- struct localuser *u;
+ struct ast_module_user *u;
char *tmp;
int argc;
char *argv[8];
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
tmp = ast_strdupa(data);
memset(argv, 0, sizeof(argv));
if (argc < 1) {
ast_log(LOG_WARNING, "ControlPlayback requires an argument (filename)\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
pbx_builtin_setvar_helper(chan, "CPLAYBACKSTATUS", "SUCCESS");
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, controlplayback_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Control Playback Application";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1, NULL, NULL, NULL);
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Control Playback Application");
static char *d_synopsis = "Delete a key from the database";
static char *dt_synopsis = "Delete a family or keytree from the database";
-LOCAL_USER_DECL;
static int deltree_exec(struct ast_channel *chan, void *data)
{
char *argv, *family, *keytree;
- struct localuser *u;
+ struct ast_module_user *u;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
argv = ast_strdupa(data);
keytree = strsep(&argv, "\0");
if (!family || !keytree) {
ast_log(LOG_DEBUG, "Ignoring; Syntax error in argument\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
if (ast_strlen_zero(keytree))
ast_verbose(VERBOSE_PREFIX_3 "DBdeltree: Error deleting key from database.\n");
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
static int del_exec(struct ast_channel *chan, void *data)
{
char *argv, *family, *key;
- struct localuser *u;
+ struct ast_module_user *u;
static int deprecation_warning = 0;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (!deprecation_warning) {
deprecation_warning = 1;
key = strsep(&argv, "\0");
if (!family || !key) {
ast_log(LOG_DEBUG, "Ignoring; Syntax error in argument\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
if (option_verbose > 2)
ast_log(LOG_DEBUG, "Ignoring, no parameters\n");
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int retval;
return retval;
}
-static int load_module(void *mod)
+static int load_module(void)
{
int retval;
- __mod_desc = mod;
retval = ast_register_application(d_app, del_exec, d_synopsis, d_descrip);
retval |= ast_register_application(dt_app, deltree_exec, dt_synopsis, dt_descrip);
return retval;
}
-static const char *description(void)
-{
- return "Database Access Functions";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1, NULL, NULL, NULL);
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Database Access Functions");
struct dial_localuser *next;
};
-LOCAL_USER_DECL;
static void hanguptree(struct dial_localuser *outgoing, struct ast_channel *exception)
{
static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags *peerflags)
{
int res = -1;
- struct localuser *u;
+ struct ast_module_user *u;
char *rest, *cur;
struct dial_localuser *outgoing = NULL;
struct ast_channel *peer;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
parse = ast_strdupa(data);
res = 0;
done:
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
char *announce = NULL, *dialdata = NULL;
const char *context = NULL;
int sleep = 0, loops = 0, res = -1;
- struct localuser *u;
+ struct ast_module_user *u;
struct ast_flags peerflags;
if (ast_strlen_zero(data)) {
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
announce = ast_strdupa(data);
if (ast_test_flag(chan, AST_FLAG_MOH))
ast_moh_stop(chan);
done:
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
res |= ast_unregister_application(rapp);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
int res;
return res;
}
-static const char *description(void)
-{
- return "Dialing Application";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1, NULL, NULL, NULL);
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Dialing Application");
static char *desc = " Dictate([<base_dir>[|<filename>]])\n"
"Start dictation machine using optional base dir for files.\n";
-LOCAL_USER_DECL;
typedef enum {
DFLAG_RECORD = (1 << 0),
struct ast_flags flags = {0};
struct ast_filestream *fs;
struct ast_frame *f = NULL;
- struct localuser *u;
+ struct ast_module_user *u;
int ffactor = 320 * 80,
res = 0,
done = 0,
maxlen = 0,
mode = 0;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
if (!ast_strlen_zero(data)) {
oldr = chan->readformat;
if ((res = ast_set_read_format(chan, AST_FORMAT_SLINEAR)) < 0) {
ast_log(LOG_WARNING, "Unable to set to linear mode.\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if (oldr) {
ast_set_read_format(chan, oldr);
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
- __mod_desc = mod;
return ast_register_application(app, dictate_exec, synopsis, desc);
}
-static const char *description(void)
-{
- return "Virtual Dictation Machine";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1, NULL, NULL, NULL);
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Virtual Dictation Machine");
"10@PICKUPMARK, this application tries to find a channel which has defined a channel variable with the same context\n"
"as \"extension\".";
-LOCAL_USER_DECL;
static int pickup_exec(struct ast_channel *chan, void *data)
{
int res = 0;
- struct localuser *u = NULL;
+ struct ast_module_user *u = NULL;
struct ast_channel *origin = NULL, *target = NULL;
char *tmp = NULL, *exten = NULL, *context = NULL, *rest=data;
char workspace[256] = "";
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
while (!target && (exten = rest) ) {
res = 0;
if (target)
ast_mutex_unlock(&target->lock);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
- __mod_desc = mod;
return ast_register_application(app, pickup_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Directed Call Pickup Application";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1, NULL, NULL, NULL);
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Directed Call Pickup Application");
/* How many digits to read in */
#define NUMDIGITS 3
-LOCAL_USER_DECL;
#ifdef USE_ODBC_STORAGE
static void retrieve_file(char *dir)
static int directory_exec(struct ast_channel *chan, void *data)
{
int res = 0;
- struct localuser *u;
+ struct ast_module_user *u;
struct ast_config *cfg;
int last = 1;
int readext = 0;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
parse = ast_strdupa(data);
cfg = realtime_directory(args.vmcontext);
if (!cfg) {
ast_log(LOG_ERROR, "Unable to read the configuration data!\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
break;
}
ast_config_destroy(cfg);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
- __mod_desc = mod;
#ifdef USE_ODBC_STORAGE
struct ast_config *cfg = ast_config_load(VOICEMAIL_CONFIG);
char *tmp;
return ast_register_application(app, directory_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Extension Directory";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Extension Directory");
"exists in the context, it will be used. Also, if you set the 5th argument\n"
"to 'NOANSWER', the DISA application will not answer initially.\n";
-LOCAL_USER_DECL;
static void play_dialtone(struct ast_channel *chan, char *mailbox)
{
int i,j,k,x,did_ignore,special_noanswer;
int firstdigittimeout = 20000;
int digittimeout = 10000;
- struct localuser *u;
+ struct ast_module_user *u;
char *tmp, exten[AST_MAX_EXTENSION],acctcode[20]="";
char pwline[256];
char ourcidname[256],ourcidnum[256];
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (chan->pbx) {
firstdigittimeout = chan->pbx->rtimeout*1000;
if (ast_set_write_format(chan,AST_FORMAT_ULAW)) {
ast_log(LOG_WARNING, "Unable to set write format to Mu-law on %s\n", chan->name);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if (ast_set_read_format(chan,AST_FORMAT_ULAW)) {
ast_log(LOG_WARNING, "Unable to set read format to Mu-law on %s\n", chan->name);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
f = ast_read(chan);
if (f == NULL) {
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if ((f->frametype == AST_FRAME_CONTROL) &&
(f->subclass == AST_CONTROL_HANGUP)) {
ast_frfree(f);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if (f->frametype == AST_FRAME_VOICE) {
fp = fopen(args.passcode,"r");
if (!fp) {
ast_log(LOG_WARNING,"DISA password file %s not found on chan %s\n",args.passcode,chan->name);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
pwline[0] = 0;
if (special_noanswer) flags.flags = 0;
ast_cdr_reset(chan->cdr, &flags);
ast_explicit_goto(chan, args.context, exten, 1);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
}
ast_frfree(f);
}
ast_playtones_stop(chan);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, disa_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "DISA (Direct Inward System Access) Application";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "DISA (Direct Inward System Access) Application");
"displayed when the verbose level is currently set to that number\n"
"or greater. \n";
-LOCAL_USER_DECL;
static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
{
static int dumpchan_exec(struct ast_channel *chan, void *data)
{
- struct localuser *u;
+ struct ast_module_user *u;
char vars[BUFSIZ * 4];
char info[1024];
int level = 0;
static char *line = "================================================================================";
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (!ast_strlen_zero(data))
level = atoi(data);
if (option_verbose >= level)
ast_verbose("\nDumping Info For Channel: %s:\n%s\nInfo:\n%s\nVariables:\n%s%s\n", chan->name, line, info, vars, line);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, dumpchan_exec, synopsis, desc);
}
-static const char *description(void)
-{
- return "Dump Info About The Calling Channel";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Dump Info About The Calling Channel");
#include "asterisk/pbx.h"
#include "asterisk/module.h"
-static char *tdesc = "Simple Echo Application";
-
static char *app = "Echo";
static char *synopsis = "Echo audio, video, or DTMF back to the calling party";
"the calling channel back to itself. If the DTMF digit '#' is received, the\n"
"application will exit.\n";
-LOCAL_USER_DECL;
static int echo_exec(struct ast_channel *chan, void *data)
{
int res = -1;
int format;
- struct localuser *u;
+ struct ast_module_user *u;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
format = ast_best_codec(chan->nativeformats);
ast_set_write_format(chan, format);
ast_frfree(f);
}
end:
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, echo_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Simple Echo Application");
/* Maximum length of any variable */
#define MAXRESULT 1024
-static char *tdesc = "Executes dialplan applications";
-
/*! Note
*
* The key difference between these two apps is exit status. In a
"If <expr> is true, but <app> is not found, then the application\n"
"will return a non-zero value.\n";
-LOCAL_USER_DECL;
-
static int exec_exec(struct ast_channel *chan, void *data)
{
int res=0;
- struct localuser *u;
+ struct ast_module_user *u;
char *s, *appname, *endargs, args[MAXRESULT] = "";
struct ast_app *app;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
/* Check and parse arguments */
if (data) {
}
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
static int tryexec_exec(struct ast_channel *chan, void *data)
{
int res=0;
- struct localuser *u;
+ struct ast_module_user *u;
char *s, *appname, *endargs, args[MAXRESULT] = "";
struct ast_app *app;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
/* Check and parse arguments */
if (data) {
}
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
-static int execif_exec(struct ast_channel *chan, void *data) {
- int res=0;
- struct localuser *u;
+static int execif_exec(struct ast_channel *chan, void *data)
+{
+ int res = 0;
+ struct ast_module_user *u;
char *myapp = NULL;
char *mydata = NULL;
char *expr = NULL;
struct ast_app *app = NULL;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
expr = ast_strdupa(data);
res = -1;
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
+
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res |= ast_unregister_application(app_tryexec);
res |= ast_unregister_application(app_execif);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
int res = ast_register_application(app_exec, exec_exec, exec_synopsis, exec_descrip);
res |= ast_register_application(app_tryexec, tryexec_exec, tryexec_synopsis, tryexec_descrip);
return res;
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Executes dialplan applications");
int option_autoclear;
};
-LOCAL_USER_DECL;
struct gen_state {
struct ivr_localuser *u;
static int app_exec(struct ast_channel *chan, void *data)
{
- struct localuser *lu = NULL;
+ struct ast_module_user *lu;
struct playlist_entry *entry;
const char *args = data;
int child_stdin[2] = { 0,0 };
};
struct ivr_localuser *u = &foo;
- LOCAL_USER_ADD(lu);
+ lu = ast_module_user_add(chan);
u->abort_current_sound = 0;
u->chan = chan;
if (ast_strlen_zero(args)) {
ast_log(LOG_WARNING, "ExternalIVR requires a command to execute\n");
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
return -1;
}
while ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list)))
free(entry);
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, app_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "External IVR Interface Application";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "External IVR Interface Application");
"play it to the user, allowing any given interrupt keys to immediately terminate and return\n"
"the value, or 'any' to allow any number back (useful in dialplan)\n";
-LOCAL_USER_DECL;
static char *socket_receive_file_to_buff(int fd,int *size)
{
{
int usecache;
int res=0;
- struct localuser *u;
+ struct ast_module_user *u;
struct sockaddr_in serv_addr;
struct hostent *serverhost;
struct ast_hostent ahp;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
cfg = ast_config_load(FESTIVAL_CONFIG);
if (!cfg) {
ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if (!(host = ast_variable_retrieve(cfg, "general", "host"))) {
if (fd < 0) {
ast_log(LOG_WARNING,"festival_client: can't get socket\n");
ast_config_destroy(cfg);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
memset(&serv_addr, 0, sizeof(serv_addr));
if (serverhost == (struct hostent *)0) {
ast_log(LOG_WARNING,"festival_client: gethostbyname failed\n");
ast_config_destroy(cfg);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
memmove(&serv_addr.sin_addr,serverhost->h_addr, serverhost->h_length);
if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0) {
ast_log(LOG_WARNING,"festival_client: connect to server failed\n");
ast_config_destroy(cfg);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
ast_log(LOG_WARNING,"Unable to read from cache/festival fd");
close(fd);
ast_config_destroy(cfg);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
n += read_data;
} while (strcmp(ack,"OK\n") != 0);
close(fd);
ast_config_destroy(cfg);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, festival_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Simple Festival Interface";
-
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Simple Festival Interface");
"people who want to perform transfers and such via AGI and is generally\n"
"quite useless oths application will only work on Zap trunks.\n";
-LOCAL_USER_DECL;
static inline int zt_wait_event(int fd)
{
{
int res = -1;
int x;
- struct localuser *u;
+ struct ast_module_user *u;
struct zt_params ztp;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (!strcasecmp(chan->tech->type, "Zap")) {
memset(&ztp, 0, sizeof(ztp));
res = ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp);
ast_log(LOG_WARNING, "Unable to get parameters of %s: %s\n", chan->name, strerror(errno));
} else
ast_log(LOG_WARNING, "%s is not a Zap channel\n", chan->name);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, flash_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Flash zap trunk application";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Flash channel application");
" s - Playback the incoming status message prior to starting the follow-me step(s)\n"
" a - Record the caller's name so it can be announced to the callee on each step\n"
" n - Playback the unreachable status message if we've run out of steps to reach the\n"
-" or the callee has elected not to be reachable.\n"
-
-
-LOCAL_USER_DECL;
+" or the callee has elected not to be reachable.\n";
struct number {
char number[512]; /*!< Phone Number(s) and/or Extension(s) */
struct ast_call_followme *f;
struct number *nm, *newnm;
int res = 0;
- struct localuser *u;
+ struct ast_module_user *u;
char *argstr;
char namerecloc[255];
int duration = 0;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
AST_STANDARD_APP_ARGS(args, argstr);
}
outrun:
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
+
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
struct ast_call_followme *f;
- STANDARD_HANGUP_LOCALUSERS;
+
+ ast_module_user_hangup_all();
+
ast_unregister_application(app);
+
/* Free Memory. Yeah! I'm free! */
AST_LIST_LOCK(&followmes);
- AST_LIST_TRAVERSE_SAFE_BEGIN(&followmes, f, entry) {
+ while ((f = AST_LIST_REMOVE_HEAD(&followmes, entry))) {
free_numbers(f);
- AST_LIST_REMOVE_CURRENT(&followmes, entry);
free(f);
}
- AST_LIST_TRAVERSE_SAFE_END
+
AST_LIST_UNLOCK(&followmes);
+
return 0;
}
-static int load_module(void *mod)
+static int load_module(void)
{
reload_followme();
- return ast_register_application(app, app_exec, synopsis, descrip);
-}
-static const char *description(void)
-{
- return "Find-Me/Follow-Me Application";
+ return ast_register_application(app, app_exec, synopsis, descrip);
}
-static int reload(void *mod)
+static int reload(void)
{
reload_followme();
- return 0;
-}
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
+ return 0;
}
-STD_MOD(MOD_1, reload, NULL, NULL);
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Find-Me/Follow-Me Application",
+ .load = load_module,
+ .unload = unload_module,
+ .reload = reload,
+ );
"cdr record starting from the time of the fork call\n"
"If the option 'v' is passed all cdr variables will be passed along also.\n";
-LOCAL_USER_DECL;
static void ast_cdr_fork(struct ast_channel *chan)
{
static int forkcdr_exec(struct ast_channel *chan, void *data)
{
int res = 0;
- struct localuser *u;
+ struct ast_module_user *u;
if (!chan->cdr) {
ast_log(LOG_WARNING, "Channel does not have a CDR\n");
return 0;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (!ast_strlen_zero(data))
ast_set2_flag(chan->cdr, strchr(data, 'v'), AST_CDR_FLAG_KEEP_VARS);
ast_cdr_fork(chan);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, forkcdr_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Fork The CDR into 2 separate entities.";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Fork The CDR into 2 separate entities");
" GetCPEID: Obtains and displays ADSI CPE ID and other information in order\n"
"to properly setup zapata.conf for on-hook operations.\n";
-LOCAL_USER_DECL;
static int cpeid_setstatus(struct ast_channel *chan, char *stuff[], int voice)
{
static int cpeid_exec(struct ast_channel *chan, void *idata)
{
int res=0;
- struct localuser *u;
+ struct ast_module_user *u;
unsigned char cpeid[4];
int gotgeometry = 0;
int gotcpeid = 0;
char data[4][80];
char *stuff[4];
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
stuff[0] = data[0];
stuff[1] = data[1];
stuff[2] = data[2];
adsi_unload_session(chan);
}
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, cpeid_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Get ADSI CPE ID";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Get ADSI CPE ID");
" HASVMSTATUS The result of the new voicemail check returned as a text string as follows\n"
" <# of messages in the folder, 0 for NONE>\n";
-LOCAL_USER_DECL;
static int hasvoicemail_exec(struct ast_channel *chan, void *data)
{
- struct localuser *u;
+ struct ast_module_user *u;
char *input, *varname = NULL, *vmbox, *context = "default";
char *vmfolder;
int vmcount = 0;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
input = ast_strdupa(data);
snprintf(tmp, sizeof(tmp), "%d", vmcount);
pbx_builtin_setvar_helper(chan, "HASVMSTATUS", tmp);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
static int acf_vmcount_exec(struct ast_channel *chan, char *cmd, char *argsstr, char *buf, size_t len)
{
- struct localuser *u;
+ struct ast_module_user *u;
char *context;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(vmbox);
AST_APP_ARG(folder);
);
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
buf[0] = '\0';
snprintf(buf, len, "%d", ast_app_messagecount(context, args.vmbox, args.folder));
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
.read = acf_vmcount_exec,
};
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res |= ast_unregister_application(app_hasvoicemail);
res |= ast_unregister_application(app_hasnewvoicemail);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
int res;
return res;
}
-static const char *description(void)
-{
- return "Indicator for whether a voice mailbox has messages in a given folder.";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Indicator for whether a voice mailbox has messages in a given folder.");
"(available separately). A configuration file must be supplied\n"
"for ices (see examples/asterisk-ices.conf). \n";
-LOCAL_USER_DECL;
static int icesencode(char *filename, int fd)
{
static int ices_exec(struct ast_channel *chan, void *data)
{
int res=0;
- struct localuser *u;
+ struct ast_module_user *u;
int fds[2];
int ms = -1;
int pid = -1;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
last = ast_tv(0, 0);
if (pipe(fds)) {
ast_log(LOG_WARNING, "Unable to create pipe\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
flags = fcntl(fds[1], F_GETFL);
close(fds[0]);
close(fds[1]);
ast_log(LOG_WARNING, "Answer failed!\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
close(fds[0]);
close(fds[1]);
ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if (((char *)data)[0] == '/')
if (!res && oreadformat)
ast_set_read_format(chan, oreadformat);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, ices_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Encode and Stream via icecast and ices";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Encode and Stream via icecast and ices");
#include "asterisk/app.h"
#include "asterisk/options.h"
-static char *tdesc = "Image Transmission Application";
-
static char *app = "SendImage";
static char *synopsis = "Send an image file";
" SENDIMAGESTATUS The status is the result of the attempt as a text string, one of\n"
" OK | NOSUPPORT \n";
-LOCAL_USER_DECL;
static int sendimage_exec(struct ast_channel *chan, void *data)
{
int res = 0;
- struct localuser *u;
+ struct ast_module_user *u;
char *parse;
int priority_jump = 0;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(options);
);
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
parse = ast_strdupa(data);
if (priority_jump || ast_opt_priority_jumping)
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "NOSUPPORT");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
if (!res)
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "OK");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, sendimage_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Image Transmission Application");
{ NULL },
});
-LOCAL_USER_DECL;
static int skel_exec(struct ast_channel *chan, void *data)
{
int res=0;
- struct localuser *u;
+ struct ast_module_user *u;
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "skel requires an argument (filename)\n");
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
/* Do our thing here */
if (!res)
res = ast_ivr_menu_run(chan, &ivr_demo, data);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, skel_exec, tdesc, synopsis);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
-
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "IVR Demo Application");
#include "asterisk/astdb.h"
#include "asterisk/options.h"
-static char *tdesc = "Look up Caller*ID name/number from blacklist database";
-
static char *app = "LookupBlacklist";
static char *synopsis = "Look up Caller*ID name/number from blacklist database";
" FOUND | NOTFOUND\n"
"Example: exten => 1234,1,LookupBlacklist()\n";
-LOCAL_USER_DECL;
static int blacklist_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
lookupblacklist_exec (struct ast_channel *chan, void *data)
{
char blacklist[1];
- struct localuser *u;
+ struct ast_module_user *u;
int bl = 0;
int priority_jump = 0;
static int dep_warning = 0;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (!dep_warning) {
dep_warning = 1;
} else
pbx_builtin_setvar_helper(chan, "LOOKUPBLSTATUS", "NOTFOUND");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
res |= ast_custom_function_unregister(&blacklist_function);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
int res = ast_custom_function_register(&blacklist_function);
res |= ast_register_application (app, lookupblacklist_exec, synopsis,descrip);
return res;
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Look up Caller*ID name/number from blacklist database");
#include "asterisk/callerid.h"
#include "asterisk/astdb.h"
-static char *tdesc = "Look up CallerID Name from local database";
-
static char *app = "LookupCIDName";
static char *synopsis = "Look up CallerID Name from local database";
"name delivery, or if you want to change the names on some incoming\n"
"calls.\n";
-LOCAL_USER_DECL;
-static int
-lookupcidname_exec (struct ast_channel *chan, void *data)
+static int lookupcidname_exec (struct ast_channel *chan, void *data)
{
- char dbname[64];
- struct localuser *u;
+ char dbname[64];
+ struct ast_module_user *u;
static int dep_warning = 0;
- LOCAL_USER_ADD (u);
+ u = ast_module_user_add(chan);
if (!dep_warning) {
dep_warning = 1;
ast_log(LOG_WARNING, "LookupCIDName is deprecated. Please use ${DB(cidname/${CALLERID(num)})} instead.\n");
}
- if (chan->cid.cid_num) {
- if (!ast_db_get ("cidname", chan->cid.cid_num, dbname, sizeof (dbname))) {
- ast_set_callerid (chan, NULL, dbname, NULL);
- if (option_verbose > 2)
- ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID name to %s\n",
- dbname);
+ if (chan->cid.cid_num) {
+ if (!ast_db_get ("cidname", chan->cid.cid_num, dbname, sizeof (dbname))) {
+ ast_set_callerid (chan, NULL, dbname, NULL);
+ if (option_verbose > 2)
+ ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID name to %s\n",
+ dbname);
+ }
}
- }
- LOCAL_USER_REMOVE (u);
- return 0;
+ ast_module_user_remove(u);
+
+ return 0;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application (app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application (app, lookupcidname_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Look up CallerID Name from local database");
/* special result value used to force macro exit */
#define MACRO_EXIT_RESULT 1024
-static char *tdesc = "Extension Macros";
-
static char *descrip =
" Macro(macroname|arg1|arg2...): Executes a macro using the context\n"
"'macro-<macroname>', jumping to the 's' extension of that context and\n"
static char *exclusive_synopsis = "Exclusive Macro Implementation";
static char *exit_synopsis = "Exit From Macro";
-LOCAL_USER_DECL;
static int _macro_exec(struct ast_channel *chan, void *data, int exclusive)
{
char *save_macro_context;
char *save_macro_priority;
char *save_macro_offset;
- struct localuser *u;
+ struct ast_module_user *u;
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Macro() requires arguments. See \"show application macro\" for help.\n");
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
/* does the user want a deeper rabbit hole? */
s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION");
sscanf(s, "%d", &depth);
if (depth >= maxdepth) {
ast_log(LOG_ERROR, "Macro(): possible infinite loop detected. Returning early.\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
snprintf(depthc, sizeof(depthc), "%d", depth + 1);
macro = strsep(&rest, "|");
if (ast_strlen_zero(macro)) {
ast_log(LOG_WARNING, "Invalid macro name specified\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
ast_log(LOG_WARNING, "No such context '%s' for macro '%s'\n", fullmacro, macro);
else
ast_log(LOG_WARNING, "Context '%s' for macro '%s' lacks 's' extension, priority 1\n", fullmacro, macro);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
if (ast_context_lockmacro(fullmacro)) {
ast_log(LOG_WARNING, "Failed to lock macro '%s' as in-use\n", fullmacro);
ast_autoservice_stop(chan);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
+
return 0;
}
ast_autoservice_stop(chan);
}
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
+
return res;
}
{
char *expr = NULL, *label_a = NULL, *label_b = NULL;
int res = 0;
- struct localuser *u;
+ struct ast_module_user *u;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (!(expr = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
} else
ast_log(LOG_WARNING, "Invalid Syntax.\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
return MACRO_EXIT_RESULT;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res |= ast_unregister_application(app);
res |= ast_unregister_application(exclusive_app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
int res;
return res;
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Extension Macros");
#include "enter.h"
#include "leave.h"
-LOCAL_USER_DECL;
-
#define CONFIG_FILE_NAME "meetme.conf"
/*! each buffer is 20ms, so this is 640ms total */
#define CONFIG_FILE_NAME "meetme.conf"
#define CONFIG_FILE_NAME_SLA "sla.conf"
-LOCAL_USER_DECL;
-
/*! \brief The MeetMe Conference object */
struct ast_conference {
ast_mutex_t playlock; /*!< Conference specific lock (players) */
/*! \brief The MeetmeCount application */
static int count_exec(struct ast_channel *chan, void *data)
{
- struct localuser *u;
+ struct ast_module_user *u;
int res = 0;
struct ast_conference *conf;
int count;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (!(localdata = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
ast_answer(chan);
res = ast_say_number(chan, count, "", chan->language, (char *) NULL); /* Needs gender */
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
static int conf_exec(struct ast_channel *chan, void *data)
{
int res=-1;
- struct localuser *u;
+ struct ast_module_user *u;
char confno[AST_MAX_EXTENSION] = "";
int allowretry = 0;
int retrycnt = 0;
AST_APP_ARG(pin);
);
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (ast_strlen_zero(data)) {
allowretry = 1;
}
} while (allowretry);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
static int sla_exec(struct ast_channel *chan, void *data, int trunk)
{
int res=-1;
- struct localuser *u;
+ struct ast_module_user *u;
char confno[AST_MAX_EXTENSION] = "";
struct ast_sla *sla;
struct ast_conference *cnf;
return -1;
}
- LOCAL_USER_ADD(u);
-
+ u = ast_module_user_add(chan);
if (args.options)
ast_app_parse_options(sla_opts, &confflags, NULL, args.options);
ast_log(LOG_WARNING, "SLA%c: SLA '%s' not found!\n", trunk ? 'T' : 'S', args.confno);
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
char *params;
struct ast_conference *cnf;
struct ast_conf_user *user = NULL;
- struct localuser *u;
+ struct ast_module_user *u;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(confno);
AST_APP_ARG(command);
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
AST_LIST_LOCK(&confs);
if (!args.command) {
ast_log(LOG_WARNING, "MeetmeAdmin requires a command!\n");
AST_LIST_UNLOCK(&confs);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
AST_LIST_TRAVERSE(&confs, cnf, list) {
if (!cnf) {
ast_log(LOG_WARNING, "Conference number '%s' not found!\n", args.confno);
- LOCAL_USER_REMOVE(u);
AST_LIST_UNLOCK(&confs);
+ ast_module_user_remove(u);
return 0;
}
AST_LIST_UNLOCK(&confs);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
load_config_sla();
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
- int res;
+ int res = 0;
- res = ast_cli_unregister(&cli_show_confs);
+ res |= ast_cli_unregister(&cli_show_confs);
res |= ast_cli_unregister(&cli_sla_show);
res |= ast_cli_unregister(&cli_conf);
res |= ast_manager_unregister("MeetmeMute");
res |= ast_unregister_application(appslas);
res |= ast_unregister_application(appslat);
+ ast_module_user_hangup_all();
ast_devstate_prov_del("Meetme");
ast_devstate_prov_del("SLA");
- STANDARD_HANGUP_LOCALUSERS;
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
int res;
return res;
}
-static int reload(void *mod)
+static int reload(void)
{
load_config();
return 0;
}
-static const char *description(void)
-{
- return "MeetMe conference bridge";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1, reload, NULL, NULL);
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "MeetMe conference bridge",
+ .load = load_module,
+ .unload = unload_module,
+ .reload = reload,
+ );
static char *descrip =
"Milliwatt(): Generate a Constant 1000Hz tone at 0dbm (mu-law)\n";
-LOCAL_USER_DECL;
static char digital_milliwatt[] = {0x1e,0x0b,0x0b,0x1e,0x9e,0x8b,0x8b,0x9e} ;
static int milliwatt_exec(struct ast_channel *chan, void *data)
{
- struct localuser *u;
- LOCAL_USER_ADD(u);
+ struct ast_module_user *u;
+ u = ast_module_user_add(chan);
ast_set_write_format(chan, AST_FORMAT_ULAW);
ast_set_read_format(chan, AST_FORMAT_ULAW);
if (chan->_state != AST_STATE_UP)
if (ast_activate_generator(chan,&milliwattgen,"milliwatt") < 0)
{
ast_log(LOG_WARNING,"Failed to activate generator on '%s'\n",chan->name);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
while(!ast_safe_sleep(chan, 10000));
ast_deactivate_generator(chan);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, milliwatt_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Digital Milliwatt (mu-law) Test Application";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Digital Milliwatt (mu-law) Test Application");
struct mixmonitor *mixmonitor = obj;
struct ast_frame *f = NULL;
- ast_atomic_fetchadd_int(&__mod_desc->usecnt, +1);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Begin MixMonitor Recording %s\n", mixmonitor->name);
free(mixmonitor);
- ast_atomic_fetchadd_int(&__mod_desc->usecnt, -1);
return NULL;
}
static int mixmonitor_exec(struct ast_channel *chan, void *data)
{
int x, readvol = 0, writevol = 0;
- struct localuser *u;
+ struct ast_module_user *u;
struct ast_flags flags = {0};
char *parse;
AST_DECLARE_APP_ARGS(args,
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
parse = ast_strdupa(data);
if (ast_strlen_zero(args.filename)) {
ast_log(LOG_WARNING, "MixMonitor requires an argument (filename)\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
pbx_builtin_setvar_helper(chan, "MIXMONITOR_FILENAME", args.filename);
launch_monitor_thread(chan, args.filename, flags.flags, readvol, writevol, args.post_process);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
static int stop_mixmonitor_exec(struct ast_channel *chan, void *data)
{
- struct localuser *u;
+ struct ast_module_user *u;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
ast_channel_lock(chan);
ast_channel_spy_stop_by_type(chan, mixmonitor_spy_type);
ast_channel_unlock(chan);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
complete_mixmonitor_cli
};
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res |= ast_unregister_application(stop_app);
res |= ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
int res;
return res;
}
-static const char *description(void)
-{
- return "Mixed Audio Monitoring Application";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Mixed Audio Monitoring Application");
#include "asterisk/module.h"
#include "asterisk/indications.h"
-static char *tdesc = "Morse code";
-
static char *app_morsecode = "Morsecode";
static char *morsecode_synopsis = "Plays morse code";
"(defaults to 80). Additionally, if MORSETONE is set, it will use that tone\n"
"(in Hz). The tone default is 800.\n";
-LOCAL_USER_DECL;
static char *morsecode[] = {
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /* 0-15 */
int res=0, ditlen, tone;
char *digit;
const char *ditlenc, *tonec;
- struct localuser *u;
+ struct ast_module_user *u;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Syntax: Morsecode(<string>) - no argument found\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
playtone(chan, 0, 2 * ditlen);
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app_morsecode);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app_morsecode, morsecode_exec, morsecode_synopsis, morsecode_descrip);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Morse code");
#define LOCAL_MPG_123 "/usr/local/bin/mpg123"
#define MPG_123 "/usr/bin/mpg123"
-static char *tdesc = "Silly MP3 Application";
-
static char *app = "MP3Player";
static char *synopsis = "Play an MP3 file or stream";
"which typically would be a filename or a URL. User can exit by pressing\n"
"any key on the dialpad, or by hanging up.";
-LOCAL_USER_DECL;
static int mp3play(char *filename, int fd)
{
static int mp3_exec(struct ast_channel *chan, void *data)
{
int res=0;
- struct localuser *u;
+ struct ast_module_user *u;
int fds[2];
int ms = -1;
int pid = -1;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (pipe(fds)) {
ast_log(LOG_WARNING, "Unable to create pipe\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if (!res && owriteformat)
ast_set_write_format(chan, owriteformat);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, mp3_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Silly MP3 Application");
#define AF_LOCAL AF_UNIX
#endif
-static char *tdesc = "Silly NBS Stream Application";
-
static char *app = "NBScat";
static char *synopsis = "Play an NBS local stream";
" NBScat: Executes nbscat to listen to the local NBS stream.\n"
"User can exit by pressing any key\n.";
-LOCAL_USER_DECL;
static int NBScatplay(int fd)
{
static int NBScat_exec(struct ast_channel *chan, void *data)
{
int res=0;
- struct localuser *u;
+ struct ast_module_user *u;
int fds[2];
int ms = -1;
int pid = -1;
short frdata[160];
} myf;
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds)) {
ast_log(LOG_WARNING, "Unable to create socketpair\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if (!res && owriteformat)
ast_set_write_format(chan, owriteformat);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, NBScat_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Silly NBS Stream Application");
static int ospauth_exec(struct ast_channel* chan, void* data)
{
int res;
- struct localuser* u;
+ struct ast_module_user *u;
const char* provider = OSP_DEF_PROVIDER;
int priority_jump = 0;
- struct varshead* headp;
- struct ast_var_t* current;
- const char* source = "";
- const char* token = "";
+ struct varshead *headp;
+ struct ast_var_t *current;
+ const char *source = "";
+ const char *token = "";
int handle;
unsigned int timelimit;
char buffer[OSP_INTSTR_SIZE];
- const char* status;
- char* tmp;
+ const char *status;
+ char *tmp;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(provider);
AST_APP_ARG(options);
);
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (!(tmp = ast_strdupa(data))) {
ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
res = 0;
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
static int osplookup_exec(struct ast_channel* chan, void* data)
{
int res, cres;
- struct localuser* u;
- const char* provider = OSP_DEF_PROVIDER;
+ struct ast_module_user *u;
+ const char *provider = OSP_DEF_PROVIDER;
int priority_jump = 0;
- struct varshead* headp;
+ struct varshead *headp;
struct ast_var_t* current;
- const char* srcdev = "";
+ const char *srcdev = "";
char buffer[OSP_TOKSTR_SIZE];
struct osp_result result;
- const char* status;
- char* tmp;
+ const char *status;
+ char *tmp;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(exten);
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (!(tmp = ast_strdupa(data))) {
ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
ast_log(LOG_DEBUG, "OSPLookup: source device '%s'\n", srcdev);
if ((cres = ast_autoservice_start(chan)) < 0) {
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
}
if ((cres = ast_autoservice_stop(chan)) < 0) {
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
res = 0;
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
static int ospnext_exec(struct ast_channel* chan, void* data)
{
int res;
- struct localuser* u;
+ struct ast_module_user *u;
int priority_jump = 0;
int cause = 0;
struct varshead* headp;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (!(tmp = ast_strdupa(data))) {
ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
res = 0;
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
static int ospfinished_exec(struct ast_channel* chan, void* data)
{
int res = 1;
- struct localuser* u;
+ struct ast_module_user *u;
int priority_jump = 0;
int cause = 0;
- struct varshead* headp;
- struct ast_var_t* current;
+ struct varshead *headp;
+ struct ast_var_t *current;
int inhandle = OSP_INVALID_HANDLE;
int outhandle = OSP_INVALID_HANDLE;
int recorded = 0;
time_t start, connect, end;
unsigned int release;
char buffer[OSP_INTSTR_SIZE];
- const char* status;
- char* tmp;
+ const char *status;
+ char *tmp;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(cause);
AST_APP_ARG(options);
);
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (!(tmp = ast_strdupa(data))) {
ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
res = 0;
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
osp_usage
};
-LOCAL_USER_DECL;
-
-static int load_module(void* mod)
+static int load_module(void)
{
int res;
return res;
}
-static int unload_module(void* mod)
+static int unload_module(void)
{
int res;
res |= ast_cli_unregister(&osp_cli);
osp_unload();
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int reload(void* mod)
+static int reload(void)
{
osp_unload();
osp_load();
- return 0;
-}
-static const char* description(void)
-{
- return "Open Settlement Protocol Applications";
-}
-
-static const char* key(void)
-{
- return ASTERISK_GPL_KEY;
+ return 0;
}
-STD_MOD(MOD_1, reload, NULL, NULL);
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Open Settlement Protocol Applications",
+ .load = load_module,
+ .unload = unload_module,
+ .reload = reload,
+ );
" q - quiet, do not play beep to caller\n"
" r - record the page into a file (see 'r' for app_meetme)\n";
-LOCAL_USER_DECL;
enum {
PAGE_DUPLEX = (1 << 0),
static int page_exec(struct ast_channel *chan, void *data)
{
- struct localuser *u;
+ struct ast_module_user *u;
char *options;
char *tech, *resource;
char meetmeopts[80];
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
if (!(app = pbx_findapp("MeetMe"))) {
ast_log(LOG_WARNING, "There is no MeetMe application available!\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
};
pbx_exec(chan, app, meetmeopts);
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app_page);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app_page, page_exec, page_synopsis, page_descrip);
}
-static const char *description(void)
-{
- return "Page Multiple Phones";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Page Multiple Phones");
#include "asterisk/lock.h"
#include "asterisk/utils.h"
-static char *tdesc = "Call Parking and Announce Application";
-
static char *app = "ParkAndAnnounce";
static char *synopsis = "Park and Announce";
"call was placed. Use with the Local channel to allow the dialplan to make\n"
"use of this information.\n";
-LOCAL_USER_DECL;
static int parkandannounce_exec(struct ast_channel *chan, void *data)
{
struct outgoing_helper oh;
int outstate;
- struct localuser *u;
+ struct ast_module_user *u;
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "ParkAndAnnounce requires arguments: (announce:template|timeout|dial|[return_context])\n");
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
l=strlen(data)+2;
if (!(orig_s = ast_malloc(l))) {
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
s=orig_s;
if(! template) {
ast_log(LOG_WARNING, "PARK: An announce template must be defined\n");
free(orig_s);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if(!dial) {
ast_log(LOG_WARNING, "PARK: A dial resource must be specified i.e: Console/dsp or Zap/g1/5551212\n");
free(orig_s);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
} else {
dialtech=strsep(&dial, "/");
if(atoi(priority) < 0) {
ast_log(LOG_WARNING, "Priority '%s' must be a number > 0\n", priority);
free(orig_s);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
/* At this point we have a priority and maybe an extension and a context */
ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name);
ast_hangup(dchan);
free(orig_s);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
} else {
ast_log(LOG_WARNING, "PARK: Unable to allocate announce channel.\n");
free(orig_s);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
ast_hangup(dchan);
free(orig_s);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
/* return ast_register_application(app, park_exec); */
return ast_register_application(app, parkandannounce_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Call Parking and Announce Application");
#include "asterisk/localtime.h"
#include "asterisk/say.h"
-static char *tdesc = "Sound File Playback Application";
-
static char *app = "Playback";
static char *synopsis = "Play a file";
" SUCCESS | FAILED\n"
;
-LOCAL_USER_DECL;
static struct ast_config *say_cfg;
/* save the say' api calls.
static int playback_exec(struct ast_channel *chan, void *data)
{
int res = 0;
- struct localuser *u;
+ struct ast_module_user *u;
char *tmp;
int option_skip=0;
int option_say=0;
tmp = ast_strdupa(data);
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
AST_STANDARD_APP_ARGS(args, tmp);
if (args.options) {
pbx_builtin_setvar_helper(chan, "PLAYBACKSTATUS", mres ? "FAILED" : "SUCCESS");
}
done:
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int reload(void *mod)
+static int reload(void)
{
if (say_cfg) {
ast_config_destroy(say_cfg);
return 0;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
if (say_cfg)
ast_config_destroy(say_cfg);
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
- reload(mod);
+ reload();
ast_cli_register_multiple(myclis, sizeof(myclis)/sizeof(struct ast_cli_entry));
return ast_register_application(app, playback_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1,reload,NULL,NULL);
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Sound File Playback Application",
+ .load = load_module,
+ .unload = unload_module,
+ .reload = reload,
+ );
#define PRIV_CONFIG "privacy.conf"
-static char *tdesc = "Require phone number to be entered, if no CallerID sent";
-
static char *app = "PrivacyManager";
static char *synopsis = "Require phone number to be entered, if no CallerID sent";
" SUCCESS | FAILED \n"
;
-LOCAL_USER_DECL;
static int privacy_exec (struct ast_channel *chan, void *data)
{
int x = 0;
char *s;
char phone[30];
- struct localuser *u;
+ struct ast_module_user *u;
struct ast_config *cfg = NULL;
char *parse = NULL;
int priority_jump = 0;
AST_APP_ARG(options);
);
- LOCAL_USER_ADD (u);
+ u = ast_module_user_add(chan);
+
if (!ast_strlen_zero(chan->cid.cid_num)) {
if (option_verbose > 2)
ast_verbose (VERBOSE_PREFIX_3 "CallerID Present: Skipping\n");
if (chan->_state != AST_STATE_UP) {
res = ast_answer(chan);
if (res) {
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
}
- if (!ast_strlen_zero((char *)data))
- {
+ if (!ast_strlen_zero(data)) {
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
ast_config_destroy(cfg);
}
- LOCAL_USER_REMOVE (u);
- return 0;
+ ast_module_user_remove(u);
+
+ return 0;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application (app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application (app, privacy_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Require phone number to be entered, if no CallerID sent");
#define RES_OUTOFMEMORY (-2) /* Out of memory */
#define RES_NOSUCHQUEUE (-3) /* No such queue */
-static char *tdesc = "True Call Queueing";
-
static char *app = "Queue";
static char *synopsis = "Queue a call for a call queue";
struct member *member;
};
-LOCAL_USER_DECL;
struct queue_ent {
struct call_queue *parent; /*!< What queue is our parent */
static int pqm_exec(struct ast_channel *chan, void *data)
{
- struct localuser *lu;
+ struct ast_module_user *lu;
char *parse;
int priority_jump = 0;
AST_DECLARE_APP_ARGS(args,
AST_STANDARD_APP_ARGS(args, parse);
- LOCAL_USER_ADD(lu);
+ lu = ast_module_user_add(chan);
if (args.options) {
if (strchr(args.options, 'j'))
if (ast_strlen_zero(args.interface)) {
ast_log(LOG_WARNING, "Missing interface argument to PauseQueueMember ([queuename]|interface[|options])\n");
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
return -1;
}
if (priority_jump || ast_opt_priority_jumping) {
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
pbx_builtin_setvar_helper(chan, "PQMSTATUS", "NOTFOUND");
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
return 0;
}
}
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
pbx_builtin_setvar_helper(chan, "PQMSTATUS", "NOTFOUND");
return -1;
}
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
pbx_builtin_setvar_helper(chan, "PQMSTATUS", "PAUSED");
return 0;
static int upqm_exec(struct ast_channel *chan, void *data)
{
- struct localuser *lu;
+ struct ast_module_user *lu;
char *parse;
int priority_jump = 0;
AST_DECLARE_APP_ARGS(args,
AST_STANDARD_APP_ARGS(args, parse);
- LOCAL_USER_ADD(lu);
+ lu = ast_module_user_add(chan);
if (args.options) {
if (strchr(args.options, 'j'))
if (ast_strlen_zero(args.interface)) {
ast_log(LOG_WARNING, "Missing interface argument to PauseQueueMember ([queuename]|interface[|options])\n");
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
return -1;
}
if (priority_jump || ast_opt_priority_jumping) {
if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) {
pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "NOTFOUND");
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
return 0;
}
}
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "NOTFOUND");
return -1;
}
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "UNPAUSED");
return 0;
static int rqm_exec(struct ast_channel *chan, void *data)
{
int res=-1;
- struct localuser *lu;
+ struct ast_module_user *lu;
char *parse, *temppos = NULL;
int priority_jump = 0;
AST_DECLARE_APP_ARGS(args,
AST_STANDARD_APP_ARGS(args, parse);
- LOCAL_USER_ADD(lu);
+ lu = ast_module_user_add(chan);
if (ast_strlen_zero(args.interface)) {
args.interface = ast_strdupa(chan->name);
break;
}
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
return res;
}
static int aqm_exec(struct ast_channel *chan, void *data)
{
int res=-1;
- struct localuser *lu;
+ struct ast_module_user *lu;
char *parse, *temppos = NULL;
int priority_jump = 0;
AST_DECLARE_APP_ARGS(args,
AST_STANDARD_APP_ARGS(args, parse);
- LOCAL_USER_ADD(lu);
+ lu = ast_module_user_add(chan);
if (ast_strlen_zero(args.interface)) {
args.interface = ast_strdupa(chan->name);
break;
}
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
return res;
}
static int ql_exec(struct ast_channel *chan, void *data)
{
- struct localuser *u;
+ struct ast_module_user *u;
char *parse;
AST_DECLARE_APP_ARGS(args,
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
parse = ast_strdupa(data);
if (ast_strlen_zero(args.queuename) || ast_strlen_zero(args.uniqueid)
|| ast_strlen_zero(args.peer) || ast_strlen_zero(args.event)) {
ast_log(LOG_WARNING, "QueueLog requires arguments (queuename|uniqueid|peer|event[|additionalinfo])\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
ast_queue_log(args.queuename, args.uniqueid, args.peer, args.event,
"%s", args.params ? args.params : "");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
{
int res=-1;
int ringing=0;
- struct localuser *lu;
+ struct ast_module_user *lu;
const char *user_priority;
const char *max_penalty_str;
int prio;
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
- LOCAL_USER_ADD(lu);
+ lu = ast_module_user_add(chan);
/* Setup our queue entry */
memset(&qe, 0, sizeof(qe));
set_queue_result(chan, reason);
res = 0;
}
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
return res;
}
{
int count = 0;
struct call_queue *q;
- struct localuser *lu;
+ struct ast_module_user *lu;
struct member *m;
buf[0] = '\0';
return -1;
}
- LOCAL_USER_ADD(lu);
+ lu = ast_module_user_add(chan);
AST_LIST_LOCK(&queues);
AST_LIST_TRAVERSE(&queues, q, list) {
ast_log(LOG_WARNING, "queue %s was not found\n", data);
snprintf(buf, len, "%d", count);
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
return 0;
}
{
int count = 0;
struct call_queue *q;
- struct localuser *lu;
+ struct ast_module_user *lu;
buf[0] = '\0';
return -1;
}
- LOCAL_USER_ADD(lu);
+ lu = ast_module_user_add(chan);
AST_LIST_LOCK(&queues);
AST_LIST_TRAVERSE(&queues, q, list) {
ast_log(LOG_WARNING, "queue %s was not found\n", data);
snprintf(buf, len, "%d", count);
- LOCAL_USER_REMOVE(lu);
+ ast_module_user_remove(lu);
return 0;
}
static int queue_function_queuememberlist(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
{
- struct localuser *u;
+ struct ast_module_user *u;
struct call_queue *q;
struct member *m;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
AST_LIST_LOCK(&queues);
AST_LIST_TRAVERSE(&queues, q, list) {
/* We should already be terminated, but let's make sure. */
buf[len - 1] = '\0';
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
}
{ "remove", "queue", "member", NULL }, handle_remove_queue_member,
"Removes a channel from a specified queue", rqm_cmd_usage, complete_remove_queue_member };
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res |= ast_custom_function_unregister(&queuewaitingcount_function);
res |= ast_unregister_application(app);
- clear_and_free_interfaces();
+ ast_module_user_hangup_all();
- STANDARD_HANGUP_LOCALUSERS;
+ clear_and_free_interfaces();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
int res;
return res;
}
-static int reload(void *mod)
+static int reload(void)
{
reload_queues();
return 0;
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1, reload, NULL, NULL);
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "True Call Queueing",
+ .load = load_module,
+ .unload = unload_module,
+ .reload = reload,
+ );
/*! \todo The Random() app should be removed from trunk following the release of 1.4 */
-static char *tdesc = "Random goto";
-
static char *app_random = "Random";
static char *random_synopsis = "Conditionally branches, based upon a probability";
" probability := INTEGER in the range 1 to 100\n"
"DEPRECATED: Use GotoIf($[${RAND(1,100)} > <number>]?<label>)\n";
-LOCAL_USER_DECL;
static int random_exec(struct ast_channel *chan, void *data)
{
int res=0;
- struct localuser *u;
+ struct ast_module_user *u;
char *s;
char *prob;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
s = ast_strdupa(data);
ast_verbose( VERBOSE_PREFIX_3 "Random branches to (%s,%s,%d)\n",
chan->context,chan->exten, chan->priority+1);
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app_random);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app_random, random_exec, random_synopsis, random_descrip);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Random goto");
AST_APP_OPTION('n', OPT_NOANSWER),
});
-static char *tdesc = "Read Variable Application";
-
static char *app = "Read";
static char *synopsis = "Read a variable";
" timeout -- if greater than 0, that value will override the default timeout.\n\n"
"Read should disconnect if the function fails or errors out.\n";
-LOCAL_USER_DECL;
#define ast_next_data(instr,ptr,delim) if((ptr=strchr(instr,delim))) { *(ptr) = '\0' ; ptr++;}
static int read_exec(struct ast_channel *chan, void *data)
{
int res = 0;
- struct localuser *u;
+ struct ast_module_user *u;
char tmp[256];
int maxdigits=255;
int tries = 1;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
argcopy = ast_strdupa(data);
}
if (ast_strlen_zero(arglist.variable)) {
ast_log(LOG_WARNING, "Invalid! Usage: Read(variable[|filename][|maxdigits][|option][|attempts][|timeout])\n\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
ts=NULL;
if (ast_test_flag(&flags,OPT_SKIP)) {
/* At the user's option, skip if the line is not up */
pbx_builtin_setvar_helper(chan, arglist.variable, "\0");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
} else if (!ast_test_flag(&flags,OPT_NOANSWER)) {
/* Otherwise answer unless we're supposed to read while on-hook */
}
}
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, read_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Read Variable Application");
#include "asterisk/app.h"
#include "asterisk/module.h"
-static char *tdesc = "Stores output of file into a variable";
-
static char *app_readfile = "ReadFile";
static char *readfile_synopsis = "ReadFile(varname=file,length)";
" File - The name of the file to read.\n"
" Length - Maximum number of characters to capture.\n";
-LOCAL_USER_DECL;
static int readfile_exec(struct ast_channel *chan, void *data)
{
int res=0;
- struct localuser *u;
+ struct ast_module_user *u;
char *s, *varname=NULL, *file=NULL, *length=NULL, *returnvar=NULL;
int len=0;
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
s = ast_strdupa(data);
if (!varname || !file) {
ast_log(LOG_ERROR, "No file or variable specified!\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
pbx_builtin_setvar_helper(chan, varname, returnvar);
free(returnvar);
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app_readfile);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app_readfile, readfile_exec, readfile_synopsis, readfile_descrip);
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Stores output of file into a variable");
#define next_one(var) var = var->next
#define crop_data(str) { *(str) = '\0' ; (str)++; }
-static char *tdesc = "Realtime Data Lookup/Rewrite";
static char *app = "RealTime";
static char *uapp = "RealTimeUpdate";
static char *synopsis = "Realtime Data Lookup";
"updated to <newval>. REALTIMECOUNT will be set with the number of rows\n"
"updated or -1 if an error occurs.\n";
-LOCAL_USER_DECL;
static int cli_load_realtime(int fd, int argc, char **argv)
{
static int realtime_update_exec(struct ast_channel *chan, void *data)
{
char *family=NULL, *colmatch=NULL, *value=NULL, *newcol=NULL, *newval=NULL;
- struct localuser *u;
+ struct ast_module_user *u;
int res = 0, count = 0;
char countc[13];
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
family = ast_strdupa(data);
if ((colmatch = strchr(family,'|'))) {
snprintf(countc, sizeof(countc), "%d", count);
pbx_builtin_setvar_helper(chan, "REALTIMECOUNT", countc);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
static int realtime_exec(struct ast_channel *chan, void *data)
{
int res=0, count=0;
- struct localuser *u;
+ struct ast_module_user *u;
struct ast_variable *var, *itt;
char *family=NULL, *colmatch=NULL, *value=NULL, *prefix=NULL, *vname=NULL;
char countc[13];
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
family = ast_strdupa(data);
if ((colmatch = strchr(family,'|'))) {
snprintf(countc, sizeof(countc), "%d", count);
pbx_builtin_setvar_helper(chan, "REALTIMECOUNT", countc);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res |= ast_unregister_application(uapp);
res |= ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
int res;
return res;
}
-static const char *description(void)
-{
- return tdesc;
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Realtime Data Lookup/Rewrite");
"If the user should hangup during a recording, all data will be lost and the\n"
"application will teminate. \n";
-LOCAL_USER_DECL;
static int record_exec(struct ast_channel *chan, void *data)
{
char tmp[256];
struct ast_filestream *s = '\0';
- struct localuser *u;
+ struct ast_module_user *u;
struct ast_frame *f = NULL;
struct ast_dsp *sildet = NULL; /* silence detector dsp */
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
/* Yay for strsep being easy */
vdata = ast_strdupa(data);
}
if (!ext) {
ast_log(LOG_WARNING, "No extension specified to filename!\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
if (silstr) {
if (chan->_state != AST_STATE_UP) {
if (option_skip) {
/* At the user's option, skip if the line is not up */
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return 0;
} else if (!option_noanswer) {
/* Otherwise answer unless we're supposed to record while on-hook */
res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
sildet = ast_dsp_new();
if (!sildet) {
ast_log(LOG_WARNING, "Unable to create silence detector :(\n");
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return -1;
}
ast_dsp_set_threshold(sildet, 256);
ast_dsp_free(sildet);
}
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-static int unload_module(void *mod)
+static int unload_module(void)
{
int res;
res = ast_unregister_application(app);
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
return res;
}
-static int load_module(void *mod)
+static int load_module(void)
{
return ast_register_application(app, record_exec, synopsis, descrip);
}
-static const char *description(void)
-{
- return "Trivial Record Application";
-}
-
-static const char *key(void)
-{
- return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Trivial Record Application");
-/* #define OLD_ASTERISK */
/*
* Asterisk -- An open source telephony toolkit.
*
#include "asterisk/say.h"
#include "asterisk/localtime.h"
-static char *tdesc = "Radio Repeater / Remote Base version 0.48 06/13/2006";
-
static char *app = "Rpt";
static char *synopsis = "Radio Repeater/Remote Base Control System";
" available to the phone user.\n"
"\n";
+static unsigned int vmajor = 0;
+static unsigned int vminor = 47;
+
static int debug = 0; /* FIXME Set this >0 for extra debug output */
static int nrpts = 0;
STANDARD_LOCAL_USER;
#endif
-LOCAL_USER_DECL;
#define MSWAIT 200
#define HANGTIME 5000
struct rpt *myrpt;
struct rpt_link *l,*m,linkbase;
struct ast_channel *mychannel;
-int vmajor, vminor;
char *p,*ct,*ct_copy,*ident, *nodename;
time_t t;
struct tm localtm;
imdone = 1;
break;
case STATS_VERSION:
- p = strstr(tdesc, "version");
- if(!p)
- break;
- if(sscanf(p, "version %d.%d", &vmajor, &vminor) != 2)
- break;
wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */
/* Say "version" */
if (sayfile(mychannel,"rpt/version") == -1)
static int rpt_exec(struct ast_channel *chan, void *data)
{
int res=-1,i,rem_totx,n,phone_mode = 0;
- struct localuser *u;
+ struct ast_module_user *u;
char tmp[256], keyed = 0;
char *options,*stringp,*tele,c;
struct rpt *myrpt;
ast_log(LOG_WARNING, "Cant get io permission on IO port %x hex\n",myrpt->p.iobase);
return -1;
}
- LOCAL_USER_ADD(u);
+ u = ast_module_user_add(chan);
rpt_mutex_unlock(&myrpt->lock);
/* find our index, and load the vars initially */
for(i = 0; i < nrpts; i++)
myrpt->remoteon = 0;
rpt_mutex_unlock(&myrpt->lock);
closerem(myrpt);
- LOCAL_USER_REMOVE(u);
+ ast_module_user_remove(u);
return res;
}
-#ifdef OLD_ASTERISK
-int unload_module()
-#else
-static int unload_module(void* mod)
-#endif
+static int unload_module(void)
{
int i;
- STANDARD_HANGUP_LOCALUSERS;
+ ast_module_user_hangup_all();
for(i = 0; i < nrpts; i++) {
if (!strcmp(rpt_vars[i].name,rpt_vars[i].p.nodes)) continue;
ast_mutex_destroy(&rpt_vars[i].lock);
return i;
}
-#ifdef OLD_ASTERISK
-int load_module()
-#else
-static int load_module(void *mod)
-#endif
+static int load_module(void)
{
ast_pthread_create(&rpt_master_thread,NULL,rpt_master,NULL);
return ast_register_application(app, rpt_exec, synopsis, descrip);
}
-#ifdef OLD_ASTERISK
-char *description()
-#else
-static const char *description(void)
-#endif
-{
- return tdesc;
-}
-
-#ifdef OLD_ASTERISK
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
-}
-#endif
-
-#ifdef OLD_ASTERISK
-char *key()
-#else
-static const char *key(void)
-#endif
+static int reload(void)
{
- return ASTERISK_GPL_KEY;
-}
-
-#ifdef OLD_ASTERISK
-int reload()
-#else
-static int reload(void *mod)
-#endif
-{
-int n;
+ int n;
for(n = 0; n < nrpts; n++) rpt_vars[n].reload = 1;
return(0);
}
-#ifndef OLD_ASTERISK
-STD_MOD(MOD_1, reload, NULL, NULL);
-#endif
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Radio Repeater / Remote Base",
+ .load = load_module,
+ .unload = unload_module,
+ .reload = reload,
+ );