Directory reorder #3

git-svn-id: http://voip.null.ro/svn/yate@1476 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2007-11-15 23:06:36 +00:00
parent b30c869a4e
commit d32c220960
70 changed files with 5148 additions and 3715 deletions

View File

@ -16,7 +16,7 @@ CFLAGS := -O2 @MODULE_CPPFLAGS@ @INLINE_FLAGS@
LDFLAGS:=
LDCONFIG:=true
MKDEPS := ./config.status
MKDEPS := @top_builddir@/config.status
PROGS:= yate
YLIB := libyate.so.@PACKAGE_VERSION@
SLIBS:= $(YLIB) libyate.so
@ -35,17 +35,19 @@ DOCGEN_F := $(INCS)
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
basedir = @libdir@/yate
confdir = @sysconfdir@/yate
bindir = @bindir@
libdir = @libdir@
incdir = @includedir@/yate
mandir = @mandir@
docdir = $(prefix)/share/doc/yate-@PACKAGE_VERSION@
docdir = @datarootdir@/doc/yate-@PACKAGE_VERSION@
vardir = @localstatedir@/lib/yate
moddir = $(basedir)/modules
scrdir = $(basedir)/scripts
shrdir = $(datadir)/yate
# include optional local make rules
-include YateLocal.mak
@ -54,18 +56,18 @@ DOCGEN :=
DOCGEN_K :=
DOCGEN_D :=
ifneq (_@KDOC_BIN@,_)
DOCGEN_K := @KDOC_BIN@ -C ./kdoc-filter.sh -d docs/api/ $(DOCGEN_F)
DOCGEN_K := @KDOC_BIN@ -C ./docs/doc-filter.sh -d docs/api/ $(DOCGEN_F)
DOCGEN := $(DOCGEN_K)
endif
ifneq (_@DOXYGEN_BIN@,_)
DOCGEN_D := (cat Doxyfile; echo 'INPUT = $(DOCGEN_F)') | @DOXYGEN_BIN@ -
DOCGEN_D := (cat docs/Doxyfile; echo 'INPUT = $(DOCGEN_F)') | @DOXYGEN_BIN@ -
DOCGEN := $(DOCGEN_D)
endif
.PHONY: all everything debug ddebug xdebug ndebug
all: engine modules clients
everything: engine contrib modules clients test apidocs
everything: engine libs modules clients test apidocs
debug:
$(MAKE) all DEBUG=-g3 MODSTRIP=
@ -85,8 +87,7 @@ clean:
$(MAKE) -C ./engine $@
$(MAKE) -C ./modules $@
$(MAKE) -C ./clients $@
$(MAKE) -C ./test $@
@for i in contrib/*; do \
@for i in libs/*; do \
test ! -f "$$i/Makefile" || $(MAKE) -C "$$i" clean ; \
done
@ -101,8 +102,8 @@ clean-config-files: check-topdir
-rm -f @CONFIGURE_FILES@
clean-tables: check-topdir
-rm -f yate.spec
$(MAKE) -C ./tables -f Makefile.tables mrproper
-rm -f packing/rpm/yate.spec
$(MAKE) -C ./engine/tables -f Makefile.tables mrproper
clean-apidocs: check-topdir
-rm docs/api/*.*
@ -112,7 +113,7 @@ distclean: check-topdir clean clean-config-files
cvsclean: check-topdir clean clean-tables clean-apidocs clean-config-files
-rm -f configure
.PHONY: engine contrib modules clients test apidocs-build apidocs-kdoc apidocs-doxygen check-topdir windows
.PHONY: engine libs modules clients test apidocs-build apidocs-kdoc apidocs-doxygen check-topdir windows
engine: tables library libyate.so $(PROGS)
apidocs-kdoc: check-topdir
@ -138,7 +139,7 @@ apidocs-build:
apidocs: @srcdir@/docs/api/index.html
@srcdir@/docs/api/index.html: @srcdir@/Doxyfile \
@srcdir@/docs/api/index.html: @srcdir@/docs/Doxyfile \
@srcdir@/yateclass.h @srcdir@/yatemime.h @srcdir@/yatengine.h \
@srcdir@/yatephone.h @srcdir@/yatecbase.h
$(MAKE) apidocs-build
@ -160,20 +161,20 @@ war:
modules clients test: engine
$(MAKE) -C ./$@ all
contrib: engine
@for i in contrib/*; do \
libs: engine
@for i in libs/*; do \
test ! -f "$$i/Makefile" || $(MAKE) -C "$$i" all ; \
done
tables: @srcdir@/tables/all.h
tables: @srcdir@/engine/tables/all.h
@srcdir@/tables/all.h:
$(MAKE) -C @srcdir@/tables -f Makefile.tables all
@srcdir@/engine/tables/all.h:
$(MAKE) -C @srcdir@/engine/tables -f Makefile.tables all
yatepaths.h: $(MKDEPS)
@echo '#define MOD_PATH "$(DESTDIR)$(moddir)"' > $@
@echo '#define SCR_PATH "$(DESTDIR)$(scrdir)"' >> $@
@echo '#define CFG_PATH "$(DESTDIR)$(confdir)"' >> $@
@echo '#define CFG_PATH "$(DESTDIR)$(confdir)"' > $@
@echo '#define MOD_PATH "$(DESTDIR)$(moddir)"' >> $@
@echo '#define SHR_PATH "$(DESTDIR)$(shrdir)"' >> $@
windows: check-topdir
@cmp -s yateversn.h $@/yateversn.h || cp -p yateversn.h $@/yateversn.h
@ -196,11 +197,11 @@ install-noapi: all
install $(PROGS) yate-config "$(DESTDIR)$(bindir)/"
$(MAKE) -C ./modules install
$(MAKE) -C ./clients install
$(MAKE) -C ./scripts install
$(MAKE) -C ./share install
$(MAKE) -C ./conf.d install
@mkdir -p "$(DESTDIR)$(mandir)/man8/" && \
for i in $(MAN8) ; do \
install -m 0644 @srcdir@/$$i "$(DESTDIR)$(mandir)/man8/" ; \
install -m 0644 @srcdir@/docs/man/$$i "$(DESTDIR)$(mandir)/man8/" ; \
done
@mkdir -p "$(DESTDIR)$(libdir)/pkgconfig/" && \
install -m 0644 yate.pc "$(DESTDIR)$(libdir)/pkgconfig/"
@ -208,7 +209,7 @@ install-noapi: all
for i in $(INCS) ; do \
install -m 0644 @srcdir@/$$i "$(DESTDIR)$(incdir)/" ; \
done
for i in $(GENS) ; do \
@for i in $(GENS) ; do \
install -m 0644 $$i "$(DESTDIR)$(incdir)/" ; \
done
@mkdir -p "$(DESTDIR)$(docdir)/api/" && \
@ -217,7 +218,7 @@ install-noapi: all
done ;
install-api: apidocs
mkdir -p "$(DESTDIR)$(docdir)/api/" && \
@mkdir -p "$(DESTDIR)$(docdir)/api/" && \
install -m 0644 @srcdir@/docs/*.html "$(DESTDIR)$(docdir)/" && \
install -m 0644 @srcdir@/docs/api/*.* "$(DESTDIR)$(docdir)/api/"
@ -249,24 +250,25 @@ install-root uninstall-root: LDCONFIG:=ldconfig
.PHONY: snapshot tarball rpm srpm
snapshot tarball: check-topdir clean tables windows apidocs
@if [ $@ = snapshot ]; then ver="`date '+CVS-%Y%m%d'`"; else ver="@PACKAGE_VERSION@-@PACKAGE_RELEASE@"; fi ; \
@if [ $@ = snapshot ]; then ver="`date '+SVN-%Y%m%d'`"; else ver="@PACKAGE_VERSION@-@PACKAGE_RELEASE@"; fi ; \
wd=`pwd|sed 's,^.*/,,'`; \
mkdir -p tarballs; cd ..; \
mkdir -p packing/tarballs; cd ..; \
echo $$wd/tar-exclude >$$wd/tar-exclude; \
find $$wd -name Makefile >>$$wd/tar-exclude; \
find $$wd -name YateLocal.mak >>$$wd/tar-exclude; \
find $$wd -name 'YateLocal*' >>$$wd/tar-exclude; \
find $$wd/conf.d -name '*.conf' >>$$wd/tar-exclude; \
find $$wd -name '*.cache' >>$$wd/tar-exclude; \
find $$wd -name '*~' >>$$wd/tar-exclude; \
find $$wd -name '.*.swp' >>$$wd/tar-exclude; \
if [ $@ = tarball ]; then \
find $$wd -name .svn >>$$wd/tar-exclude; \
find $$wd -name CVS >>$$wd/tar-exclude; \
find $$wd -name .cvsignore >>$$wd/tar-exclude; \
else \
echo "$$wd/yate.spec" >>$$wd/tar-exclude; \
echo "$$wd/packing/rpm/yate.spec" >>$$wd/tar-exclude; \
fi ; \
tar czf $$wd/tarballs/$$wd-$$ver.tar.gz \
--exclude $$wd/tarballs \
tar czf $$wd/packing/tarballs/$$wd-$$ver.tar.gz \
--exclude $$wd/packing/tarballs \
--exclude $$wd/config.status \
--exclude $$wd/config.log \
--exclude $$wd/run \
@ -279,10 +281,10 @@ snapshot tarball: check-topdir clean tables windows apidocs
rm $$wd/tar-exclude
rpm: check-root tarball
rpmbuild -tb tarballs/yate-@PACKAGE_VERSION@-@PACKAGE_RELEASE@.tar.gz
rpmbuild -tb packing/tarballs/yate-@PACKAGE_VERSION@-@PACKAGE_RELEASE@.tar.gz
srpm: check-root tarball
rpmbuild -ta tarballs/yate-@PACKAGE_VERSION@-@PACKAGE_RELEASE@.tar.gz
rpmbuild -ta packing/tarballs/yate-@PACKAGE_VERSION@-@PACKAGE_RELEASE@.tar.gz
%.o: @srcdir@/%.cpp $(MKDEPS) @srcdir@/yatengine.h
$(COMPILE) -c $<
@ -294,7 +296,7 @@ config.status: @srcdir@/configure
./config.status --recheck
Makefile: @srcdir@/Makefile.in $(MKDEPS)
./config.status
@top_builddir@/config.status
yate: libyate.so $(OBJS) $(LIBS)
$(LINK) -o $@ $(LIBTHR) $^
@ -308,9 +310,9 @@ library $(YLIB): yatepaths.h
.PHONY: help
help:
@echo -e 'Usual make targets:\n\
all engine contrib modules clients apidocs test everything\n\
install uninstall install-noapi install-root uninstall-root\n\
clean distclean cvsclean (avoid this one!) clean-apidocs\n\
debug ddebug xdebug (carefull!)\n\
snapshot tarball rpm srpm'
@echo -e 'Usual make targets:\n'\
' all engine libs modules clients apidocs test everything\n'\
' install uninstall install-noapi install-root uninstall-root\n'\
' clean distclean cvsclean (avoid this one!) clean-apidocs\n'\
' debug ddebug xdebug (carefull!)\n'\
' snapshot tarball rpm srpm'

View File

@ -2,7 +2,7 @@
# Run this to generate a new configure script
if [ -s tables/a2s.h ]; then
if [ -s engine/tables/a2s.h ]; then
echo "Good! Tables are generated so we don't need sox."
else
if [ -z `which sox 2>/dev/null` ]; then

View File

@ -1,5 +1,5 @@
Makefile
YateLocal.mak
YateLocal*
core*
yate-*
*.o

View File

@ -17,18 +17,19 @@ LDFLAGS:= -L.. -lyate
INCFILES := @top_srcdir@/yatengine.h @top_srcdir@/yatephone.h ../yateversn.h
SUBDIRS :=
MKDEPS := ../config.status
MKDEPS := @top_builddir@/config.status
PROGS :=
LIBS :=
MENUFILES :=
DESKFILES :=
GTKCLIENT := ../contrib/gtk2/libgtk2client.a
GTKCLIENT := gtk2/libgtk2client.a
ifneq (@HAVE_GTK2@,no)
PROGS := $(PROGS) yate-gtk2
MENUFILES := $(MENUFILES) yate-gtk2.menu
DESKFILES := $(DESKFILES) yate-gtk2.desktop
ICONFILES := $(ICONFILES) null_team-16.png null_team-32.png
endif
LOCALFLAGS =
@ -38,10 +39,14 @@ LINK = $(CXX) $(LDFLAGS)
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
bindir = @bindir@
moddir = @libdir@/yate
menudir= @libdir@/menu
deskdir= $(prefix)/share/applications
shrdir = $(datadir)/yate
deskdir= $(datadir)/applications
icondir= $(datadir)/pixmaps
# include optional local make rules
-include YateLocal.mak
@ -68,6 +73,12 @@ install: all do-install
install -D -m 0644 "@srcdir@/$$i" "$(DESTDIR)$(menudir)/$$i" ; \
done \
)
$(if $(ICONFILES),\
@mkdir -p "$(DESTDIR)$(icondir)/" && \
for i in $(ICONFILES) ; do \
install -D -m 0644 "@srcdir@/$$i" "$(DESTDIR)$(icondir)/$$i" ; \
done \
)
$(if $(DESKFILES),\
@mkdir -p "$(DESTDIR)$(deskdir)/" && \
for i in $(DESKFILES) ; do \
@ -93,6 +104,12 @@ uninstall: do-uninstall
done ; \
rmdir "$(DESTDIR)$(deskdir)" \
)
$(if $(ICONFILES),\
@-for i in $(ICONFILES) ; do \
rm "$(DESTDIR)$(icondir)/$$i" ; \
done ; \
rmdir "$(DESTDIR)$(icondir)" \
)
%.o: @srcdir@/%.cpp $(MKDEPS) $(INCFILES)
$(COMPILE) -c $<
@ -108,7 +125,7 @@ do-all do-strip do-clean do-install do-uninstall:
)
Makefile: @srcdir@/Makefile.in $(MKDEPS)
cd .. && ./config.status
cd @top_builddir@ && ./config.status
yate-%: @srcdir@/main-%.cpp $(MKDEPS) ../libyate.so $(INCFILES)
$(COMPILE) -o $@ $(LOCALFLAGS) $< $(LIBTHR) $(LDFLAGS) $(LOCALLIBS)
@ -119,4 +136,4 @@ yate-gtk2: LOCALFLAGS = @GTK2_INC@
yate-gtk2: LOCALLIBS = @GTK2_LIB@
$(GTKCLIENT):
$(MAKE) -C ../contrib/gtk2
$(MAKE) -C gtk2

View File

@ -1,5 +1,5 @@
Makefile
YateLocal.mak
YateLocal*
core*
*.o
*.a

View File

@ -46,5 +46,5 @@ $(PROJECT): $(OBJECTS)
%.o: @srcdir@/%.cpp $(INCFILES)
$(COMPILE) -c $<
Makefile: @srcdir@/Makefile.in ../../config.status
cd ../.. && ./config.status
Makefile: @srcdir@/Makefile.in @top_builddir@/config.status
cd @top_builddir@ && ./config.status

View File

@ -1986,7 +1986,7 @@ GTKClient::GTKClient()
m_oneThread = Engine::config().getBoolValue("client","onethread",ONE_THREAD);
s_skinPath = Engine::config().getValue("client","skinbase");
if (s_skinPath.null())
s_skinPath << Engine::modulePath() << Engine::pathSeparator() << "skin";
s_skinPath << Engine::sharedPath() << Engine::pathSeparator() << "skins";
if (!s_skinPath.endsWith(Engine::pathSeparator()))
s_skinPath << Engine::pathSeparator();
String skin(Engine::config().getValue("client","skin","default"));

View File

@ -24,7 +24,7 @@
#include <yatephone.h>
#include <gtk/gtk.h>
#include "../contrib/gtk2/gtk2client.h"
#include "gtk2/gtk2client.h"
using namespace TelEngine;

BIN
clients/null_team-16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

BIN
clients/null_team-32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

View File

@ -4,7 +4,7 @@
if [ -x yate-gtk2 -a -x ../run ]; then
# Need to put the path to Mozilla libraries here
export LD_LIBRARY_PATH=/usr/lib/mozilla-1.6
export LD_LIBRARY_PATH=/usr/lib64/firefox-2.0.0.3
cd ..; exec ./run --executable clients/yate-gtk2 "$@"
else
echo "Could not find client executable or run script" >&2

View File

@ -1,5 +1,5 @@
Makefile
YateLocal.mak
YateLocal*
core*
*.conf
*.orig

View File

@ -17,7 +17,7 @@ all:
.PHONY: install
install:
@mkdir -p "$(DESTDIR)$(confdir)/" && \
lst="`ls -1 @srcdir@/*.conf @srcdir@/*.sample @srcdir@/*.default @srcdir@/*.sql | sed 's/\.sample//g; s/\.default//g; s/[^ ]*\*\.[^ ]*//g' | sort | uniq`" ; \
lst="`ls -1 @srcdir@/*.conf @srcdir@/*.sample @srcdir@/*.default | sed 's/\.sample//g; s/\.default//g; s/[^ ]*\*\.[^ ]*//g' | sort | uniq`" ; \
for s in $$lst; do \
d="$(DESTDIR)$(confdir)/`echo $$s | sed 's,.*/,,'`" ; \
if [ -f "$$d" ]; then \
@ -35,5 +35,5 @@ install:
uninstall:
@-rmdir "$(DESTDIR)$(confdir)" || echo "Remove conf files by hand if you want so"
Makefile: @srcdir@/Makefile.in ../config.status
cd .. && ./config.status
Makefile: @srcdir@/Makefile.in @top_builddir@/config.status
cd @top_builddir@ && ./config.status

View File

@ -5,7 +5,7 @@
; scripts if no full path is specified
; Note that a trailing path separator should be added
; Uncomment the following line when running in the sources directory
;scripts_dir=scripts/
;scripts_dir=share/scripts/
; priority: int: Priority of the call.execute handler
;priority=100

View File

@ -1,8 +1,5 @@
; This minimal file is here just to set the default skin.
; You can replace it with a more complete version from yate.conf.sample
[client]
skin=tabbed
[localsym]
h323chan.yate=yes

View File

@ -1,5 +1,5 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(Yate, 1.3.0)
AC_INIT(Yate, 2.0.0)
AC_CONFIG_SRCDIR([README])
AC_PREREQ(2.52)
@ -285,13 +285,13 @@ HAVE_MYSQL=yes
fi
fi
AC_MSG_RESULT([$HAVE_MYSQL $MYSQL_VER])
if [[ "x$HAVE_MYSQL" = "xyes" ]]; then
if test "$HAVE_MYSQL" = "yes"; then
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $MYSQL_INC"
AC_CHECK_DECLS([MYSQL_OPT_RECONNECT],[MYSQL_INC="$MYSQL_INC -DMYSQL_OPT_RECONNECT=MYSQL_OPT_RECONNECT"],,[#include<mysql.h>])
AC_CHECK_DECLS([MYSQL_OPT_READ_TIMEOUT],[MYSQL_INC="$MYSQL_INC -DMYSQL_OPT_READ_TIMEOUT=MYSQL_OPT_READ_TIMEOUT"],,[#include<mysql.h>])
AC_CHECK_DECLS([MYSQL_OPT_WRITE_TIMEOUT],[MYSQL_INC="$MYSQL_INC -DMYSQL_OPT_WRITE_TIMEOUT=MYSQL_OPT_WRITE_TIMEOUT"],,[#include<mysql.h>])
CPPFLAGS="$save_CPPFLAGS"
CPPFLAGS=$save_CPPFLAGS
fi
fi
AC_SUBST(HAVE_MYSQL)
@ -759,29 +759,32 @@ AC_SUBST(KDOC_BIN)
m4_sinclude(./YateLocal.ac)
AC_CONFIG_FILES([yate.spec
AC_CONFIG_FILES([packing/rpm/yate.spec
yate.pc
yateversn.h
yateiss.inc
Makefile
engine/Makefile
modules/Makefile
modules/skin/Makefile
modules/help/Makefile
modules/test/Makefile
clients/Makefile
scripts/Makefile
conf.d/Makefile
contrib/ilbc/Makefile
contrib/ysip/Makefile
contrib/yrtp/Makefile
contrib/yiax/Makefile
contrib/yxml/Makefile
contrib/yjingle/Makefile
contrib/ypbx/Makefile
contrib/gtk2/Makefile
test/Makefile])
clients/gtk2/Makefile
libs/ilbc/Makefile
libs/ysip/Makefile
libs/yrtp/Makefile
libs/yiax/Makefile
libs/yxml/Makefile
libs/yjingle/Makefile
libs/ymgcp/Makefile
libs/ysig/Makefile
libs/ypbx/Makefile
share/Makefile
share/scripts/Makefile
share/skins/Makefile
share/help/Makefile
conf.d/Makefile])
AC_CONFIG_FILES([yate-config],[chmod +x yate-config])
AC_CONFIG_FILES([run],[chmod +x run])
CONFIGURE_FILES=`echo "$ac_config_files config.status config.log" | sed 's/yate\.spec *//'`
CONFIGURE_FILES=`echo "$ac_config_files config.status config.log" | sed 's,packing/yate\.spec *,,'`
AC_SUBST(CONFIGURE_FILES)
AC_OUTPUT

View File

@ -72,7 +72,7 @@ EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER = ./kdoc-filter.sh
INPUT_FILTER = ./docs/doc-filter.sh
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing

View File

@ -16,7 +16,7 @@
.\" Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
.\"
.\"
.TH YATE-CONFIG 8 "March 2004" "YATE" "Telephony Engine"
.TH YATE-CONFIG 8 "September 2007" "YATE" "Telephony Engine"
.SH NAME
\fByate-config\fP \- retrieve metainformation about the YATE telephony engine
.SH SYNOPSIS
@ -44,6 +44,15 @@ Returns the configuration files directory
.TP
.B \-\-modules
Returns the modules directory
.TP
.B \-\-share
Returns the base shared directory
.TP
.B \-\-scripts
Returns the scripts directory
.TP
.B \-\-skins
Returns the base skins directory
.SS Compiler flags
.TP
.B \-\-cflags
@ -67,7 +76,7 @@ All linker options \- the above two concatenated
.SH AUTHORS
Paul Chitescu <paulc@voip.null.ro>
.br
Diana Cionoiu <diana@diana.null.ro>
Diana Cionoiu <diana@voip.null.ro>
.SH SEE ALSO
.BR yate (8),
.BR pkg-config (1)

View File

@ -16,7 +16,7 @@
.\" Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
.\"
.\"
.TH YATE 8 "September 2005" "YATE" "Telephony Engine"
.TH YATE 8 "September 2007" "YATE" "Telephony Engine"
.SH NAME
\fByate\fP \- launch the YATE telephony engine
.SH SYNOPSIS
@ -65,6 +65,9 @@ Path to conf files directory, overrides compiled-in value
.B \-m \fIpathname\fR
Path to modules directory, overrides compiled-in value
.TP
.B \-e \fIpathname\fR
Path to shared directory, overrides compiled-in value
.TP
.B \-x \fIrelpath\fR
Relative path to extra modules directory (can be repeated)
.TP
@ -145,6 +148,6 @@ when the thread terminates.
.SH AUTHORS
Paul Chitescu <paulc@voip.null.ro>
.br
Diana Cionoiu <diana@diana.null.ro>
Diana Cionoiu <diana@voip.null.ro>
.SH SEE ALSO
.BR yate-config (8)

View File

@ -1,5 +1,5 @@
Makefile
YateLocal.mak
YateLocal*
core*
*.o
*.a

View File

@ -26,7 +26,7 @@
#include <stdlib.h>
extern "C" {
#include "tables/all.h"
#include "all.h"
}
using namespace TelEngine;

View File

@ -133,6 +133,7 @@ static void sighandler(int signal)
}
}
String Engine::s_shrpath(SHR_PATH);
String Engine::s_cfgpath(CFG_PATH);
String Engine::s_cfgsuffix(CFG_SUFFIX);
String Engine::s_modpath(MOD_PATH);
@ -605,6 +606,7 @@ int Engine::run()
s_runid = Time::secNow();
DDebug(DebugAll,"Engine::run()");
install(new EngineStatusHandler);
extraPath(clientMode() ? "client" : "server");
loadPlugins();
Debug(DebugAll,"Loaded %d plugins",plugins.count());
if (s_super_handle >= 0) {
@ -632,7 +634,7 @@ int Engine::run()
::signal(SIGUSR1,sighandler);
::signal(SIGUSR2,sighandler);
#endif
Output("Yate engine is initialized and starting up");
Output("Yate%s engine is initialized and starting up",clientMode() ? " client" : "");
while (s_haltcode == -1) {
if (s_cmds) {
Output("Executing initial commands");
@ -999,6 +1001,7 @@ static void usage(bool client, FILE* f)
" -p filename Write PID to file\n"
" -l filename Log to file\n"
" -n configname Use specified configuration name (%s)\n"
" -e pathname Path to shared files directory (" SHR_PATH ")\n"
" -c pathname Path to conf files directory (" CFG_PATH ")\n"
" -m pathname Path to modules directory (" MOD_PATH ")\n"
" -x relpath Relative path to extra modules directory (can be repeated)\n"
@ -1164,6 +1167,14 @@ int Engine::main(int argc, const char** argv, const char** env, RunMode mode, bo
pc = 0;
cfgfile=argv[++i];
break;
case 'e':
if (i+1 >= argc) {
noarg(client,argv[i]);
return ENOENT;
}
pc = 0;
s_shrpath=argv[++i];
break;
case 'c':
if (i+1 >= argc) {
noarg(client,argv[i]);

View File

@ -16,7 +16,7 @@ CPPFLAGS := -O2 @MODULE_CPPFLAGS@ @INLINE_FLAGS@
LDFLAGS:=
LDCONFIG:=true
MKDEPS := ../config.status
MKDEPS := @top_builddir@/config.status
YLIB:= libyate.so.@PACKAGE_VERSION@
CINC := @top_srcdir@/yateclass.h @top_srcdir@/yatemime.h
EINC := $(CINC) @top_srcdir@/yatengine.h
@ -43,7 +43,7 @@ ifneq (@HAVE_SCTP_NETINET@,no)
SCTPOPTS := $(SCTPOPTS) -DHAVE_SCTP_NETINET
endif
ifeq (@INTERNAL_REGEX@,yes)
REGEX_INC:= -I@top_srcdir@/contrib/regex
REGEX_INC:= -I@top_srcdir@/engine/regex
LIBOBJS := $(LIBOBJS) regex.o
else
REGEX_INC:=
@ -55,11 +55,7 @@ exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
incdir = @includedir@/yate
mandir = @mandir@
docdir = $(prefix)/share/doc/yate-@PACKAGE_VERSION@
vardir = @localstatedir@/lib/yate
moddir = @libdir@/yate
confdir = @sysconfdir@/yate
# include optional local make rules
-include YateLocal.mak
@ -68,7 +64,7 @@ confdir = @sysconfdir@/yate
all: ../$(YLIB)
debug:
$(MAKE) all DEBUG=-g3
$(MAKE) all DEBUG=-g3
ddebug:
$(MAKE) all DEBUG='-g3 -DDEBUG'
@ -90,6 +86,9 @@ Engine.o: @srcdir@/Engine.cpp $(MKDEPS) $(EINC) ../yateversn.h ../yatepaths.h
Channel.o: @srcdir@/Channel.cpp $(MKDEPS) $(PINC)
$(COMPILE) -c $<
DataBlock.o: @srcdir@/DataBlock.cpp $(MKDEPS) $(EINC)
$(COMPILE) -I@top_srcdir@/engine/tables -c $<
DataFormat.o: @srcdir@/DataFormat.cpp $(MKDEPS) $(PINC)
$(COMPILE) -c $<
@ -108,14 +107,14 @@ Client.o: @srcdir@/Client.cpp $(MKDEPS) $(CLINC)
String.o: @srcdir@/String.cpp $(MKDEPS) $(CINC)
$(COMPILE) $(REGEX_INC) -c $<
regex.o: @top_srcdir@/contrib/regex/regex.c $(MKDEPS)
regex.o: @top_srcdir@/engine/regex/regex.c $(MKDEPS)
$(CCOMPILE) -DSTDC_HEADERS $(REGEX_INC) -c $<
%.o: @srcdir@/%.cpp $(MKDEPS) $(EINC)
$(COMPILE) -c $<
Makefile: @srcdir@/Makefile.in $(MKDEPS)
cd .. && ./config.status
cd @top_builddir@ && ./config.status
../$(YLIB): $(LIBOBJS) $(LIBS)
$(LINK) -shared -o $@ -Wl,--soname=$(YLIB) $(LIBTHR) $^ $(LIBAUX)

View File

@ -20,6 +20,3 @@ strip: all
install:
uninstall:
Makefile: ./Makefile.in ../config.status
cd .. && ./config.status

View File

@ -22,7 +22,7 @@ for i in ?2?; do
./gen b "$i" <"$i" >"$i.h"
;;
esac
echo "#include \"tables/$i.h\""
echo "#include \"$i.h\""
done >all.h
rm *.raw ?2? gen

View File

@ -1,5 +1,5 @@
Makefile
YateLocal.mak
YateLocal*
core*
*.o
*.a

View File

@ -1,5 +1,5 @@
Makefile
YateLocal.mak
YateLocal*
core*
*.o
*.a

8
libs/ymgcp/.cvsignore Normal file
View File

@ -0,0 +1,8 @@
Makefile
YateLocal*
core*
*.o
*.a
*.orig
*~
.*.swp

56
libs/ymgcp/Makefile.in Normal file
View File

@ -0,0 +1,56 @@
# Makefile
# This file holds the make rules for the libyatemgcp
DEBUG :=
CXX := @CXX@ -Wall
AR := ar
DEFS :=
INCLUDES := -I@top_srcdir@ -I../.. -I@srcdir@
CFLAGS := -O2 @MODULE_CPPFLAGS@ @INLINE_FLAGS@
LDFLAGS:= -L../.. -lyate
INCFILES := @top_srcdir@/yateclass.h @srcdir@/yatemgcp.h
PROGS=
LIBS = libyatemgcp.a
OBJS = engine.o transaction.o message.o endpoint.o
LOCALFLAGS =
LOCALLIBS =
COMPILE = $(CXX) $(DEFS) $(DEBUG) $(INCLUDES) $(CFLAGS)
LINK = $(CC) $(LDFLAGS)
prefix = @prefix@
exec_prefix = @exec_prefix@
# include optional local make rules
-include YateLocal.mak
.PHONY: all debug ddebug xdebug
all: $(LIBS) $(PROGS)
debug:
$(MAKE) all DEBUG=-g3 MODSTRIP=
ddebug:
$(MAKE) all DEBUG='-g3 -DDEBUG' MODSTRIP=
xdebug:
$(MAKE) all DEBUG='-g3 -DXDEBUG' MODSTRIP=
.PHONY: strip
strip: all
strip --strip-debug --discard-locals $(PROGS)
.PHONY: clean
clean:
@-$(RM) $(PROGS) $(LIBS) $(OBJS) core 2>/dev/null
%.o: @srcdir@/%.cpp $(INCFILES)
$(COMPILE) -c $<
Makefile: @srcdir@/Makefile.in ../../config.status
cd ../.. && ./config.status
libyatemgcp.a: $(OBJS)
$(AR) rcs $@ $^

101
libs/ymgcp/endpoint.cpp Normal file
View File

@ -0,0 +1,101 @@
/**
* endpoint.cpp
* Yet Another MGCP Stack
* This file is part of the YATE Project http://YATE.null.ro
*
* Yet Another Telephony Engine - a fully featured software PBX and IVR
* Copyright (C) 2004-2006 Null Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <yatemgcp.h>
using namespace TelEngine;
/**
* MGCPEndpoint
*/
// Construct the id. Append itself to the engine's list
MGCPEndpoint::MGCPEndpoint(MGCPEngine* engine, const char* user,
const char* host, int port)
: MGCPEndpointId(user,host,port),
m_engine(engine)
{
if (!m_engine) {
Debug(DebugNote,"Can't construct endpoint without engine [%p]",this);
return;
}
m_engine->attach(this);
}
// Remove itself from engine's list
MGCPEndpoint::~MGCPEndpoint()
{
if (m_engine)
m_engine->detach(this);
}
// Append info about a remote endpoint controlled by or controlling this endpoint.
// If the engine owning this endpoint is an MGCP gateway, only 1 remote peer (Call Agent) is allowed
MGCPEpInfo* MGCPEndpoint::append(const char* endpoint, const char* host, int port)
{
if (!m_engine || (m_engine->gateway() && m_remote.count() >= 1))
return 0;
if (!endpoint)
endpoint = user();
if (!port)
port = m_engine->defaultPort(!m_engine->gateway());
MGCPEpInfo* ep = new MGCPEpInfo(endpoint,host,port);
if (!ep->valid() || find(ep->id()))
TelEngine::destruct(ep);
else
m_remote.append(ep);
return ep;
}
// Find the info object associated with a remote peer
MGCPEpInfo* MGCPEndpoint::find(const char* epId)
{
Lock lock(m_mutex);
ObjList* obj = m_remote.find(epId);
return obj ? static_cast<MGCPEpInfo*>(obj->get()) : 0;
}
// Find the info object associated with an unique remote peer
MGCPEpInfo* MGCPEndpoint::peer()
{
return (m_remote.count() == 1) ? static_cast<MGCPEpInfo*>(m_remote.get()) : 0;
}
/**
* MGCPEndpointId
*/
// Set this endpoint id. Convert it to lower case
void MGCPEndpointId::set(const char* endpoint, const char* host, int port)
{
m_id = "";
m_endpoint = endpoint;
m_endpoint.toLower();
m_host = host;
m_host.toLower();
m_port = port;
m_id << m_endpoint << "@" << m_host;
if (m_port)
m_id << ":" << m_port;
}
/* vi: set ts=8 sw=4 sts=4 noet: */

830
libs/ymgcp/engine.cpp Normal file
View File

@ -0,0 +1,830 @@
/**
* engine.cpp
* Yet Another MGCP Stack
* This file is part of the YATE Project http://YATE.null.ro
*
* Yet Another Telephony Engine - a fully featured software PBX and IVR
* Copyright (C) 2004-2006 Null Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <yatemgcp.h>
#include <string.h>
namespace TelEngine {
// Engine process, receive or check timeouts
class MGCPPrivateThread : public Thread, public GenObject
{
public:
enum Action {
Process = 1,
Receive = 2,
};
// Create a thread to process or receive data for the engine
MGCPPrivateThread(MGCPEngine* engine, bool process, Thread::Priority priority);
virtual ~MGCPPrivateThread();
virtual void run();
private:
MGCPEngine* m_engine;
Action m_action;
};
};
using namespace TelEngine;
#define MAX_TRANS_ID 999999999 // Maximum length for transaction identifier
// Some default values. Time values are given in miliseconds
#define RECV_BUF_LEN 1500 // Receive buffer length
#define TR_RETRANS_INTERVAL 250
#define TR_RETRANS_INTERVAL_MIN 100
#define TR_RETRANS_COUNT 3
#define TR_RETRANS_COUNT_MIN 1
#define TR_EXTRA_TIME 30000
#define TR_EXTRA_TIME_MIN 10000
/**
* MGCPPrivateThread
*/
MGCPPrivateThread::MGCPPrivateThread(MGCPEngine* engine, bool process,
Thread::Priority priority)
: Thread(process?"MGCP private process":"MGCP private receive",priority),
m_engine(engine),
m_action(process?Process:Receive)
{
XDebug(m_engine,DebugInfo,"MGCPPrivateThread::MGCPPrivateThread() [%p]",this);
if (m_engine)
m_engine->appendThread(this);
}
MGCPPrivateThread::~MGCPPrivateThread()
{
XDebug(m_engine,DebugInfo,"MGCPPrivateThread::~MGCPPrivateThread() [%p]",this);
if (m_engine)
m_engine->removeThread(this);
}
void MGCPPrivateThread::run()
{
DDebug(m_engine,DebugInfo,"%s started [%p]",currentName(),this);
if (!m_engine)
return;
switch (m_action) {
case Process:
m_engine->runProcess();
break;
case Receive:
m_engine->runReceive();
break;
}
}
/**
* MGCPEngine
*/
MGCPEngine::MGCPEngine(bool gateway, const char* name, const NamedList* params)
: Mutex(true),
m_gateway(gateway),
m_initialized(false),
m_nextId(1),
m_address(AF_INET),
m_maxRecvPacket(RECV_BUF_LEN),
m_recvBuf(0),
m_allowUnkCmd(false),
m_retransInterval(TR_RETRANS_INTERVAL * 1000),
m_retransCount(TR_RETRANS_COUNT),
m_extraTime(TR_EXTRA_TIME * 1000),
m_parseParamToLower(true),
m_provisional(true)
{
debugName((name && *name) ? name : (gateway ? "mgcp_gw" : "mgcp_ca"));
DDebug(this,DebugAll,"MGCPEngine::MGCPEngine(). Gateway: %s [%p]",
String::boolText(gateway),this);
// Add known commands
for (int i = 0; mgcp_commands[i].token; i++)
m_knownCommands.append(new String(mgcp_commands[i].token));
// Init
if (params)
initialize(*params);
}
MGCPEngine::~MGCPEngine()
{
cleanup(false);
if (m_recvBuf)
delete[] m_recvBuf;
DDebug(this,DebugAll,"MGCPEngine::~MGCPEngine()");
}
// Initialize this engine
void MGCPEngine::initialize(const NamedList& params)
{
int level = params.getIntValue("debuglevel");
if (level)
debugLevel(level);
m_allowUnkCmd = params.getBoolValue("allow_unknown_cmd",false);
int val = params.getIntValue("retrans_interval",TR_RETRANS_INTERVAL);
m_retransInterval = 1000 * (val < TR_RETRANS_INTERVAL_MIN ? TR_RETRANS_INTERVAL_MIN : val);
val = params.getIntValue("retrans_count",TR_RETRANS_COUNT);
m_retransCount = (val < TR_RETRANS_COUNT_MIN ? TR_RETRANS_COUNT_MIN : val);
val = params.getIntValue("extra_time_to_live",TR_EXTRA_TIME);
m_extraTime = 1000 * (val < TR_EXTRA_TIME_MIN ? TR_EXTRA_TIME_MIN : val);
if (!m_initialized) {
val = params.getIntValue("max_recv_packet",RECV_BUF_LEN);
m_maxRecvPacket = val < RECV_BUF_LEN ? RECV_BUF_LEN : val;
}
m_parseParamToLower = params.getBoolValue("lower_case_params",true);
m_provisional = params.getBoolValue("send_provisional",true);
// Bind socket if not valid
if (!m_socket.valid()) {
m_address.host(params.getValue("localip"));
int port = params.getIntValue("port",-1);
m_address.port(port < 0 ? defaultPort(gateway()) : port);
m_socket.create(AF_INET,SOCK_DGRAM);
int reqlen = params.getIntValue("buffer");
if (reqlen > 0) {
#ifdef SO_RCVBUF
int buflen = reqlen;
if ((unsigned int)buflen < maxRecvPacket())
buflen = maxRecvPacket();
if (buflen < 4096)
buflen = 4096;
if (m_socket.setOption(SOL_SOCKET,SO_RCVBUF,&buflen,sizeof(buflen))) {
buflen = 0;
socklen_t sz = sizeof(buflen);
if (m_socket.getOption(SOL_SOCKET,SO_RCVBUF,&buflen,&sz))
Debug(this,DebugAll,"UDP buffer size is %d (requested %d)",buflen,reqlen);
else
Debug(this,DebugWarn,"Could not get UDP buffer size (requested %d)",reqlen);
}
else
Debug(this,DebugWarn,"Could not set UDP buffer size %d (%d: %s)",
buflen,m_socket.error(),::strerror(m_socket.error()));
#else
Debug(this,DebugMild,"Can't set socket receive buffer: unsupported feature");
#endif
}
if (!m_socket.bind(m_address)) {
Debug(this,DebugWarn,"Failed to bind socket to %s:%d. Error: %d: %s",
m_address.host().safe(),m_address.port(),
m_socket.error(),::strerror(m_socket.error()));
m_socket.terminate();
}
else
m_socket.getSockName(m_address);
m_socket.setBlocking(false);
}
// Create private threads
if (!m_initialized) {
Thread::Priority prio = Thread::priority(params.getValue("thread_priority"));
int c = params.getIntValue("private_receive_threads",1);
for (int i = 0; i < c; i++)
(new MGCPPrivateThread(this,false,prio))->startup();
c = params.getIntValue("private_process_threads",1);
for (int i = 0; i < c; i++)
(new MGCPPrivateThread(this,true,prio))->startup();
}
if (debugAt(DebugAll)) {
String tmp;
tmp << "\r\ntype: " << (gateway() ? "Gateway" : "Call Agent");
tmp << "\r\nbind address: " << m_address.host() << ":" << m_address.port();
tmp << "\r\nallow_unknown_cmd: " << String::boolText(m_allowUnkCmd);
tmp << "\r\nretrans_interval: " << m_retransInterval;
tmp << "\r\nretrans_count: " << m_retransCount;
tmp << "\r\nlower_case_params: " << m_parseParamToLower;
tmp << "\r\nmax_recv_packet: " << maxRecvPacket();
tmp << "\r\nsend_provisional: " << provisional();
Debug(this,DebugInfo,"%s:%s",m_initialized?"Reloaded":"Initialized",tmp.c_str());
}
m_initialized = true;
}
// Add a command to the list of known commands
void MGCPEngine::addCommand(const char* cmd)
{
String* tmp = new String(cmd);
Lock lock(this);
tmp->toUpper();
if (tmp->length() == 4 && !knownCommand(*tmp)) {
Debug(this,DebugInfo,"Adding extra command %s",tmp->c_str());
m_knownCommands.append(tmp);
}
else
TelEngine::destruct(tmp);
}
// Append an endpoint to this engine if not already done
void MGCPEngine::attach(MGCPEndpoint* ep)
{
if (!ep)
return;
Lock lock(this);
if (!m_endpoints.find(ep)) {
m_endpoints.append(ep);
Debug(this,DebugInfo,"Attached endpoint '%s'",ep->id().c_str());
}
}
// Remove an endpoint from this engine and, optionally, remove all its transactions
void MGCPEngine::detach(MGCPEndpoint* ep, bool del, bool delTrans)
{
if (!ep)
return;
if (del)
delTrans = true;
Debug(this,DebugInfo,"Detaching endpoint '%s'",ep->id().c_str());
Lock lock(this);
// Remove transactions
if (delTrans) {
ListIterator iter(m_transactions);
for (GenObject* o; 0 != (o = iter.get());) {
MGCPTransaction* tr = static_cast<MGCPTransaction*>(o);
if (ep->id() == tr->ep())
m_transactions.remove(tr,true);
}
}
m_endpoints.remove(ep,del);
}
// Find an endpoint by its pointer
MGCPEndpoint* MGCPEngine::findEp(MGCPEndpoint* ep)
{
Lock lock(this);
ObjList* o = m_endpoints.find(ep);
return o ? static_cast<MGCPEndpoint*>(o->get()) : 0;
}
// Find an endpoint by its id
MGCPEndpoint* MGCPEngine::findEp(const char* epId)
{
Lock lock(this);
ObjList* o = m_endpoints.find(epId);
return o ? static_cast<MGCPEndpoint*>(o->get()) : 0;
}
// find a transaction
MGCPTransaction* MGCPEngine::findTrans(unsigned int id, bool outgoing)
{
Lock lock(this);
for (ObjList* o = m_transactions.skipNull(); o; o = o->skipNext()) {
MGCPTransaction* tr = static_cast<MGCPTransaction*>(o->get());
if (outgoing == tr->outgoing() && id == tr->id())
return tr;
}
return 0;
}
// Generate a new id for an outgoing transaction
unsigned int MGCPEngine::getNextId()
{
Lock lock(this);
if (m_nextId < MAX_TRANS_ID)
return m_nextId++;
m_nextId = 1;
return MAX_TRANS_ID;
}
// Send a command message. Create a transaction for it.
// Fail if the message is not a valid one or isn't a valid command
MGCPTransaction* MGCPEngine::sendCommand(MGCPMessage* cmd, const SocketAddr& addr)
{
if (!cmd)
return 0;
if (!(cmd->valid() && cmd->isCommand())) {
Debug(this,DebugNote,"Can't initiate outgoing transaction for (%p) cmd=%s",
cmd,cmd->name().c_str());
TelEngine::destruct(cmd);
return 0;
}
Lock lock(this);
return new MGCPTransaction(this,cmd,true,addr);
}
// Read data from the socket. Parse and process the received message
bool MGCPEngine::receive(unsigned char* buffer, SocketAddr& addr)
{
if (!m_socket.valid())
return false;
int len = maxRecvPacket();
int rd = m_socket.recvFrom(buffer,len,addr);
if (rd == Socket::socketError()) {
if (!m_socket.canRetry())
Debug(this,DebugWarn,"Socket read error: %d: %s",
m_socket.error(),::strerror(m_socket.error()));
return false;
}
if (rd > 0)
len = rd;
else
return false;
ObjList msgs;
if (!MGCPMessage::parse(this,msgs,buffer,len)) {
ObjList* o = msgs.skipNull();
MGCPMessage* msg = static_cast<MGCPMessage*>(o?o->get():0);
if (msg && msg->valid() && !msg->isCommand()) {
String tmp;
msg->toString(tmp);
sendData(tmp,addr);
}
return false;
}
if (!msgs.skipNull())
return false;
Lock lock(this);
if (debugAt(DebugInfo)) {
String tmp((const char*)buffer,len);
Debug(this,DebugInfo,
"Received %u message(s) from %s:%d\r\n-----\r\n%s\r\n-----",
msgs.count(),addr.host().c_str(),addr.port(),tmp.c_str());
}
// Process received message(s)
while (true) {
MGCPMessage* msg = static_cast<MGCPMessage*>(msgs.remove(false));
if (!msg)
break;
// Command messages may contain ACK'd incoming transaction's responses
// See RFC 3435: 3.2.2.19 and 3.5.1
if (msg->isCommand()) {
String s = msg->params.getValue("k");
if (!(s || m_parseParamToLower))
s = msg->params.getValue("K");
if (s) {
unsigned int len = 0;
unsigned int* trList = decodeAck(s,len);
// Build an ACK message for each of ACK'd transaction response
if (trList) {
for (unsigned int i = 0; i < len; i++) {
MGCPTransaction* tr