[Freeswitch-branches] [commit] r4924 - in freeswitch/branches/mikej/sofiasip-upgrade: . build/config libs/apr-util libs/apr/include/arch/unix libs/curl libs/curl/docs libs/curl/lib libs/curl/src libs/curl/tests libs/js/nsprpub/pr/src libs/js/nsprpub/pr/src/io libs/js/nsprpub/pr/src/malloc libs/js/nsprpub/pr/src/md/unix libs/js/nsprpub/pr/src/memory libs/js/nsprpub/pr/src/misc libs/js/nsprpub/pr/src/pthreads libs/js/nsprpub/pr/src/threads libs/udns libs/win32/js libs/xmlrpc-c/src scripts/socket/FreeSWITCH scripts/socket/socket2me src src/include src/mod src/mod/applications/mod_enum src/mod/endpoints/mod_sofia src/mod/endpoints/mod_wanpipe src/mod/endpoints/mod_wanpipe/libsangoma src/mod/event_handlers/mod_cdr src/mod/languages/mod_spidermonkey_core_db

Freeswitch SVN mikej at freeswitch.org
Fri Apr 13 10:44:28 EDT 2007


Author: mikej
Date: Fri Apr 13 10:44:28 2007
New Revision: 4924

Added:
   freeswitch/branches/mikej/sofiasip-upgrade/build/config/libcurl.m4
      - copied unchanged from r4923, /freeswitch/trunk/build/config/libcurl.m4
   freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/socket2me/
      - copied from r4923, /freeswitch/trunk/scripts/socket/socket2me/
   freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/socket2me/Makefile
      - copied unchanged from r4923, /freeswitch/trunk/scripts/socket/socket2me/Makefile
   freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/socket2me/README
      - copied unchanged from r4923, /freeswitch/trunk/scripts/socket/socket2me/README
   freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/socket2me/socket2me.c
      - copied unchanged from r4923, /freeswitch/trunk/scripts/socket/socket2me/socket2me.c
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/lib_api.c
      - copied unchanged from r4923, /freeswitch/trunk/src/mod/endpoints/mod_wanpipe/lib_api.c
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/testapp.c
      - copied unchanged from r4923, /freeswitch/trunk/src/mod/endpoints/mod_wanpipe/testapp.c
Removed:
   freeswitch/branches/mikej/sofiasip-upgrade/libs/apr/include/arch/unix/apr_private.h.in
   freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/docs/
   freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/tests/
Modified:
   freeswitch/branches/mikej/sofiasip-upgrade/acinclude.m4
   freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build-outputs.mk
   freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build.conf
   freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/configure.in
   freeswitch/branches/mikej/sofiasip-upgrade/libs/apr/include/arch/unix/   (props changed)
   freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/   (props changed)
   freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/Makefile.am
   freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/configure.ac
   freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/lib/config.h.in
   freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.am
   freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.inc
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/Makefile.in
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/Makefile.in
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prfdcach.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/pripv6.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prlog.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/Makefile.in
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/prmem.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/Makefile.in
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/objs.mk
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/memory/Makefile.in
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/Makefile.in
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/prinit.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/Makefile.in
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptio.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptthread.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/Makefile.in
   freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/prcthr.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/udns/udns_resolver.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/win32/js/js.vcproj
   freeswitch/branches/mikej/sofiasip-upgrade/libs/xmlrpc-c/src/Makefile
   freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/FreeSWITCH/Client.pm
   freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_core_db.h
   freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_ivr.h
   freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_types.h
   freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_utils.h
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/Makefile.am
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_enum/Makefile
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.h
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_glue.c
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/Makefile
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.c
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.h
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/basecdr.cpp
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/cdrcontainer.cpp
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/csvcdr.cpp
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/curlcdr.cpp
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/mod_cdr.cpp
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/odbccdr.cpp
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/pddcdr.cpp
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/sqlitecdr.cpp
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/xmlcdr.cpp
   freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
   freeswitch/branches/mikej/sofiasip-upgrade/src/switch_core_db.c
   freeswitch/branches/mikej/sofiasip-upgrade/src/switch_core_session.c
   freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr.c

Log:
merged changes from trunk revisions 4899-4923.

Modified: freeswitch/branches/mikej/sofiasip-upgrade/acinclude.m4
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/acinclude.m4	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/acinclude.m4	Fri Apr 13 10:44:28 2007
@@ -6,4 +6,4 @@
 m4_include([build/config/ac_gcc_x86_cpuid.m4])
 m4_include([build/config/ax_lib_mysql.m4])
 m4_include([libs/apr/build/apr_common.m4])
-m4_include([libs/curl/docs/libcurl/libcurl.m4])
+m4_include([build/config/libcurl.m4])

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build-outputs.mk
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build-outputs.mk	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build-outputs.mk	Fri Apr 13 10:44:28 2007
@@ -38,7 +38,6 @@
 misc/apu_version.lo: misc/apu_version.c .make.dirs include/apu_version.h
 misc/apr_queue.lo: misc/apr_queue.c .make.dirs include/apr_queue.h
 uri/apr_uri.lo: uri/apr_uri.c .make.dirs include/apr_uri.h
-xml/apr_xml.lo: xml/apr_xml.c .make.dirs include/apr_xml.h include/apr_xlate.h
 strmatch/apr_strmatch.lo: strmatch/apr_strmatch.c .make.dirs include/apr_strmatch.h
 xlate/xlate.lo: xlate/xlate.c .make.dirs include/apr_xlate.h
 dbd/apr_dbd_sqlite2.lo: dbd/apr_dbd_sqlite2.c .make.dirs 
@@ -46,7 +45,7 @@
 dbd/apr_dbd.lo: dbd/apr_dbd.c .make.dirs include/apr_dbd.h
 dbd/apr_dbd_sqlite3.lo: dbd/apr_dbd_sqlite3.c .make.dirs 
 
-OBJECTS_all = buckets/apr_buckets_file.lo buckets/apr_brigade.lo buckets/apr_buckets_mmap.lo buckets/apr_buckets_heap.lo buckets/apr_buckets.lo buckets/apr_buckets_socket.lo buckets/apr_buckets_pool.lo buckets/apr_buckets_alloc.lo buckets/apr_buckets_pipe.lo buckets/apr_buckets_eos.lo buckets/apr_buckets_flush.lo buckets/apr_buckets_refcount.lo buckets/apr_buckets_simple.lo crypto/apr_md5.lo crypto/uuid.lo crypto/apr_sha1.lo crypto/getuuid.lo crypto/apr_md4.lo dbm/apr_dbm_berkeleydb.lo dbm/apr_dbm_gdbm.lo dbm/apr_dbm_ndbm.lo dbm/apr_dbm.lo dbm/apr_dbm_sdbm.lo dbm/sdbm/sdbm_hash.lo dbm/sdbm/sdbm.lo dbm/sdbm/sdbm_lock.lo dbm/sdbm/sdbm_pair.lo encoding/apr_base64.lo hooks/apr_hooks.lo ldap/apr_ldap_option.lo ldap/apr_ldap_init.lo ldap/apr_ldap_url.lo misc/apr_reslist.lo misc/apr_rmm.lo misc/apr_date.lo misc/apu_version.lo misc/apr_queue.lo uri/apr_uri.lo xml/apr_xml.lo strmatch/apr_strmatch.lo xlate/xlate.lo dbd/apr_dbd_sqlite2.lo dbd/apr_dbd_pgsql.lo dbd/apr_dbd.lo dbd/apr_dbd_sqlite3.lo
+OBJECTS_all = buckets/apr_buckets_file.lo buckets/apr_brigade.lo buckets/apr_buckets_mmap.lo buckets/apr_buckets_heap.lo buckets/apr_buckets.lo buckets/apr_buckets_socket.lo buckets/apr_buckets_pool.lo buckets/apr_buckets_alloc.lo buckets/apr_buckets_pipe.lo buckets/apr_buckets_eos.lo buckets/apr_buckets_flush.lo buckets/apr_buckets_refcount.lo buckets/apr_buckets_simple.lo crypto/apr_md5.lo crypto/uuid.lo crypto/apr_sha1.lo crypto/getuuid.lo crypto/apr_md4.lo dbm/apr_dbm_berkeleydb.lo dbm/apr_dbm_gdbm.lo dbm/apr_dbm_ndbm.lo dbm/apr_dbm.lo dbm/apr_dbm_sdbm.lo dbm/sdbm/sdbm_hash.lo dbm/sdbm/sdbm.lo dbm/sdbm/sdbm_lock.lo dbm/sdbm/sdbm_pair.lo encoding/apr_base64.lo hooks/apr_hooks.lo ldap/apr_ldap_option.lo ldap/apr_ldap_init.lo ldap/apr_ldap_url.lo misc/apr_reslist.lo misc/apr_rmm.lo misc/apr_date.lo misc/apu_version.lo misc/apr_queue.lo uri/apr_uri.lo strmatch/apr_strmatch.lo xlate/xlate.lo dbd/apr_dbd_sqlite2.lo dbd/apr_dbd_pgsql.lo dbd/apr_dbd.lo dbd/apr_dbd_sqlite3.lo
 
 OBJECTS_unix = $(OBJECTS_all)
 
@@ -58,11 +57,11 @@
 
 OBJECTS_os390 = $(OBJECTS_all)
 
-HEADERS = $(top_srcdir)/include/apr_optional.h $(top_srcdir)/include/apu_version.h $(top_srcdir)/include/apr_dbm.h $(top_srcdir)/include/apr_strmatch.h $(top_srcdir)/include/apr_buckets.h $(top_srcdir)/include/apr_optional_hooks.h $(top_srcdir)/include/apr_sdbm.h $(top_srcdir)/include/apr_md4.h $(top_srcdir)/include/apr_reslist.h $(top_srcdir)/include/apr_base64.h $(top_srcdir)/include/apr_ldap_option.h $(top_srcdir)/include/apr_xml.h $(top_srcdir)/include/apr_anylock.h $(top_srcdir)/include/apr_rmm.h $(top_srcdir)/include/apr_ldap_init.h $(top_srcdir)/include/apr_ldap_url.h $(top_srcdir)/include/apr_md5.h $(top_srcdir)/include/apr_date.h $(top_srcdir)/include/apr_hooks.h $(top_srcdir)/include/apr_xlate.h $(top_srcdir)/include/apr_queue.h $(top_srcdir)/include/apr_uri.h $(top_srcdir)/include/apr_uuid.h $(top_srcdir)/include/apr_sha1.h $(top_srcdir)/include/apr_dbd.h
+HEADERS = $(top_srcdir)/include/apr_optional.h $(top_srcdir)/include/apu_version.h $(top_srcdir)/include/apr_dbm.h $(top_srcdir)/include/apr_strmatch.h $(top_srcdir)/include/apr_buckets.h $(top_srcdir)/include/apr_optional_hooks.h $(top_srcdir)/include/apr_sdbm.h $(top_srcdir)/include/apr_md4.h $(top_srcdir)/include/apr_reslist.h $(top_srcdir)/include/apr_base64.h $(top_srcdir)/include/apr_ldap_option.h $(top_srcdir)/include/apr_anylock.h $(top_srcdir)/include/apr_rmm.h $(top_srcdir)/include/apr_ldap_init.h $(top_srcdir)/include/apr_ldap_url.h $(top_srcdir)/include/apr_md5.h $(top_srcdir)/include/apr_date.h $(top_srcdir)/include/apr_hooks.h $(top_srcdir)/include/apr_xlate.h $(top_srcdir)/include/apr_queue.h $(top_srcdir)/include/apr_uri.h $(top_srcdir)/include/apr_uuid.h $(top_srcdir)/include/apr_sha1.h $(top_srcdir)/include/apr_dbd.h
 
-SOURCE_DIRS = xml dbd dbm encoding hooks buckets misc crypto uri strmatch dbm/sdbm ldap xlate $(EXTRA_SOURCE_DIRS)
+SOURCE_DIRS = dbd dbm encoding hooks buckets misc crypto uri strmatch dbm/sdbm ldap xlate $(EXTRA_SOURCE_DIRS)
 
-BUILD_DIRS = buckets crypto dbd dbm dbm/sdbm encoding hooks ldap misc strmatch uri xlate xml
+BUILD_DIRS = buckets crypto dbd dbm dbm/sdbm encoding hooks ldap misc strmatch uri xlate
 
 .make.dirs: $(srcdir)/build-outputs.mk
 	@for d in $(BUILD_DIRS); do test -d $$d || mkdir $$d; done

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build.conf
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build.conf	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build.conf	Fri Apr 13 10:44:28 2007
@@ -15,10 +15,10 @@
   ldap/*.c
   misc/*.c
   uri/apr_uri.c
-  xml/*.c
   strmatch/*.c
   xlate/*.c
   dbd/*.c
+#  xml/*.c
 
 # we have no platform-specific subdirs
 platform_dirs =

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/configure.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/configure.in	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/configure.in	Fri Apr 13 10:44:28 2007
@@ -122,7 +122,7 @@
 APU_CHECK_DBD_MYSQL
 APU_CHECK_DBD_SQLITE3
 APU_CHECK_DBD_SQLITE2
-APU_FIND_EXPAT
+#APU_FIND_EXPAT
 APU_FIND_ICONV
 
 AC_SEARCH_LIBS(crypt, crypt ufc)

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/Makefile.am
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/Makefile.am	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/Makefile.am	Fri Apr 13 10:44:28 2007
@@ -29,13 +29,12 @@
 bin_SCRIPTS = curl-config
 
 SUBDIRS = lib src
-DIST_SUBDIRS = $(SUBDIRS) tests include packages docs
+DIST_SUBDIRS = $(SUBDIRS) include packages
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libcurl.pc
 
 dist-hook:
-	rm -rf $(top_builddir)/tests/log
 	find $(distdir) -name "*.dist" -exec rm {} \;
 	(distit=`find $(srcdir) -name "*.dist"`; \
 	for file in $$distit; do \
@@ -43,88 +42,11 @@
 	  cp $$file $(distdir)$$strip; \
 	done)
 
-html:
-	cd docs; make html
-
-pdf:
-	cd docs; make pdf
-
-check: test
-
-if CROSSCOMPILING
-test-full: test
-test-torture: test
-
-test:
-	@echo "NOTICE: we can't run the tests when cross-compiling!"
-
-else
-
-test:
-	@(cd tests; $(MAKE) all quiet-test)
-
-test-full:
-	@(cd tests; $(MAKE) all full-test)
-
-test-torture:
-	@(cd tests; $(MAKE) all torture-test)
-
-endif
-
-#
-# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros
-# must contain the following line:
-# %_topdir /home/loic/local/rpm
-# and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc.
-#
-# cd /home/loic/local/rpm ; mkdir -p SOURCES BUILD RPMS/i386 SPECS SRPMS
-#
-# If additional configure flags are needed to build the package, add the
-# following in ~/.rpmmacros
-# %configure CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} ${AM_CONFIGFLAGS}
-# and run make rpm in the following way:
-# AM_CONFIGFLAGS='--with-uri=/home/users/loic/local/RedHat-6.2' make rpm
-#
-
-rpms:
-	$(MAKE) RPMDIST=curl rpm
-	$(MAKE) RPMDIST=curl-ssl rpm
-
-rpm:
-	RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \
-	cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \
-	cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \
-	rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \
-	mv $$RPM_TOPDIR/RPMS/i386/$(RPMDIST)-*.rpm . ; \
-	mv $$RPM_TOPDIR/SRPMS/$(RPMDIST)-*.src.rpm .
-
-#
-# Build a Solaris pkkgadd format file
-# run 'make pkgadd' once you've done './configure' and 'make' to make a Solaris pkgadd format
-# file (which ends up back in this directory).
-# The pkgadd file is in 'pkgtrans' format, so to install on Solaris, do
-# pkgadd -d ./HAXXcurl-*
-#
-
-# gak - libtool requires an absoulte directory, hence the pwd below...
-pkgadd:
-	umask 022 ; \
-	make install DESTDIR=`/bin/pwd`/packages/Solaris/root ; \
-	cat COPYING > $(srcdir)/packages/Solaris/copyright ; \
-	cd $(srcdir)/packages/Solaris && $(MAKE) package
-
-#
-# Build a cygwin binary tarball installation file
-# resulting .tar.bz2 file will end up at packages/Win32/cygwin
-cygwinbin:
-	$(MAKE) -C packages/Win32/cygwin cygwinbin
-
 # We extend the standard install with a custom hook:
 install-data-hook:
 	cd include && $(MAKE) install
-	cd docs && $(MAKE) install
 
 # We extend the standard uninstall with a custom hook:
 uninstall-hook:
 	cd include && $(MAKE) uninstall
-	cd docs && $(MAKE) uninstall
+

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/configure.ac
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/configure.ac	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/configure.ac	Fri Apr 13 10:44:28 2007
@@ -34,7 +34,7 @@
 
 AC_CONFIG_SRCDIR([lib/urldata.h])
 AM_CONFIG_HEADER(lib/config.h src/config.h)
-AM_MAINTAINER_MODE
+#AM_MAINTAINER_MODE
 
 dnl SED is needed by some of the tools
 AC_PATH_PROG( SED, sed, sed-was-not-found-by-configure,
@@ -2038,17 +2038,10 @@
 AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
 
 AC_CONFIG_FILES([Makefile \
-	   docs/Makefile \
-           docs/examples/Makefile \
-           docs/libcurl/Makefile \
 	   include/Makefile \
 	   include/curl/Makefile \
 	   src/Makefile \
            lib/Makefile \
-           tests/Makefile \
-           tests/data/Makefile \
-           tests/server/Makefile \
-           tests/libtest/Makefile \
 	   packages/Makefile \
 	   packages/Win32/Makefile \
 	   packages/Win32/cygwin/Makefile \

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/lib/config.h.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/lib/config.h.in	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/lib/config.h.in	Fri Apr 13 10:44:28 2007
@@ -621,16 +621,16 @@
 /* Define to the function return type for send. */
 #undef SEND_TYPE_RETV
 
-/* The size of `curl_off_t', as computed by sizeof. */
+/* The size of a `curl_off_t', as computed by sizeof. */
 #undef SIZEOF_CURL_OFF_T
 
-/* The size of `long', as computed by sizeof. */
+/* The size of a `long', as computed by sizeof. */
 #undef SIZEOF_LONG
 
-/* The size of `size_t', as computed by sizeof. */
+/* The size of a `size_t', as computed by sizeof. */
 #undef SIZEOF_SIZE_T
 
-/* The size of `time_t', as computed by sizeof. */
+/* The size of a `time_t', as computed by sizeof. */
 #undef SIZEOF_TIME_T
 
 /* Define to 1 if you have the ANSI C header files. */
@@ -685,7 +685,7 @@
 /* type to use in place of in_addr_t if not defined */
 #undef in_addr_t
 
-/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* Define to `unsigned' if <sys/types.h> does not define. */
 #undef size_t
 
 /* type to use in place of socklen_t if not defined */

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.am
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.am	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.am	Fri Apr 13 10:44:28 2007
@@ -33,50 +33,11 @@
            -I$(top_srcdir)/lib     \
            -I$(top_srcdir)/src
 
-bin_PROGRAMS = curl
-
 include Makefile.inc
 
-curl_LDADD = ../lib/libcurl.la
-curl_DEPENDENCIES = ../lib/libcurl.la
-BUILT_SOURCES = hugehelp.c
-CLEANFILES = hugehelp.c
-NROFF=@NROFF@ @MANOPT@ # figured out by the configure script
-
 EXTRA_DIST = mkhelp.pl makefile.dj Makefile.vc6 Makefile.b32 Makefile.m32 \
 	Makefile.riscos config.h.in macos/curl.mcp.xml.sit.hqx		  \
 	macos/MACINSTALL.TXT macos/src/curl_GUSIConfig.cpp		  \
 	macos/src/macos_main.cpp config-amigaos.h makefile.amiga curl.rc  \
 	Makefile.netware Makefile.inc Makefile.Watcom
 
-MANPAGE=$(top_srcdir)/docs/curl.1
-README=$(top_srcdir)/docs/MANUAL
-MKHELP=$(top_srcdir)/src/mkhelp.pl
-HUGE=hugehelp.c
-
-if USE_MANUAL
-# Here are the stuff to create a built-in manual
-
-if HAVE_LIBZ
-# This generates the hugehelp.c file in both uncompressed and compressed formats
-$(HUGE): $(README) $(MANPAGE)  mkhelp.pl
-	echo '#include "setup.h"' > $(HUGE)
-	echo '#ifndef HAVE_LIBZ' >> $(HUGE)
-	$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE)
-	echo '#else' >> $(HUGE)
-	$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) -c $(README) >> $(HUGE)
-	echo '#endif /* HAVE_LIBZ */' >> $(HUGE)
-else # HAVE_LIBZ
-# This generates the hugehelp.c file uncompressed only
-$(HUGE): $(README) $(MANPAGE)  mkhelp.pl
-	echo '#include "setup.h"' > $(HUGE)
-	$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE)
-endif
-
-else # USE_MANUAL
-# built-in manual has been disabled, make a blank file
-$(HUGE):
-	echo "/* built-in manual is disabled, blank function */" > $(HUGE)
-	echo '#include "hugehelp.h"' >> $(HUGE)
-	echo "void hugehelp(void) {}" >>$(HUGE)
-endif

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.inc
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.inc	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.inc	Fri Apr 13 10:44:28 2007
@@ -5,13 +5,13 @@
 CURLX_ONES =  $(top_srcdir)/lib/strtoofft.c $(top_srcdir)/lib/timeval.c \
 	$(top_srcdir)/lib/strdup.c 
 
-CURL_SOURCES = main.c hugehelp.c urlglob.c writeout.c writeenv.c \
-	getpass.c homedir.c
+#CURL_SOURCES = main.c hugehelp.c urlglob.c writeout.c writeenv.c \
+#	getpass.c homedir.c
 
 CURL_HFILES = hugehelp.h setup.h config-win32.h config-mac.h \
 	config-riscos.h urlglob.h version.h \
 	writeout.h writeenv.h getpass.h homedir.h
 
-curl_SOURCES = $(CURL_SOURCES) $(CURLX_ONES) $(CURL_HFILES)
+#curl_SOURCES = $(CURL_SOURCES) $(CURLX_ONES) $(CURL_HFILES)
 
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/Makefile.in	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/Makefile.in	Fri Apr 13 10:44:28 2007
@@ -46,7 +46,7 @@
 
 include $(topsrcdir)/config/config.mk
 
-DIRS = io linking malloc md memory misc threads
+DIRS = io malloc md memory misc threads
 
 # For VAC++ 4 geticcdata rule in config/OS2.mk
 ifeq ($(MOZ_OS2_TOOLS),VACPP)
@@ -62,7 +62,7 @@
 endif
 
 ifeq ($(USE_CPLUS), 1)
-	DIRS += cplus
+#	DIRS += cplus
 endif
 
 #
@@ -222,50 +222,29 @@
     $(OBJDIR)/prvrsion.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prfdcach.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prmwait.$(OBJ_SUFFIX) \
-    io/$(OBJDIR)/prmapopt.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/priometh.$(OBJ_SUFFIX) \
-    io/$(OBJDIR)/pripv6.$(OBJ_SUFFIX) \
+    io/$(OBJDIR)/prmapopt.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prlayer.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prlog.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prmmap.$(OBJ_SUFFIX) \
-    io/$(OBJDIR)/prpolevt.$(OBJ_SUFFIX) \
+    io/$(OBJDIR)/pripv6.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prprf.$(OBJ_SUFFIX) \
-    io/$(OBJDIR)/prscanf.$(OBJ_SUFFIX) \
-    io/$(OBJDIR)/prstdio.$(OBJ_SUFFIX) \
-    threads/$(OBJDIR)/prcmon.$(OBJ_SUFFIX) \
-	threads/$(OBJDIR)/prrwlock.$(OBJ_SUFFIX) \
 	threads/$(OBJDIR)/prtpd.$(OBJ_SUFFIX) \
-    linking/$(OBJDIR)/prlink.$(OBJ_SUFFIX) \
     malloc/$(OBJDIR)/prmem.$(OBJ_SUFFIX) \
     md/$(OBJDIR)/prosdep.$(OBJ_SUFFIX) \
-    memory/$(OBJDIR)/prshm.$(OBJ_SUFFIX) \
-    memory/$(OBJDIR)/prshma.$(OBJ_SUFFIX) \
     memory/$(OBJDIR)/prseg.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/pralarm.$(OBJ_SUFFIX) \
+    misc/$(OBJDIR)/prnetdb.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/pratom.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/prcountr.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/prdtoa.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/prenv.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/prerr.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prerror.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/prerrortable.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prinit.$(OBJ_SUFFIX) \
+   misc/$(OBJDIR)/pripc.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prinrval.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/pripc.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/prlog2.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/prlong.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/prnetdb.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prolock.$(OBJ_SUFFIX)	 \
-    misc/$(OBJDIR)/prrng.$(OBJ_SUFFIX)	 \
-    misc/$(OBJDIR)/prsystem.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/prthinfo.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/prtpool.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/prtrace.$(OBJ_SUFFIX) \
     misc/$(OBJDIR)/prtime.$(OBJ_SUFFIX)
 
 # ilib now rejects empty objects
 ifneq ($(MOZ_OS2_TOOLS),VACPP)
-OBJS += malloc/$(OBJDIR)/prmalloc.$(OBJ_SUFFIX)
+#OBJS += malloc/$(OBJDIR)/prmalloc.$(OBJ_SUFFIX)
 endif
 
 ifdef USE_PTHREADS
@@ -278,16 +257,12 @@
 OBJS += \
     io/$(OBJDIR)/prdir.$(OBJ_SUFFIX) \
     io/$(OBJDIR)/prfile.$(OBJ_SUFFIX) \
-    io/$(OBJDIR)/prio.$(OBJ_SUFFIX) \
-    io/$(OBJDIR)/prsocket.$(OBJ_SUFFIX) \
-    misc/$(OBJDIR)/pripcsem.$(OBJ_SUFFIX)
+    io/$(OBJDIR)/prio.$(OBJ_SUFFIX) 
+
 
 ifndef USE_BTHREADS
 OBJS += \
 	threads/$(OBJDIR)/prcthr.$(OBJ_SUFFIX) \
-	threads/$(OBJDIR)/prdump.$(OBJ_SUFFIX) \
-	threads/$(OBJDIR)/prmon.$(OBJ_SUFFIX) \
-	threads/$(OBJDIR)/prsem.$(OBJ_SUFFIX) \
 	threads/combined/$(OBJDIR)/prucpu.$(OBJ_SUFFIX) \
 	threads/combined/$(OBJDIR)/prucv.$(OBJ_SUFFIX) \
 	threads/combined/$(OBJDIR)/prulock.$(OBJ_SUFFIX) \

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/Makefile.in	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/Makefile.in	Fri Apr 13 10:44:28 2007
@@ -58,14 +58,11 @@
     prmwait.c \
     priometh.c \
     pripv6.c \
-	prmapopt.c \
+    prmapopt.c \
     prlayer.c \
     prlog.c \
 	prmmap.c \
-    prpolevt.c \
 	prprf.c \
-	prscanf.c \
-	prstdio.c  \
 	$(NULL)
 
 ifndef USE_PTHREADS
@@ -73,7 +70,6 @@
 	    prdir.c \
 	    prfile.c \
 	    prio.c \
-	    prsocket.c \
 	    $(NULL)
 endif
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prfdcach.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prfdcach.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prfdcach.c	Fri Apr 13 10:44:28 2007
@@ -259,8 +259,8 @@
     ** be overridden at runtime using environment variables
     ** or a super-wiz-bang API.
     */
-    const char *low = PR_GetEnv("NSPR_FD_CACHE_SIZE_LOW");
-    const char *high = PR_GetEnv("NSPR_FD_CACHE_SIZE_HIGH");
+    //const char *low = PR_GetEnv("NSPR_FD_CACHE_SIZE_LOW");
+    //const char *high = PR_GetEnv("NSPR_FD_CACHE_SIZE_HIGH");
 
     /* 
     ** _low is allowed to be zero, _high is not.
@@ -274,8 +274,8 @@
     _pr_fd_cache.limit_high = 0;
 #endif  /* defined(DEBUG) */
 
-    if (NULL != low) _pr_fd_cache.limit_low = atoi(low);
-    if (NULL != high) _pr_fd_cache.limit_high = atoi(high);
+    //if (NULL != low) _pr_fd_cache.limit_low = atoi(low);
+    //if (NULL != high) _pr_fd_cache.limit_high = atoi(high);
 
     if (_pr_fd_cache.limit_high < _pr_fd_cache.limit_low)
         _pr_fd_cache.limit_high = _pr_fd_cache.limit_low;

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/pripv6.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/pripv6.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/pripv6.c	Fri Apr 13 10:44:28 2007
@@ -279,7 +279,6 @@
 
 #if defined(_PR_INET6_PROBE)
 PRBool _pr_ipv6_is_present;
-extern PRBool _pr_test_ipv6_socket(void);
 
 #if !defined(_PR_INET6) && defined(_PR_HAVE_GETIPNODEBYNAME)
 extern PRStatus _pr_find_getipnodebyname(void);
@@ -292,17 +291,7 @@
 static PRBool
 _pr_probe_ipv6_presence(void)
 {
-#if !defined(_PR_INET6) && defined(_PR_HAVE_GETIPNODEBYNAME)
-    if (_pr_find_getipnodebyname() != PR_SUCCESS)
         return PR_FALSE;
-#endif
-
-#if !defined(_PR_INET6) && defined(_PR_HAVE_GETADDRINFO)
-    if (_pr_find_getaddrinfo() != PR_SUCCESS)
-        return PR_FALSE;
-#endif
-
-    return _pr_test_ipv6_socket();
 }
 #endif  /* _PR_INET6_PROBE */
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prlog.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prlog.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prlog.c	Fri Apr 13 10:44:28 2007
@@ -204,11 +204,11 @@
 
 void _PR_InitLog(void)
 {
-    char *ev;
+    char *ev = NULL;
 
     _pr_logLock = PR_NewLock();
 
-    ev = PR_GetEnv("NSPR_LOG_MODULES");
+//    ev = PR_GetEnv("NSPR_LOG_MODULES");
     if (ev && ev[0]) {
         char module[64];  /* Security-Critical: If you change this
                            * size, you must also change the sscanf
@@ -255,7 +255,7 @@
         }
         PR_SetLogBuffering(isSync ? bufSize : 0);
 
-        ev = PR_GetEnv("NSPR_LOG_FILE");
+        //ev = PR_GetEnv("NSPR_LOG_FILE");
         if (ev && ev[0]) {
             if (!PR_SetLogFile(ev)) {
 #ifdef XP_PC
@@ -316,9 +316,9 @@
 
 static void _PR_SetLogModuleLevel( PRLogModuleInfo *lm )
 {
-    char *ev;
+    char *ev = NULL;
 
-    ev = PR_GetEnv("NSPR_LOG_MODULES");
+    //ev = PR_GetEnv("NSPR_LOG_MODULES");
     if (ev && ev[0]) {
         char module[64];  /* Security-Critical: If you change this
                            * size, you must also change the sscanf

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/Makefile.in	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/Makefile.in	Fri Apr 13 10:44:28 2007
@@ -59,7 +59,7 @@
 
 DEFINES += -D_NSPR_BUILD_
 
-CSRCS = prmalloc.c prmem.c
+CSRCS =  prmem.c
 
 include $(topsrcdir)/config/rules.mk
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/prmem.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/prmem.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/prmem.c	Fri Apr 13 10:44:28 2007
@@ -210,25 +210,6 @@
     return;
 }
 
-PR_IMPLEMENT(void)
-PR_FPrintZoneStats(PRFileDesc *debug_out)
-{
-    int i, j;
-
-    for (j = 0; j < THREAD_POOLS; j++) {
-        for (i = 0; i < MEM_ZONES; i++) {
-            MemoryZone   *mz   = &zones[i][j];
-            MemoryZone    zone = *mz;
-            if (zone.elements || zone.misses || zone.hits) {
-                PR_fprintf(debug_out,
-"pool: %d, zone: %d, size: %d, free: %d, hit: %d, miss: %d, contend: %d\n",
-                    j, i, zone.blockSize, zone.elements,
-                    zone.hits, zone.misses, zone.contention);
-            }
-	}
-    }
-}
-
 static void *
 pr_ZoneMalloc(PRUint32 size)
 {

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/Makefile.in	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/Makefile.in	Fri Apr 13 10:44:28 2007
@@ -49,8 +49,6 @@
 	unix.c    \
 	unix_errors.c    \
 	uxproces.c \
-	uxrng.c \
-	uxshm.c \
 	uxwrap.c \
 	$(NULL)
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/objs.mk
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/objs.mk	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/objs.mk	Fri Apr 13 10:44:28 2007
@@ -42,8 +42,6 @@
 	unix.c    \
 	unix_errors.c \
 	uxproces.c \
-	uxrng.c \
-	uxshm.c \
 	uxwrap.c \
 	$(NULL)
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/memory/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/memory/Makefile.in	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/memory/Makefile.in	Fri Apr 13 10:44:28 2007
@@ -46,7 +46,7 @@
 
 include $(topsrcdir)/config/config.mk
 
-CSRCS = prseg.c prshm.c prshma.c
+CSRCS = prseg.c
 
 ifdef GC_LEAK_DETECTOR
 CSRCS += prgcleak.c

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/Makefile.in	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/Makefile.in	Fri Apr 13 10:44:28 2007
@@ -47,35 +47,16 @@
 include $(topsrcdir)/config/config.mk
 
 CSRCS = \
-	pralarm.c  \
 	pratom.c   \
-	prcountr.c \
-	prdtoa.c   \
-	prenv.c    \
-	prerr.c  \
 	prerror.c  \
-	prerrortable.c  \
+        pripc.c \
 	prinit.c   \
+	prnetdb.c   \
 	prinrval.c \
-	pripc.c \
-	prlog2.c   \
-	prlong.c   \
-	prnetdb.c  \
 	prolock.c  \
-	prrng.c    \
-	prsystem.c \
 	prtime.c   \
-	prthinfo.c \
-	prtpool.c \
-	prtrace.c  \
 	$(NULL)
 
-ifndef USE_PTHREADS
-CSRCS += \
-	pripcsem.c \
-	$(NULL)
-endif
-
 TARGETS	= $(OBJS)
 
 INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/prinit.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/prinit.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/prinit.c	Fri Apr 13 10:44:28 2007
@@ -202,7 +202,7 @@
     _PR_InitSegs();
     _PR_InitStacks();
 	_PR_InitTPD();
-    _PR_InitEnv();
+    //_PR_InitEnv();
     _PR_InitLayerCache();
     _PR_InitClock();
 
@@ -234,20 +234,20 @@
     _PR_InitMem();
 #endif
 
-    _PR_InitCMon();
+    //_PR_InitCMon();
     _PR_InitIO();
-    _PR_InitNet();
+    //_PR_InitNet();
     _PR_InitLog();
-    _PR_InitLinker();
+    //_PR_InitLinker();
     _PR_InitCallOnce();
-    _PR_InitDtoa();
+    //_PR_InitDtoa();
     _PR_InitMW();
-    _PR_InitRWLocks();
+    //_PR_InitRWLocks();
 
-    nspr_InitializePRErrorTable();
+    //nspr_InitializePRErrorTable();
 
 #if !defined(_PR_INET6) || defined(_PR_INET6_PROBE)
-	_pr_init_ipv6();
+	//_pr_init_ipv6();
 #endif
 	
     _PR_MD_FINAL_INIT();
@@ -420,9 +420,9 @@
 #endif
 
         _PR_CleanupMW();
-        _PR_CleanupDtoa();
+        //_PR_CleanupDtoa();
         _PR_CleanupCallOnce();
-		_PR_ShutdownLinker();
+		//_PR_ShutdownLinker();
         /* Release the primordial thread's private data, etc. */
         _PR_CleanupThread(me);
 
@@ -452,7 +452,7 @@
          * Ideally, for each _PR_InitXXX(), there should be a corresponding
          * _PR_XXXCleanup() that we can call here.
          */
-        _PR_CleanupNet();
+        //_PR_CleanupNet();
         _PR_CleanupIO();
 #ifdef WINNT
         _PR_CleanupCPUs();
@@ -461,7 +461,7 @@
         PR_DestroyLock(_pr_sleeplock);
         _pr_sleeplock = NULL;
         _PR_CleanupLayerCache();
-        _PR_CleanupEnv();
+        //_PR_CleanupEnv();
         _PR_CleanupStacks();
         _PR_CleanupBeforeExit();
         _pr_initialized = PR_FALSE;
@@ -543,25 +543,6 @@
     }
 }
 
-/*
- * OBSOLETE
- */
-PR_IMPLEMENT(void)
-PR_SetStdioRedirect(
-    PRProcessAttr *attr,
-    PRSpecialFD stdioFd,
-    PRFileDesc *redirectFd)
-{
-#if defined(DEBUG)
-    static PRBool warn = PR_TRUE;
-    if (warn) {
-        warn = _PR_Obsolete("PR_SetStdioRedirect()",
-                "PR_ProcessAttrSetStdioRedirect()");
-    }
-#endif
-    PR_ProcessAttrSetStdioRedirect(attr, stdioFd, redirectFd);
-}
-
 PR_IMPLEMENT(PRStatus)
 PR_ProcessAttrSetCurrentDirectory(
     PRProcessAttr *attr,
@@ -659,75 +640,6 @@
     return PR_SUCCESS;
 }
 
-PR_IMPLEMENT(PRFileDesc *) PR_GetInheritedFD(
-    const char *name)
-{
-    PRFileDesc *fd;
-    const char *envVar;
-    const char *ptr;
-    int len = strlen(name);
-    PROsfd osfd;
-    int nColons;
-    PRIntn fileType;
-
-    envVar = PR_GetEnv("NSPR_INHERIT_FDS");
-    if (NULL == envVar || '\0' == envVar[0]) {
-        PR_SetError(PR_UNKNOWN_ERROR, 0);
-        return NULL;
-    }
-
-    ptr = envVar;
-    while (1) {
-        if ((ptr[len] == ':') && (strncmp(ptr, name, len) == 0)) {
-            ptr += len + 1;
-            PR_sscanf(ptr, "%d:0x%" PR_SCNxOSFD, &fileType, &osfd);
-            switch ((PRDescType)fileType) {
-                case PR_DESC_FILE:
-                    fd = PR_ImportFile(osfd);
-                    break;
-                case PR_DESC_PIPE:
-                    fd = PR_ImportPipe(osfd);
-                    break;
-                case PR_DESC_SOCKET_TCP:
-                    fd = PR_ImportTCPSocket(osfd);
-                    break;
-                case PR_DESC_SOCKET_UDP:
-                    fd = PR_ImportUDPSocket(osfd);
-                    break;
-                default:
-                    PR_ASSERT(0);
-                    PR_SetError(PR_UNKNOWN_ERROR, 0);
-                    fd = NULL;
-                    break;
-            }
-            if (fd) {
-                /*
-                 * An inherited FD is inheritable by default.
-                 * The child process needs to call PR_SetFDInheritable
-                 * to make it non-inheritable if so desired.
-                 */
-                fd->secret->inheritable = _PR_TRI_TRUE;
-            }
-            return fd;
-        }
-        /* Skip three colons */
-        nColons = 0;
-        while (*ptr) {
-            if (*ptr == ':') {
-                if (++nColons == 3) {
-                    break;
-                }
-            }
-            ptr++;
-        }
-        if (*ptr == '\0') {
-            PR_SetError(PR_UNKNOWN_ERROR, 0);
-            return NULL;
-        }
-        ptr++;
-    }
-}
-
 PR_IMPLEMENT(PRProcess*) PR_CreateProcess(
     const char *path,
     char *const *argv,
@@ -850,19 +762,9 @@
     }
     return once->status;
 }
-
 PRBool _PR_Obsolete(const char *obsolete, const char *preferred)
 {
-#if defined(DEBUG)
-#ifndef XP_MAC
-    PR_fprintf(
-        PR_STDERR, "'%s' is obsolete. Use '%s' instead.\n",
-        obsolete, (NULL == preferred) ? "something else" : preferred);
-#else
-#pragma unused (obsolete, preferred)
-#endif
-#endif
-    return PR_FALSE;
+  return PR_FALSE;
 }  /* _PR_Obsolete */
 
 /* prinit.c */

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/Makefile.in	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/Makefile.in	Fri Apr 13 10:44:28 2007
@@ -55,8 +55,8 @@
 endif
 
 CSRCS = \
+        ptsynch.c \
 	ptio.c \
-	ptsynch.c \
 	ptthread.c \
 	ptmisc.c \
 	$(NULL)

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptio.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptio.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptio.c	Fri Apr 13 10:44:28 2007
@@ -374,46 +374,13 @@
 
 PTDebug pt_debug;  /* this is shared between several modules */
 
-PR_IMPLEMENT(void) PT_FPrintStats(PRFileDesc *debug_out, const char *msg)
-{
-    PTDebug stats;
-    char buffer[100];
-    PRExplodedTime tod;
-    PRInt64 elapsed, aMil;
-    stats = pt_debug;  /* a copy */
-    PR_ExplodeTime(stats.timeStarted, PR_LocalTimeParameters, &tod);
-    (void)PR_FormatTime(buffer, sizeof(buffer), "%T", &tod);
-
-    LL_SUB(elapsed, PR_Now(), stats.timeStarted);
-    LL_I2L(aMil, 1000000);
-    LL_DIV(elapsed, elapsed, aMil);
-    
-    if (NULL != msg) PR_fprintf(debug_out, "%s", msg);
-    PR_fprintf(
-        debug_out, "\tstarted: %s[%lld]\n", buffer, elapsed);
-    PR_fprintf(
-        debug_out, "\tlocks [created: %u, destroyed: %u]\n",
-        stats.locks_created, stats.locks_destroyed);
-    PR_fprintf(
-        debug_out, "\tlocks [acquired: %u, released: %u]\n",
-        stats.locks_acquired, stats.locks_released);
-    PR_fprintf(
-        debug_out, "\tcvars [created: %u, destroyed: %u]\n",
-        stats.cvars_created, stats.cvars_destroyed);
-    PR_fprintf(
-        debug_out, "\tcvars [notified: %u, delayed_delete: %u]\n",
-        stats.cvars_notified, stats.delayed_cv_deletes);
-}  /* PT_FPrintStats */
-
-#else
+#endif  /* DEBUG */
 
 PR_IMPLEMENT(void) PT_FPrintStats(PRFileDesc *debug_out, const char *msg)
 {
     /* do nothing */
 }  /* PT_FPrintStats */
 
-#endif  /* DEBUG */
-
 #if defined(_PR_POLL_WITH_SELECT)
 /*
  * OSF1 and HPUX report the POLLHUP event for a socket when the
@@ -3374,6 +3341,8 @@
     return fd;
 }  /* PR_AllocFileDesc */
 
+#if 0
+
 #if !defined(_PR_INET6) || defined(_PR_INET6_PROBE)
 PR_EXTERN(PRStatus) _pr_push_ipv6toipv4_layer(PRFileDesc *fd);
 #if defined(_PR_INET6_PROBE)
@@ -3484,7 +3453,7 @@
 #endif
     return fd;
 }  /* PR_Socket */
-
+#endif
 /*****************************************************************************/
 /****************************** I/O public methods ***************************/
 /*****************************************************************************/
@@ -4312,6 +4281,7 @@
     return &dir->d;
 }  /* PR_ReadDir */
 
+#if 0
 PR_IMPLEMENT(PRFileDesc*) PR_NewUDPSocket(void)
 {
     PRIntn domain = PF_INET;
@@ -4336,6 +4306,8 @@
     return PR_Socket(af, SOCK_STREAM, 0);
 }  /* PR_NewTCPSocket */
 
+#endif
+
 PR_IMPLEMENT(PRStatus) PR_NewTCPSocketPair(PRFileDesc *fds[2])
 {
     PRInt32 osfd[2];

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptthread.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptthread.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptthread.c	Fri Apr 13 10:44:28 2007
@@ -938,9 +938,9 @@
         PR_Unlock(pt_book.ml);
 
         _PR_CleanupMW();
-        _PR_CleanupDtoa();
+        //_PR_CleanupDtoa();
         _PR_CleanupCallOnce();
-        _PR_ShutdownLinker();
+        //_PR_ShutdownLinker();
         _PR_LogCleanup();
         _PR_CleanupNet();
         /* Close all the fd's before calling _PR_CleanupIO */
@@ -963,7 +963,7 @@
         PR_DestroyLock(_pr_sleeplock);
         _pr_sleeplock = NULL;
         _PR_CleanupLayerCache();
-        _PR_CleanupEnv();
+        //_PR_CleanupEnv();
 #ifdef _PR_ZONE_ALLOCATOR
         _PR_DestroyZones();
 #endif

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/Makefile.in	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/Makefile.in	Fri Apr 13 10:44:28 2007
@@ -58,24 +58,15 @@
 
 ifdef USE_PTHREADS
 CSRCS = \
-	prcmon.c \
-	prrwlock.c   \
 	prtpd.c \
 	$(NULL)
 else
 ifdef USE_BTHREADS
 CSRCS = \
-	prcmon.c \
-	prrwlock.c   \
 	prtpd.c \
 	$(NULL)
 else
 CSRCS =	\
-	prcmon.c  \
-	prdump.c  \
-	prmon.c   \
-	prsem.c   \
-	prrwlock.c   \
 	prcthr.c \
 	prtpd.c \
 	$(NULL)

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/prcthr.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/prcthr.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/prcthr.c	Fri Apr 13 10:44:28 2007
@@ -73,14 +73,6 @@
     thread->environment = NULL;
 }
 
-PR_IMPLEMENT(PRStatus) PR_Yield()
-{
-    static PRBool warning = PR_TRUE;
-    if (warning) warning = _PR_Obsolete(
-        "PR_Yield()", "PR_Sleep(PR_INTERVAL_NO_WAIT)");
-    return (PR_Sleep(PR_INTERVAL_NO_WAIT));
-}
-
 /*
 ** Make the current thread sleep until "timeout" ticks amount of time
 ** has expired. If "timeout" is PR_INTERVAL_NO_WAIT then the call is

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/udns/udns_resolver.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/udns/udns_resolver.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/udns/udns_resolver.c	Fri Apr 13 10:44:28 2007
@@ -46,9 +46,6 @@
 # include <unistd.h>
 # include <fcntl.h>
 # include <sys/time.h>
-# ifdef HAVE_CONFIG_H
-#  include <config.h>
-# endif
 # ifdef HAVE_POLL
 #  include <sys/poll.h>
 # endif
@@ -77,7 +74,7 @@
 # define EAFNOSUPPORT EINVAL
 #endif
 
-union sockaddr_ns {
+union usockaddr_ns {
   struct sockaddr sa;
   struct sockaddr_in sin;
 #if HAVE_INET6
@@ -184,7 +181,7 @@
   unsigned dnsc_port;			/* default port (DNS_PORT) */
   unsigned dnsc_udpbuf;			/* size of UDP buffer */
   /* array of nameserver addresses */
-  union sockaddr_ns dnsc_serv[DNS_MAXSERV];
+  union usockaddr_ns dnsc_serv[DNS_MAXSERV];
   unsigned dnsc_nserv;			/* number of nameservers */
   unsigned dnsc_salen;			/* length of socket addresses */
   /* search list for unqualified names */
@@ -272,7 +269,7 @@
 };
 
 static int dns_add_serv_internal(struct dns_ctx *ctx, const char *serv) {
-  union sockaddr_ns *sns;
+  union usockaddr_ns *sns;
   if (!serv)
     return (ctx->dnsc_nserv = 0);
   if (ctx->dnsc_nserv >= DNS_MAXSERV)
@@ -688,7 +685,7 @@
   dns_socket sock;
   unsigned i;
   int port;
-  union sockaddr_ns *sns;
+  union usockaddr_ns *sns;
 #if HAVE_INET6
   unsigned have_inet6 = 0;
 #endif
@@ -922,7 +919,7 @@
     return;
   }
   DNS_DBGQ(ctx, q, 1,
-           &ctx->dnsc_serv[q->dnsq_servi].sa, sizeof(union sockaddr_ns),
+           &ctx->dnsc_serv[q->dnsq_servi].sa, sizeof(union usockaddr_ns),
            q->dnsq_buf, q->dnsq_len);
   q->dnsq_servwait |= 1 << q->dnsq_servi;	/* expect reply from this ns */
 
@@ -1045,7 +1042,7 @@
   dnsc_t *pbuf;
   dnscc_t *pend, *pcur;
   void *result;
-  union sockaddr_ns sns;
+  union usockaddr_ns sns;
   socklen_t slen;
 
   SETCTX(ctx);

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/win32/js/js.vcproj
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/win32/js/js.vcproj	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/win32/js/js.vcproj	Fri Apr 13 10:44:28 2007
@@ -693,84 +693,107 @@
 			Name="NSPR Source"
 			>
 			<File
-				RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntgc.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntinrval.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntio.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntmisc.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntsec.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntsem.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntthread.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\pralarm.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\misc\pratom.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\threads\prcmon.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prcountr.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\threads\prcthr.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\io\prdir.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prdtoa.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\threads\prdump.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prenv.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prerr.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\misc\prerror.c"
 				>
 			</File>
 			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prerrortable.c"
-				>
-			</File>
-			<File
 				RelativePath="..\..\js\nsprpub\pr\src\io\prfdcach.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\io\prfile.c"
@@ -779,78 +802,101 @@
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\misc\prinit.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\misc\prinrval.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\io\prio.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\io\priometh.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\pripc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\pripcsem.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\io\pripv6.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\io\prlayer.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\linking\prlink.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\io\prlog.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prlog2.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prlong.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\malloc\prmalloc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\io\prmapopt.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\malloc\prmem.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\io\prmmap.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\threads\prmon.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\io\prmwait.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prnetdb.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\misc\prolock.c"
@@ -859,82 +905,79 @@
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\md\prosdep.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\io\prpolevt.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\io\prprf.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prrng.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\threads\prrwlock.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\io\prscanf.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\memory\prseg.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\threads\prsem.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\memory\prshm.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\memory\prshma.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\io\prsocket.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\io\prstdio.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prsystem.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prthinfo.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\misc\prtime.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\threads\prtpd.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prtpool.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\misc\prtrace.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\threads\combined\prucpu.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\threads\combined\prucv.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\threads\combined\prulock.c"
@@ -943,26 +986,35 @@
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\threads\combined\prustack.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\threads\combined\pruthr.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\md\windows\w32ipcsem.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\md\windows\w32poll.c"
 				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\md\windows\w32rng.c"
-				>
-			</File>
-			<File
-				RelativePath="..\..\js\nsprpub\pr\src\md\windows\w32shm.c"
-				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\js\nsprpub\pr\src\md\windows\win32_errors.c"

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/xmlrpc-c/src/Makefile
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/xmlrpc-c/src/Makefile	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/xmlrpc-c/src/Makefile	Fri Apr 13 10:44:28 2007
@@ -10,9 +10,11 @@
 default: all
 
 SUBDIRS =
+CPPCLEAN = 
 
 ifeq ($(ENABLE_CPLUSPLUS),yes)
   SUBDIRS += cpp
+  CPPCLEAN += cpp/clean
 endif
 
 WININET_TRANSPORT_DIR = $(SRCDIR)/lib/wininet_transport
@@ -131,7 +133,7 @@
 
 .PHONY: clean clean-local distclean
 clean: clean-common clean-local
-clean-local: cpp/clean
+clean-local: $(CPPCLEAN)
 
 distclean: clean distclean-common
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/FreeSWITCH/Client.pm
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/FreeSWITCH/Client.pm	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/FreeSWITCH/Client.pm	Fri Apr 13 10:44:28 2007
@@ -208,6 +208,22 @@
   return $self->sendmsg($hash);
 }
 
+sub unicast($$$$$$) {
+  my $self = shift;
+
+  my $hash = {
+	      'command' => "sendmsg",
+	      'call-command' => "unicast",
+	      'local_ip' => $_[0],
+	      'local_port' => $_[1],
+	      'remote_ip' => $_[2],
+	      'remote_port' => $_[3],
+	      'transport' => $_[4]
+	     };
+
+  return $self->sendmsg($hash);
+}
+
 sub call_data($) {
   my $self = shift;
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_core_db.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_core_db.h	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_core_db.h	Fri Apr 13 10:44:28 2007
@@ -457,6 +457,11 @@
  */
 SWITCH_DECLARE(void) switch_core_db_free(char *z);
 
+/**
+ * Call this routine to find the number of rows changed by the last statement.
+ */
+SWITCH_DECLARE(int) switch_core_db_changes(switch_core_db_t *db);
+
 /** Return values for switch_core_db_exec() and switch_core_db_step()*/
 #define SWITCH_CORE_DB_OK           0	/* Successful result */
 /* beginning-of-error-codes */

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_ivr.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_ivr.h	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_ivr.h	Fri Apr 13 10:44:28 2007
@@ -42,6 +42,28 @@
 #include <switch.h>
 
 SWITCH_BEGIN_EXTERN_C
+
+struct switch_unicast_conninfo {
+	switch_core_session_t *session;
+	switch_codec_t read_codec;
+	switch_frame_t write_frame;
+	switch_byte_t write_frame_data[SWITCH_RECOMMENDED_BUFFER_SIZE];
+	switch_socket_t *socket;
+	char *local_ip;
+	switch_port_t local_port;
+	char *remote_ip;
+	switch_port_t remote_port;
+	switch_sockaddr_t *local_addr;
+	switch_sockaddr_t *remote_addr;
+	switch_mutex_t *flag_mutex;
+	int32_t flags;
+	int type;
+	int transport;
+	int stream_id;
+};
+typedef struct switch_unicast_conninfo switch_unicast_conninfo_t;
+
+
 /**
  * @defgroup switch_ivr IVR Library
  * @ingroup core1
@@ -49,6 +71,15 @@
  *	building blocks for a higher level IVR interface.
  * @{
  */
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_deactivate_unicast(switch_core_session_t *session);
+SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session, 
+															char *local_ip,
+															switch_port_t local_port,
+															char *remote_ip,
+															switch_port_t remote_port,
+															char *transport);
+
 /*!
   \brief Generate an XML CDR report.
   \param session the session to get the data from.
@@ -79,9 +110,7 @@
 /*!
   \brief Wait for DTMF digits calling a pluggable callback function when digits are collected.
   \param session the session to read.
-  \param dtmf_callback code to execute if any dtmf is dialed during the recording
-  \param buf an object to maintain across calls
-  \param buflen the size of buf
+  \param args arguements to pass for callbacks etc
   \param timeout a timeout in milliseconds
   \return SWITCH_STATUS_SUCCESS to keep the collection moving.
 */
@@ -179,11 +208,8 @@
   \param session the session to play the file too
   \param fh file handle to use (NULL for builtin one)
   \param file the path to the file
-  \param dtmf_callback code to execute if any dtmf is dialed during the playback
-  \param buf an object to maintain across calls
-  \param buflen the size of buf
+  \param args arguements to pass for callbacks etc
   \return SWITCH_STATUS_SUCCESS if all is well
-  \note passing a NULL dtmf_callback nad a not NULL buf indicates to copy any dtmf to buf and stop playback.
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, char *file, switch_input_args_t *args);
 
@@ -193,12 +219,9 @@
   \param session the session to record from
   \param fh file handle to use
   \param file the path to the file
-  \param dtmf_callback code to execute if any dtmf is dialed during the recording
-  \param buf an object to maintain across calls
-  \param buflen the size of buf
+  \param args arguements to pass for callbacks etc
   \param limit max limit to record for (0 for infinite)
   \return SWITCH_STATUS_SUCCESS if all is well
-  \note passing a NULL dtmf_callback nad a not NULL buf indicates to copy any dtmf to buf and stop recording.
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *session,
 													   switch_file_handle_t *fh, char *file, switch_input_args_t *args, uint32_t limit);
@@ -240,10 +263,8 @@
   \param tts_name the desired tts module
   \param voice_name the desired voice
   \param rate the sample rate
-  \param dtmf_callback code to execute if any dtmf is dialed during the audio
   \param text the text to speak
-  \param buf an option data pointer to pass to the callback or a string to put encountered digits in
-  \param buflen the len of buf
+  \param args arguements to pass for callbacks etc
   \return SWITCH_STATUS_SUCCESS if all is well
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session,
@@ -274,7 +295,7 @@
   \brief Bridge Audio from one session to another
   \param session one session
   \param peer_session the other session
-  \param dtmf_callback code to execute if any dtmf is dialed during the bridge
+  \param dtmf_callback a callback for messages and dtmf
   \param session_data data to pass to the DTMF callback for session
   \param peer_session_data data to pass to the DTMF callback for peer_session
   \return SWITCH_STATUS_SUCCESS if all is well
@@ -460,6 +481,7 @@
 /*!
   \brief Feed digits collected into the stream for event match testing
   \param parser a pointer to the parser object created by switch_ivr_digit_stream_parser_new
+  \param stream a stream to write data to
   \param digit a digit to collect and test against the map of digit strings
   \return NULL if no match found or consumer data that was associated with a given digit string when matched
 */
@@ -525,14 +547,15 @@
  *\param name A pointer to the name of this menu.
  *\param greeting_sound Optional pointer to a main sound (press 1 for this 2 for that).
  *\param short_greeting_sound Optional pointer to a shorter main sound for subsequent loops.
- *\param exit_sound Optional pointer to a sound to play upon exiting the menu
+ *\param exit_sound Optional pointer to a sound to play upon exiting the menu.
  *\param invalid_sound Optional pointer to a sound to play after invalid input.
- *\param tts_engine Text To Speech engine name
- *\param tts_voice Text To Speech engine voice name
+ *\param tts_engine Text To Speech engine name.
+ *\param tts_voice Text To Speech engine voice name.
+ *\param phrase_lang the language to use for the phrase macros.
  *\param timeout A number of milliseconds to pause before looping.
  *\param max_failures Maximum number of failures to withstand before hangingup This resets everytime you enter the menu.
- *\param pool memory pool (NULL to create one)
- *\return SWITCH_STATUS_SUCCESS if the menu was created
+ *\param pool memory pool (NULL to create one).
+ *\return SWITCH_STATUS_SUCCESS if the menu was created.
  */
 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_menu,
 													 switch_ivr_menu_t * main,

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_types.h	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_types.h	Fri Apr 13 10:44:28 2007
@@ -117,6 +117,13 @@
 #define SWITCH_BITS_PER_BYTE 8
 	typedef uint8_t switch_byte_t;
 
+
+typedef enum {
+	SUF_NONE = 0,
+	SUF_THREAD_RUNNING = (1 << 0),
+	SUF_READY = (1 << 1)
+} switch_unicast_flag_t;
+
 typedef enum {
 	SWITCH_FALSE = 0,
 	SWITCH_TRUE = 1
@@ -531,6 +538,7 @@
 CF_RING_READY   = (1 << 18) - Channel is ready to send ringback
 CF_BREAK        = (1 << 19) - Channel should stop what it's doing
 CF_BROADCAST    = (1 << 20) - Channel is broadcasting
+CF_UNICAST      = (1 << 21) - Channel has a unicast connection
 </pre>
  */
 
@@ -555,7 +563,8 @@
 	CF_GEN_RINGBACK = (1 << 17),
 	CF_RING_READY = (1 << 18),
 	CF_BREAK = (1 << 19),
-	CF_BROADCAST = (1 << 20)
+	CF_BROADCAST = (1 << 20),
+	CF_UNICAST = (1 << 21)
 } switch_channel_flag_t;
 
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_utils.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_utils.h	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_utils.h	Fri Apr 13 10:44:28 2007
@@ -90,7 +90,7 @@
   \brief find the char representation of an ip adress
   \param buf the buffer to write the ip adress found into
   \param len the length of the buf
-  \param the struct in_addr * to get the adress from
+  \param in the struct in_addr * to get the adress from
   \return the ip adress string
 */
 SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct in_addr *in);

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/Makefile.am
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/Makefile.am	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/Makefile.am	Fri Apr 13 10:44:28 2007
@@ -7,7 +7,7 @@
 	@set fnord $$MAKEFLAGS; amf=$$2; \
 	target=`echo $@ | sed -e 's|^.*-||'`; \
 	modname=`echo $@ | sed -e 's|-.*||'`; \
-	confmoddir=`cat $(switch_builddir)/modules.conf | grep $$modname | sed -e 's|#||' `; \
+	confmoddir=`cat $(switch_builddir)/modules.conf | grep $$modname$$ | sed -e 's|#||' `; \
 	if test -z "$$confmoddir" ; then moddir=$@ ; else  \
 		if test -d  "$(switch_srcdir)/src/mod/$$confmoddir" ; then \
 			moddir="$(switch_srcdir)/src/mod/$$confmoddir" ; else \

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_enum/Makefile
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_enum/Makefile	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_enum/Makefile	Fri Apr 13 10:44:28 2007
@@ -1,11 +1,10 @@
 BASE=../../../..
 UDNS_DIR=$(BASE)/libs/udns
-UDNSA=$(UDNS_DIR)/libudns.a
-LOCAL_CFLAGS=-I$(UDNS_DIR)
-LOCAL_LIBADD=$(UDNSA)
-include $(BASE)/build/modmake.rules
+LOCAL_CFLAGS=-I$(UDNS_DIR) -DHAVE_POLL
+LOCAL_OBJS=$(UDNS_DIR)/udns_dn.o $(UDNS_DIR)/udns_dntosp.o $(UDNS_DIR)/udns_parse.o $(UDNS_DIR)/udns_misc.o \
+$(UDNS_DIR)/udns_rr_a.o $(UDNS_DIR)/udns_rr_ptr.o $(UDNS_DIR)/udns_rr_mx.o $(UDNS_DIR)/udns_rr_txt.o $(UDNS_DIR)/udns_bl.o \
+$(UDNS_DIR)/udns_rr_srv.o $(UDNS_DIR)/udns_rr_naptr.o $(UDNS_DIR)/udns_codes.o $(UDNS_DIR)/udns_resolver.o
+
 
-$(UDNSA): $(UDNS_DIR) $(UDNS_DIR)/.update
-	cd $(UDNS_DIR) && $(MAKE) staticlib
-	$(TOUCH_TARGET)
+include $(BASE)/build/modmake.rules
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.c	Fri Apr 13 10:44:28 2007
@@ -882,7 +882,7 @@
 		}
 
 		profile = gateway_ptr->profile;
-		tech_pvt->from_str = switch_core_session_strdup(nsession, gateway_ptr->register_from);
+		tech_pvt->gateway_from_str = switch_core_session_strdup(nsession, gateway_ptr->register_from);
 		if (!strchr(dest, '@')) {
 			tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s@%s", dest, gateway_ptr->register_proxy + 4);
 		} else {

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.h	Fri Apr 13 10:44:28 2007
@@ -278,6 +278,7 @@
 	char *far_end_contact;
 	char *contact_url;
 	char *from_str;
+	char *gateway_from_str;
 	char *rm_encoding;
 	char *rm_fmtp;
 	char *fmtp_out;

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_glue.c	Fri Apr 13 10:44:28 2007
@@ -417,7 +417,8 @@
 		tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL,
 								  NUTAG_URL(url),
 								  SIPTAG_TO_STR(tech_pvt->dest_to),
-								  SIPTAG_FROM_STR(tech_pvt->from_str),
+								  TAG_IF(tech_pvt->gateway_from_str, SIPTAG_FROM_STR(tech_pvt->gateway_from_str)),
+								  TAG_IF(!tech_pvt->gateway_from_str, SIPTAG_FROM_STR(tech_pvt->from_str)),
 								  TAG_IF(tech_pvt->invite_contact, SIPTAG_CONTACT_STR(tech_pvt->invite_contact)),
 								  TAG_IF(!tech_pvt->invite_contact, SIPTAG_CONTACT_STR(tech_pvt->profile->url)),
 								  TAG_END());

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/Makefile
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/Makefile	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/Makefile	Fri Apr 13 10:44:28 2007
@@ -3,20 +3,23 @@
 LIBPRI=libpri-1.2.4
 LIBPRI_FILE=$(LIBPRI).tar.gz
 LIBPRI_DIR=$(BASE)/libs/$(LIBPRI)
-WANPIPE=wanpipe-3.1.0.p13
+WANPIPE=wanpipe-3.1.0.p15
 WANPIPE_HOST=ftp://ftp.sangoma.com/linux/custom/3.1
 WANPIPE_FILE=$(WANPIPE).tgz
 WANPIPE_DIR=$(BASE)/libs/$(WANPIPE)
 WANPIPE_INCLUDE=$(WANPIPE_DIR)/patches/kdrivers/include
 WANPIPE_KO=$(WANPIPE_DIR)/patches/kdrivers/src/net/wanpipe.ko
 WANPIPE_INSTALLED_KO=$(shell echo "/lib/modules/`uname -r`/kernel/drivers/net/wan/wanpipe.ko")
-LIBSANGOMA_DIR=$(WANPIPE_DIR)/api/libsangoma
+LIBSANGOMA_DIR=./libsangoma
 LOCAL_CFLAGS  =-w -I$(WANPIPE_INCLUDE) -I$(LIBSANGOMA_DIR) -I/usr/local/include -I$(LIBPRI_DIR) -I/usr/src/linux/include -I. -I/usr/include 
 LOCAL_CFLAGS +=-D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -DAFT_A104 -DWANPIPE_TDM_API -I$(switch_srcdir)/libs/libteletone/src -D_GNUC_ -DWANPIPE_TDM_API
 LOCAL_OBJS = ss7boost_client.o $(LIBPRI_DIR)/copy_string.o $(LIBPRI_DIR)/pri.o $(LIBPRI_DIR)/q921.o $(LIBPRI_DIR)/prisched.o $(LIBPRI_DIR)/q931.o $(LIBPRI_DIR)/pri_facility.o $(LIBSANGOMA_DIR)/libsangoma.o $(LIBSANGOMA_DIR)/sangoma_pri.o 
 
 include $(BASE)/build/modmake.rules 
 
+testapp: testapp.c $(LIBSANGOMA_DIR)/libsangoma.o
+	$(CC) -I$(WANPIPE_DIR)/api/lib $(CFLAGS) $(LOCAL_CFLAGS) lib_api.c testapp.c $(LIBSANGOMA_DIR)/libsangoma.o -o testapp
+
 $(LIBPRI_DIR):
 	$(GETLIB) $(LIBPRI_HOST) $(LIBPRI_FILE)
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.c	Fri Apr 13 10:44:28 2007
@@ -23,96 +23,99 @@
 #define DFT_CARD "wanpipe1"
 
 #if defined(WIN32)
-//extern int    verbose;
+//extern int	verbose;
 
 #define DEV_NAME_LEN	100
 char device_name[DEV_NAME_LEN];
 
 /* IOCTL management structures and variables*/
-wan_udp_hdr_t wan_udp;
+wan_udp_hdr_t	wan_udp;
 
 #include "win_api_common.h"
 
 static wan_cmd_api_t api_cmd;
-static api_tx_hdr_t *tx_hdr = (api_tx_hdr_t *) api_cmd.data;
+static api_tx_hdr_t *tx_hdr = (api_tx_hdr_t *)api_cmd.data;
 
 /* keeps the LAST (and single) event received */
 static wp_tdm_api_rx_hdr_t last_tdm_api_event_buffer;
 
-#endif /* WIN32 */
+#endif	/* WIN32 */
 
-void sangoma_socket_close(sng_fd_t * sp)
+void sangoma_socket_close(sng_fd_t *sp) 
 {
 #if defined(WIN32)
-	if (*sp != INVALID_HANDLE_VALUE) {
+	if(	*sp != INVALID_HANDLE_VALUE){
 		CloseHandle(*sp);
 		*sp = INVALID_HANDLE_VALUE;
 	}
 #else
-	if (*sp > -1) {
-		close(*sp);
-		*sp = -1;
-	}
+    if (*sp > -1) {
+	close(*sp);
+	*sp = -1;
+    }
 #endif
 }
 
 int sangoma_socket_waitfor(sng_fd_t fd, int timeout, int flags)
 {
 #if defined(WIN32)
-	API_POLL_STRUCT api_poll;
+	API_POLL_STRUCT	api_poll;
 
 	memset(&api_poll, 0x00, sizeof(API_POLL_STRUCT));
-
+	
 	api_poll.user_flags_bitmap = flags;
 
-	if (DoApiPollCommand(fd, &api_poll)) {
+	if(DoApiPollCommand(fd, &api_poll)){
 		//failed
 		return 0;
 	}
 
-	switch (api_poll.operation_status) {
-	case SANG_STATUS_RX_DATA_AVAILABLE:
-		break;
-
-	default:
-		prn(1, "Error: sangoma_socket_waitfor(): Unknown Operation Status: %d\n", api_poll.operation_status);
-		return 0;
-	}							//switch()
+	switch(api_poll.operation_status)
+	{
+		case SANG_STATUS_RX_DATA_AVAILABLE:
+			break;
 
-	if (api_poll.poll_events_bitmap == 0) {
-		prn(1, "Error: invalid Poll Events bitmap: 0x%X\n", api_poll.poll_events_bitmap);
+		default:
+			prn(1, "Error: sangoma_socket_waitfor(): Unknown Operation Status: %d\n", 
+				api_poll.operation_status);
+			return 0;
+	}//switch()
+
+	if(api_poll.poll_events_bitmap == 0){
+		prn(1, "Error: invalid Poll Events bitmap: 0x%X\n",
+			api_poll.poll_events_bitmap);
 	}
 	return api_poll.poll_events_bitmap;
 #else
-	struct pollfd pfds[1];
-	int res;
+    struct pollfd pfds[1];
+    int res;
 
-	memset(&pfds[0], 0, sizeof(pfds[0]));
-	pfds[0].fd = fd;
-	pfds[0].events = flags;
-	res = poll(pfds, 1, timeout);
-	if (res > 0) {
-		if ((pfds[0].revents & POLLERR)) {
-			res = -1;
-		} else if ((pfds[0].revents)) {
-			res = 1;
-		}
+    memset(&pfds[0], 0, sizeof(pfds[0]));
+    pfds[0].fd = fd;
+    pfds[0].events = flags;
+    res = poll(pfds, 1, timeout);
+    if (res > 0) {
+	if ((pfds[0].revents & POLLERR)) {
+		res = -1;
+	} else if((pfds[0].revents)) {
+		res = 1;
 	}
+    }
 
-	return res;
+    return res;
 #endif
 }
 
 
 int sangoma_span_chan_toif(int span, int chan, char *interface_name)
 {
-	sprintf(interface_name, "s%ic%i", span, chan);
+ 	sprintf(interface_name,"s%ic%i",span,chan);
 	return 0;
 }
 
 int sangoma_interface_toi(char *interface_name, int *span, int *chan)
 {
-	char *p = NULL, *sp = NULL, *ch = NULL;
+	char *p=NULL, *sp = NULL, *ch = NULL;
 	int ret = 0;
 	char data[FNAME_LEN];
 
@@ -128,7 +131,7 @@
 			}
 		}
 
-		if (ch && sp) {
+		if(ch && sp) {
 			*span = atoi(sp);
 			*chan = atoi(ch);
 			ret = 1;
@@ -159,7 +162,7 @@
 			}
 		}
 
-		if (ch && sp) {
+		if(ch && sp) {
 			*span = atoi(sp);
 			*chan = atoi(ch);
 			ret = 1;
@@ -172,123 +175,132 @@
 	return ret;
 }
 
-sng_fd_t sangoma_open_tdmapi_span_chan(int span, int chan)
+sng_fd_t sangoma_open_tdmapi_span_chan(int span, int chan) 
 {
-	char fname[FNAME_LEN];
+   	char fname[FNAME_LEN];
 #if defined(WIN32)
 
 	//NOTE: under Windows Interfaces are zero based but 'chan' is 1 based.
-	//      Subtract 1 from 'chan'.
-	_snprintf(fname, FNAME_LEN, "\\\\.\\WANPIPE%d_IF%d", span, chan - 1);
+	//		Subtract 1 from 'chan'.
+	_snprintf(fname , FNAME_LEN, "\\\\.\\WANPIPE%d_IF%d", span, chan - 1);
 
 	//prn(verbose, "Opening device: %s...\n", fname);
 
-	return CreateFile(fname,
-					  GENERIC_READ | GENERIC_WRITE,
-					  FILE_SHARE_READ | FILE_SHARE_WRITE,
-					  (LPSECURITY_ATTRIBUTES) NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH, (HANDLE) NULL);
+	return CreateFile(	fname, 
+						GENERIC_READ | GENERIC_WRITE, 
+						FILE_SHARE_READ | FILE_SHARE_WRITE,
+						(LPSECURITY_ATTRIBUTES)NULL, 
+						OPEN_EXISTING,
+						FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH,
+						(HANDLE)NULL
+						);
 #else
-	int fd = -1;
+  	int fd=-1;
 
-	sprintf(fname, "/dev/wptdm_s%dc%d", span, chan);
+	sprintf(fname,"/dev/wptdm_s%dc%d",span,chan);
 
 	fd = open(fname, O_RDWR);
 
-	return fd;
+	return fd;  
 #endif
-}
+}            
 
-sng_fd_t sangoma_create_socket_by_name(char *device, char *card)
+sng_fd_t sangoma_create_socket_by_name(char *device, char *card) 
 {
-	int span, chan;
-	sangoma_interface_toi(device, &span, &chan);
-
-	return sangoma_open_tdmapi_span_chan(span, chan);
+	int span,chan;
+	sangoma_interface_toi(device,&span,&chan);
+	
+	return sangoma_open_tdmapi_span_chan(span,chan);
 }
 
-
-sng_fd_t sangoma_open_tdmapi_span(int span)
+          
+sng_fd_t sangoma_open_tdmapi_span(int span) 
 {
-	int i = 0;
+    int i=0;
 #if defined(WIN32)
 	sng_fd_t fd = INVALID_HANDLE_VALUE;
 
-	for (i = 1; i < 32; i++) {
-		if ((fd = sangoma_open_tdmapi_span_chan(span, i)) == INVALID_HANDLE_VALUE) {
+	for(i = 1; i < 32; i++){
+		if((fd = sangoma_open_tdmapi_span_chan(span, i)) == INVALID_HANDLE_VALUE){
 			//prn(verbose, "Span: %d, chan: %d: is not running, consider 'busy'\n",
-			//  span, i);
+			//	span, i);
 			continue;
 		}
+
 		//get the open handle counter
-		wan_udp.wan_udphdr_command = GET_OPEN_HANDLES_COUNTER;
+		wan_udp.wan_udphdr_command = GET_OPEN_HANDLES_COUNTER; 
 		wan_udp.wan_udphdr_data_len = 0;
 
 		DoManagementCommand(fd, &wan_udp);
-		if (wan_udp.wan_udphdr_return_code) {
-			prn(1, "Error: command GET_OPEN_HANDLES_COUNTER failed! Span: %d, chan: %d\n", span, i);
+		if(wan_udp.wan_udphdr_return_code){
+			prn(1, "Error: command GET_OPEN_HANDLES_COUNTER failed! Span: %d, chan: %d\n",
+				span, i);
 			//don't forget to close!! otherwize counter will stay incremented.
 			sangoma_socket_close(&fd);
 			continue;
 		}
+
 		//prn(verbose, "open handles counter: %d\n", *(int*)&wan_udp.wan_udphdr_data[0]);
-		if (*(int *) &wan_udp.wan_udphdr_data[0] == 1) {
+		if(*(int*)&wan_udp.wan_udphdr_data[0] == 1){
 			//this is the only process using this chan/span, so it is 'free'
 			//prn(verbose, "Found 'free' Span: %d, chan: %d\n",span, i);
 			break;
 		}
 		//don't forget to close!! otherwize counter will stay incremented.
 		sangoma_socket_close(&fd);
-	}							//for()
+	}//for()
 
 #else
-	unsigned char fname[FNAME_LEN];
-	int fd = 0;
-	for (i = 1; i < 32; i++) {
-		sprintf(fname, "/dev/wptdm_s%dc%d", span, i);
+    unsigned char fname[FNAME_LEN];
+	int fd=0;
+	for (i=1;i<32;i++){
+		sprintf(fname,"/dev/wptdm_s%dc%d",span,i);
 		fd = open(fname, O_RDWR);
-		if (fd < 0) {
-			continue;
+		if (fd < 0){
+         	continue;
 		}
 		break;
 	}
-#endif
-	return fd;
-}
+#endif	
+    return fd;  
+}      
 
 int sangoma_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, int datalen, int flag)
 {
-	int rx_len = 0;
+	int rx_len=0;
 
 #if defined(WIN32)
-	static RX_DATA_STRUCT rx_data;
-	api_header_t *pri;
-	wp_tdm_api_rx_hdr_t *tdm_api_rx_hdr;
-	wp_tdm_api_rx_hdr_t *user_buf = (wp_tdm_api_rx_hdr_t *) hdrbuf;
+	static RX_DATA_STRUCT	rx_data;
+	api_header_t			*pri;
+	wp_tdm_api_rx_hdr_t		*tdm_api_rx_hdr;
+	wp_tdm_api_rx_hdr_t		*user_buf = (wp_tdm_api_rx_hdr_t*)hdrbuf;
 
-	if (hdrlen != sizeof(wp_tdm_api_rx_hdr_t)) {
+	if(hdrlen != sizeof(wp_tdm_api_rx_hdr_t)){
 		//error
 		prn(1, "Error: sangoma_readmsg_tdm(): invalid size of user's 'header buffer'.\
 Should be 'sizeof(wp_tdm_api_rx_hdr_t)'.\n");
 		return -1;
 	}
 
-	if (DoReadCommand(fd, &rx_data)) {
+	if(DoReadCommand(fd, &rx_data) ){
 		//error
 		prn(1, "Error: DoReadCommand() failed! Check messages log.\n");
 		return -1;
 	}
+
 	//use our special buffer at rxdata to hold received data
 	pri = &rx_data.api_header;
-	tdm_api_rx_hdr = (wp_tdm_api_rx_hdr_t *) rx_data.data;
+	tdm_api_rx_hdr = (wp_tdm_api_rx_hdr_t*)rx_data.data;
 
 	user_buf->wp_tdm_api_event_type = pri->operation_status;
 
-	switch (pri->operation_status) {
+	switch(pri->operation_status)
+	{
 	case SANG_STATUS_RX_DATA_AVAILABLE:
 		//prn(verbose, "SANG_STATUS_RX_DATA_AVAILABLE\n");
 
-		if (pri->data_length > datalen) {
-			rx_len = 0;
+		if(pri->data_length > datalen){
+			rx_len=0;
 			break;
 		}
 		memcpy(databuf, rx_data.data, pri->data_length);
@@ -303,11 +315,12 @@
 		rx_len = pri->data_length;
 
 		//make copy for use with sangoma_tdm_read_event() - indirect access.
-		memcpy(&last_tdm_api_event_buffer, tdm_api_rx_hdr, sizeof(wp_tdm_api_rx_hdr_t));
+		memcpy(	&last_tdm_api_event_buffer,	tdm_api_rx_hdr, sizeof(wp_tdm_api_rx_hdr_t));
 		break;
 
 	default:
-		switch (pri->operation_status) {
+		switch(pri->operation_status)
+		{
 		case SANG_STATUS_RX_DATA_TIMEOUT:
 			//no data in READ_CMD_TIMEOUT, try again.
 			prn(1, "Error: Timeout on read.\n");
@@ -331,43 +344,43 @@
 		default:
 			prn(1, "Rx:Unknown Operation Status: %d\n", pri->operation_status);
 			break;
-		}						//switch()
+		}//switch()
 		return 0;
-	}							//switch()
+	}//switch()
 
 #else
 	struct msghdr msg;
 	struct iovec iov[2];
 
-	memset(&msg, 0, sizeof(struct msghdr));
+	memset(&msg,0,sizeof(struct msghdr));
 
-	iov[0].iov_len = hdrlen;
-	iov[0].iov_base = hdrbuf;
+	iov[0].iov_len=hdrlen;
+	iov[0].iov_base=hdrbuf;
 
-	iov[1].iov_len = datalen;
-	iov[1].iov_base = databuf;
+	iov[1].iov_len=datalen;
+	iov[1].iov_base=databuf;
 
-	msg.msg_iovlen = 2;
-	msg.msg_iov = iov;
+	msg.msg_iovlen=2;
+	msg.msg_iov=iov;
 
-	rx_len = read(fd, &msg, datalen + hdrlen);
+	rx_len = read(fd,&msg,datalen+hdrlen);
 
-	if (rx_len <= sizeof(wp_tdm_api_rx_hdr_t)) {
+	if (rx_len <= sizeof(wp_tdm_api_rx_hdr_t)){
 		return -EINVAL;
 	}
 
-	rx_len -= sizeof(wp_tdm_api_rx_hdr_t);
+	rx_len-=sizeof(wp_tdm_api_rx_hdr_t);
 #endif
-	return rx_len;
-}
+    return rx_len;
+}                    
 
 int sangoma_writemsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, unsigned short datalen, int flag)
 {
 	int bsent;
 
 #if defined(WIN32)
-	static TX_DATA_STRUCT local_tx_data;
-	api_header_t *pri;
+	static TX_DATA_STRUCT	local_tx_data;
+	api_header_t			*pri;
 
 	pri = &local_tx_data.api_header;
 
@@ -375,35 +388,36 @@
 	memcpy(local_tx_data.data, databuf, pri->data_length);
 
 	//queue data for transmission
-	if (DoWriteCommand(fd, &local_tx_data)) {
+	if(	DoWriteCommand(fd, &local_tx_data)){
 		//error
 		prn(1, "Error: DoWriteCommand() failed!! Check messages log.\n");
 		return -1;
 	}
 
-	bsent = 0;
+	bsent=0;
 	//check that frame was transmitted
-	switch (local_tx_data.api_header.operation_status) {
+	switch(local_tx_data.api_header.operation_status)
+	{
 	case SANG_STATUS_SUCCESS:
 		bsent = datalen;
 		break;
-
+				
 	case SANG_STATUS_TX_TIMEOUT:
 		//error
 		prn(1, "****** Error: SANG_STATUS_TX_TIMEOUT ******\n");
 		//Check messages log or look at statistics.
 		break;
-
+				
 	case SANG_STATUS_TX_DATA_TOO_LONG:
 		//Attempt to transmit data longer than the pre-configured maximum.
 		//Maximum length is set in 'Interface Properties',
 		//in the 'Device Manager'.
 		prn(1, "****** SANG_STATUS_TX_DATA_TOO_LONG ******\n");
 		break;
-
+				
 	case SANG_STATUS_TX_DATA_TOO_SHORT:
 		//Minimum is 1 byte  for Primary   port,
-		//           2 bytes for Secondary port
+		//			 2 bytes for Secondary port
 		prn(1, "****** SANG_STATUS_TX_DATA_TOO_SHORT ******\n");
 		break;
 
@@ -416,27 +430,28 @@
 		break;
 
 	default:
-		prn(1, "Unknown return code (0x%X) on transmission!\n", local_tx_data.api_header.operation_status);
+		prn(1, "Unknown return code (0x%X) on transmission!\n",
+			local_tx_data.api_header.operation_status);
 		break;
-	}							//switch()
+	}//switch()
 #else
 	struct msghdr msg;
 	struct iovec iov[2];
 
-	memset(&msg, 0, sizeof(struct msghdr));
+	memset(&msg,0,sizeof(struct msghdr));
 
-	iov[0].iov_len = hdrlen;
-	iov[0].iov_base = hdrbuf;
+	iov[0].iov_len=hdrlen;
+	iov[0].iov_base=hdrbuf;
 
-	iov[1].iov_len = datalen;
-	iov[1].iov_base = databuf;
+	iov[1].iov_len=datalen;
+	iov[1].iov_base=databuf;
 
-	msg.msg_iovlen = 2;
-	msg.msg_iov = iov;
+	msg.msg_iovlen=2;
+	msg.msg_iov=iov;
 
-	bsent = write(fd, &msg, datalen + hdrlen);
-	if (bsent > 0) {
-		bsent -= sizeof(wp_tdm_api_tx_hdr_t);
+	bsent = write(fd,&msg,datalen+hdrlen);
+	if (bsent > 0){
+		bsent-=sizeof(wp_tdm_api_tx_hdr_t);
 	}
 #endif
 	return bsent;
@@ -449,17 +464,17 @@
  * Execute TDM command
  *
  */
-static int sangoma_tdm_cmd_exec(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_cmd_exec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
 {
 	int err;
 
 #if defined(WIN32)
 	err = tdmv_api_ioctl(fd, &tdm_api->wp_tdm_cmd);
 #else
-	err = ioctl(fd, SIOC_WANPIPE_TDM_API, &tdm_api->wp_tdm_cmd);
-	if (err < 0) {
+	err = ioctl(fd,SIOC_WANPIPE_TDM_API,&tdm_api->wp_tdm_cmd);
+	if (err < 0){
 		char tmp[50];
-		sprintf(tmp, "TDM API: CMD: %i\n", tdm_api->wp_tdm_cmd.cmd);
+		sprintf(tmp,"TDM API: CMD: %i\n",tdm_api->wp_tdm_cmd.cmd);
 		perror(tmp);
 		return -1;
 	}
@@ -471,35 +486,40 @@
  * Get Full TDM API configuration per channel
  *
  */
-int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_FULL_CFG;
 
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
 	printf("TDM API CFG:\n");
-	printf("\thw_tdm_coding:\t%d\n", tdm_api->wp_tdm_cmd.hw_tdm_coding);
-	printf("\tusr_mtu_mru:\t%d\n", tdm_api->wp_tdm_cmd.hw_mtu_mru);
-	printf("\tusr_period:\t%d\n", tdm_api->wp_tdm_cmd.usr_period);
-	printf("\ttdm_codec:\t%d\n", tdm_api->wp_tdm_cmd.tdm_codec);
-	printf("\tpower_level:\t%d\n", tdm_api->wp_tdm_cmd.power_level);
-	printf("\trx_disable:\t%d\n", tdm_api->wp_tdm_cmd.rx_disable);
-	printf("\ttx_disable:\t%d\n", tdm_api->wp_tdm_cmd.tx_disable);
-	printf("\tusr_mtu_mru:\t%d\n", tdm_api->wp_tdm_cmd.usr_mtu_mru);
-	printf("\tidle flag:\t0x%02X\n", tdm_api->wp_tdm_cmd.idle_flag);
-	printf("\tfe alarms:\t0x%02X\n", tdm_api->wp_tdm_cmd.fe_alarms);
-
-	printf("\trx pkt\t%d\ttx pkt\t%d\n", tdm_api->wp_tdm_cmd.stats.rx_packets, tdm_api->wp_tdm_cmd.stats.tx_packets);
-	printf("\trx err\t%d\ttx err\t%d\n", tdm_api->wp_tdm_cmd.stats.rx_errors, tdm_api->wp_tdm_cmd.stats.tx_errors);
+	printf("\thw_tdm_coding:\t%d\n",tdm_api->wp_tdm_cmd.hw_tdm_coding);
+	printf("\tusr_mtu_mru:\t%d\n",tdm_api->wp_tdm_cmd.hw_mtu_mru);
+	printf("\tusr_period:\t%d\n",tdm_api->wp_tdm_cmd.usr_period);
+	printf("\ttdm_codec:\t%d\n",tdm_api->wp_tdm_cmd.tdm_codec);
+	printf("\tpower_level:\t%d\n",tdm_api->wp_tdm_cmd.power_level);
+	printf("\trx_disable:\t%d\n",tdm_api->wp_tdm_cmd.rx_disable);
+	printf("\ttx_disable:\t%d\n",tdm_api->wp_tdm_cmd.tx_disable);
+	printf("\tusr_mtu_mru:\t%d\n",tdm_api->wp_tdm_cmd.usr_mtu_mru);
+	printf("\tidle flag:\t0x%02X\n",tdm_api->wp_tdm_cmd.idle_flag);
+	printf("\tfe alarms:\t0x%02X\n",tdm_api->wp_tdm_cmd.fe_alarms);
+	
+	printf("\trx pkt\t%d\ttx pkt\t%d\n",tdm_api->wp_tdm_cmd.stats.rx_packets,
+				tdm_api->wp_tdm_cmd.stats.tx_packets);
+	printf("\trx err\t%d\ttx err\t%d\n",
+				tdm_api->wp_tdm_cmd.stats.rx_errors,
+				tdm_api->wp_tdm_cmd.stats.tx_errors);
 #ifndef __WINDOWS__
-	printf("\trx ovr\t%d\ttx idl\t%d\n", tdm_api->wp_tdm_cmd.stats.rx_fifo_errors, tdm_api->wp_tdm_cmd.stats.tx_carrier_errors);
-#endif
-
+	printf("\trx ovr\t%d\ttx idl\t%d\n",
+				tdm_api->wp_tdm_cmd.stats.rx_fifo_errors,
+				tdm_api->wp_tdm_cmd.stats.tx_carrier_errors);
+#endif				
+	
 	return 0;
 }
 
@@ -515,14 +535,14 @@
  * }
  *
  */
-int sangoma_tdm_set_codec(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int codec)
+int sangoma_tdm_set_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int codec)
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_SET_CODEC;
 	tdm_api->wp_tdm_cmd.tdm_codec = codec;
 
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
 
 	return err;
 }
@@ -539,18 +559,18 @@
  * }
  *
  */
-int sangoma_tdm_get_codec(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_get_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_CODEC;
 
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
-	return tdm_api->wp_tdm_cmd.tdm_codec;
+	return tdm_api->wp_tdm_cmd.tdm_codec;	
 }
 
 
@@ -561,14 +581,14 @@
  *  10,20,30,40,50 ms      
  *
  */
-int sangoma_tdm_set_usr_period(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int period)
+int sangoma_tdm_set_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int period)
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_SET_USR_PERIOD;
 	tdm_api->wp_tdm_cmd.usr_period = period;
 
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
 
 	return err;
 }
@@ -580,14 +600,14 @@
  *  10,20,30,40,50 ms      
  *
  */
-int sangoma_tdm_get_usr_period(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_get_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_USR_PERIOD;
 
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
@@ -600,15 +620,15 @@
  * Coding Format will be ULAW/ALAW based on T1/E1 
  */
 
-int sangoma_tdm_get_hw_coding(int fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_get_hw_coding(int fd, wanpipe_tdm_api_t *tdm_api)
 {
-	int err;
-	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_HW_CODING;
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
-		return err;
-	}
-	return tdm_api->wp_tdm_cmd.hw_tdm_coding;
+        int err;
+        tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_HW_CODING;
+        err=sangoma_tdm_cmd_exec(fd,tdm_api);
+        if (err){
+                return err;
+        }
+        return tdm_api->wp_tdm_cmd.hw_tdm_coding;
 }
 
 
@@ -618,14 +638,14 @@
  * The USER MTU/MRU values will change each time a PERIOD
  * or CODEC is adjusted.
  */
-int sangoma_tdm_get_usr_mtu_mru(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_get_usr_mtu_mru(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_USR_MTU_MRU;
 
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
@@ -638,14 +658,14 @@
  * This option is not implemented yet
  *
  */
-int sangoma_tdm_set_power_level(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int power)
+int sangoma_tdm_set_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int power)
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_SET_POWER_LEVEL;
 	tdm_api->wp_tdm_cmd.power_level = power;
 
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
 
 	return err;
 }
@@ -656,43 +676,42 @@
  * This option is not implemented yet
  *
  */
-int sangoma_tdm_get_power_level(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_get_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_POWER_LEVEL;
 
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
 	return tdm_api->wp_tdm_cmd.power_level;
 }
 
-int sangoma_tdm_flush_bufs(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_flush_bufs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
 {
 #if 0
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_FLUSH_BUFFERS;
 
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 #endif
 	return 0;
 }
 
-int sangoma_tdm_enable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int poll_in_sec)
-{
-
+int sangoma_tdm_enable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int poll_in_sec) {
+	
 	int err;
-
+	
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_ENABLE_RBS_EVENTS;
-	tdm_api->wp_tdm_cmd.rbs_poll = poll_in_sec;
-
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	tdm_api->wp_tdm_cmd.rbs_poll=poll_in_sec; 
+	
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
@@ -700,180 +719,185 @@
 }
 
 
-int sangoma_tdm_disable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
-{
+int sangoma_tdm_disable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) {
 
 	int err;
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_DISABLE_RBS_EVENTS;
-
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
 	return 0;
 }
 
-int sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, unsigned char rbs)
+int sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char rbs) 
 {
-
+	
 	int err;
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_WRITE_RBS_BITS;
-	tdm_api->wp_tdm_cmd.rbs_tx_bits = rbs;
-
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	tdm_api->wp_tdm_cmd.rbs_tx_bits=rbs; 
+	
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
 	return 0;
-}
+}        
 
-int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) 
 {
 	wp_tdm_api_rx_hdr_t *rx_event;
 
-#if defined(WIN32)
+#if defined(WIN32)	
 	rx_event = &last_tdm_api_event_buffer;
 #else
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_READ_EVENT;
-
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
 	rx_event = &tdm_api->wp_tdm_cmd.event;
 #endif
 
-	switch (rx_event->wp_tdm_api_event_type) {
-
+	switch (rx_event->wp_tdm_api_event_type){
+	
 	case WP_TDM_EVENT_RBS:
-		printf("%d: GOT RBS EVENT %p\n", (int) fd, tdm_api->wp_tdm_event.wp_rbs_event);
+		printf("%d: GOT RBS EVENT %p\n",(int)fd,tdm_api->wp_tdm_event.wp_rbs_event);
 		if (tdm_api->wp_tdm_event.wp_rbs_event) {
-			tdm_api->wp_tdm_event.wp_rbs_event(fd, rx_event->wp_tdm_api_event_rbs_rx_bits);
+			tdm_api->wp_tdm_event.wp_rbs_event(fd,rx_event->wp_tdm_api_event_rbs_rx_bits);
 		}
-
+		
 		break;
-
+		
 	case WP_TDM_EVENT_DTMF:
-		printf("%d: GOT DTMF EVENT\n", (int) fd);
+		printf("%d: GOT DTMF EVENT\n",(int)fd);
 		if (tdm_api->wp_tdm_event.wp_dtmf_event) {
 			tdm_api->wp_tdm_event.wp_dtmf_event(fd,
-												rx_event->wp_tdm_api_event_dtmf_digit,
-												rx_event->wp_tdm_api_event_dtmf_type, rx_event->wp_tdm_api_event_dtmf_port);
+						rx_event->wp_tdm_api_event_dtmf_digit,
+						rx_event->wp_tdm_api_event_dtmf_type,
+						rx_event->wp_tdm_api_event_dtmf_port);
 		}
 		break;
-
+		
 	case WP_TDM_EVENT_RXHOOK:
-		printf("%d: GOT RXHOOK EVENT\n", (int) fd);
+		printf("%d: GOT RXHOOK EVENT\n",(int)fd);
 		if (tdm_api->wp_tdm_event.wp_rxhook_event) {
-			tdm_api->wp_tdm_event.wp_rxhook_event(fd, rx_event->wp_tdm_api_event_rxhook_state);
+			tdm_api->wp_tdm_event.wp_rxhook_event(fd,
+						rx_event->wp_tdm_api_event_rxhook_state);
 		}
 		break;
 
 	case WP_TDM_EVENT_RING_DETECT:
-		printf("%d: GOT RXRING EVENT\n", (int) fd);
+		printf("%d: GOT RXRING EVENT\n",(int)fd);
 		if (tdm_api->wp_tdm_event.wp_rxring_event) {
-			tdm_api->wp_tdm_event.wp_rxring_event(fd, rx_event->wp_tdm_api_event_ring_state);
+			tdm_api->wp_tdm_event.wp_rxring_event(fd,
+						rx_event->wp_tdm_api_event_ring_state);
 		}
 		break;
 
 	case WP_TDM_EVENT_RING_TRIP:
-		printf("%d: GOT RING TRIP EVENT\n", (int) fd);
+		printf("%d: GOT RING TRIP EVENT\n",(int)fd);
 		if (tdm_api->wp_tdm_event.wp_ringtrip_event) {
-			tdm_api->wp_tdm_event.wp_ringtrip_event(fd, rx_event->wp_tdm_api_event_ring_state);
+			tdm_api->wp_tdm_event.wp_ringtrip_event(fd,
+						rx_event->wp_tdm_api_event_ring_state);
 		}
 		break;
 
 	case WP_TDM_EVENT_FE_ALARM:
-		printf("%d: GOT FE ALARMS EVENT %i\n", (int) fd, rx_event->wp_tdm_api_event_fe_alarm);
+		printf("%d: GOT FE ALARMS EVENT %i\n",(int)fd,
+				rx_event->wp_tdm_api_event_fe_alarm);
 		if (tdm_api->wp_tdm_event.wp_fe_alarm_event) {
-			tdm_api->wp_tdm_event.wp_fe_alarm_event(fd, rx_event->wp_tdm_api_event_fe_alarm);
-		}
-
+			tdm_api->wp_tdm_event.wp_fe_alarm_event(fd,
+						rx_event->wp_tdm_api_event_fe_alarm);
+		}    
+		
 	default:
-		printf("%d: Unknown TDM event!", (int) fd);
+		printf("%d: Unknown TDM event!", (int)fd);
 		break;
 	}
-
+	
 	return 0;
-}
+}        
 
-int sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
 {
 	int err;
-
+	
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_ENABLE_DTMF_EVENTS;
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
 	return 0;
 }
 
-int sangoma_tdm_disable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_disable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) 
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_DISABLE_DTMF_EVENTS;
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
 	return 0;
 }
 
-int sangoma_tdm_enable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_enable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) 
 {
 	int err;
-
+	
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_ENABLE_RM_DTMF_EVENTS;
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
 	return 0;
 }
 
-int sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) 
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_DISABLE_RM_DTMF_EVENTS;
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
 	return 0;
 }
 
-int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) 
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_ENABLE_RXHOOK_EVENTS;
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
 	return 0;
 }
 
-int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) 
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_DISABLE_RXHOOK_EVENTS;
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
@@ -884,18 +908,18 @@
  * GET Front End Alarms
  * 
  */
-int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
 {
 	int err;
 
 	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_FE_ALARMS;
 
-	err = sangoma_tdm_cmd_exec(fd, tdm_api);
-	if (err) {
+	err=sangoma_tdm_cmd_exec(fd,tdm_api);
+	if (err){
 		return err;
 	}
 
 	return tdm_api->wp_tdm_cmd.fe_alarms;
-}
+}         
 
 #endif /* WANPIPE_TDM_API */

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.h	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.h	Fri Apr 13 10:44:28 2007
@@ -34,7 +34,7 @@
 #ifdef WANPIPE_TDM_API
 #include <wanpipe_tdm_api.h>	//for TDMV API
 #endif
-#include <sang_status_defines.h>	//return codes
+#include <sang_status_defines.h>//return codes
 #include <sang_api.h>			//for IOCTL codes
 #include <sdla_te1_pmc.h>		//RBS definitions
 #include <sdla_te1.h>			//TE1 macros
@@ -94,7 +94,7 @@
 /* Open Span/Chan devices
  * open_tdmapi_span_chan: open device based on span chan values 
  * sangoma_open_tdmapi_span: open first available device on span
- */
+ */     
 
 sng_fd_t sangoma_open_tdmapi_span_chan(int span, int chan);
 sng_fd_t sangoma_open_tdmapi_span(int span);
@@ -104,65 +104,68 @@
 /* Device Rx/Tx functions 
  * writemsg_tdm: 	tx header + data from separate buffers 
  * readmsg_tdm: 	rx header + data to separate buffers
- */
-int sangoma_writemsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, unsigned short datalen, int flag);
-int sangoma_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, int datalen, int flag);
+ */    
+int sangoma_writemsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, 
+						 void *databuf, unsigned short datalen, int flag);
+int sangoma_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, 
+						void *databuf, int datalen, int flag);
 
 #define sangoma_readmsg_socket sangoma_readmsg_tdm
 #define sangoma_sendmsg_socket sangoma_writemsg_tdm
 
 #ifdef WANPIPE_TDM_API
 
-void sangoma_socket_close(sng_fd_t * sp);
+void sangoma_socket_close(sng_fd_t *sp);
 int sangoma_socket_waitfor(sng_fd_t fd, int timeout, int flags);
 
 /* Get Full TDM API configuration per chan */
-int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
 
 /* Get/Set TDM Codec per chan */
-int sangoma_tdm_set_codec(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int codec);
-int sangoma_tdm_get_codec(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_set_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int codec);
+int sangoma_tdm_get_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
 
 /* Get/Set USR Tx/Rx Period in milliseconds */
-int sangoma_tdm_set_usr_period(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int period);
-int sangoma_tdm_get_usr_period(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_set_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int period);
+int sangoma_tdm_get_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
 
 /* Get user MTU/MRU values in bytes */
-int sangoma_tdm_get_usr_mtu_mru(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_get_usr_mtu_mru(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
 
 /* Not supported yet */
-int sangoma_tdm_set_power_level(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int power);
-int sangoma_tdm_get_power_level(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_set_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int power);
+int sangoma_tdm_get_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
 
 /* Flush buffers from current channel */
-int sangoma_tdm_flush_bufs(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_flush_bufs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
 
-int sangoma_tdm_enable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int poll_in_sec);
-int sangoma_tdm_disable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_enable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int poll_in_sec);
+int sangoma_tdm_disable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
 
-int sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, unsigned char rbs);
+int sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char rbs);
 
-int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
 
 /* DTMF Detection on Octasic chip */
-int sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
-int sangoma_tdm_disable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
+int sangoma_tdm_disable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
 
 /* DTMF Detection on A200 (SLIC) chip */
-int sangoma_tdm_enable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
-int sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_enable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
+int sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
 
 /* On/Off hook events on A200 (Analog) card */
-int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
-int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
+int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
 
-int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
+int sangoma_tdm_cmd_exec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
 
 #ifndef LIBSANGOMA_GET_HWCODING
 #define LIBSANGOMA_GET_HWCODING 1
 #endif
-int sangoma_tdm_get_hw_coding(int fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_get_hw_coding(int fd, wanpipe_tdm_api_t *tdm_api);
 
-#endif /* WANPIPE_TDM_API */
+#endif 	/* WANPIPE_TDM_API */
 
 #endif

Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	Fri Apr 13 10:44:28 2007
@@ -80,8 +80,8 @@
 	char map[SANGOMA_MAX_CHAN_PER_SPAN][SWITCH_UUID_FORMATTED_LENGTH + 1];
 };
 
-unsigned int txseq = 0;
-unsigned int rxseq = 0;
+unsigned int txseq=0;
+unsigned int rxseq=0;
 
 #define SETUP_LEN CORE_MAX_CHAN_PER_SPAN*CORE_MAX_SPANS+1
 
@@ -99,7 +99,7 @@
 
 typedef struct ss7boost_handle ss7boost_handle_t;
 
-static int isup_exec_command(ss7boost_handle_t * ss7boost_handle, int span, int chan, int id, int cmd, int cause);
+static int isup_exec_command(ss7boost_handle_t *ss7boost_handle, int span, int chan, int id, int cmd, int cause);
 
 static struct {
 	int debug;
@@ -210,38 +210,38 @@
 
 
 
-static int local_sangoma_tdm_read_event(sng_fd_t fd, wp_tdm_api_rx_hdr_t * rx_event)
+static int local_sangoma_tdm_read_event(sng_fd_t fd, wp_tdm_api_rx_hdr_t *rx_event)
 {
 	wanpipe_tdm_api_t tdm_api[1];
-
+	
 #if defined(WIN32)
-	rx_event = &last_tdm_api_event_buffer;
+    rx_event = &last_tdm_api_event_buffer;
 #else
-	int err;
+    int err;
 
-	tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_READ_EVENT;
+    tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_READ_EVENT;
 
-	if ((err = sangoma_tdm_cmd_exec(fd, tdm_api))) {
-		return err;
-	}
+    if ((err = sangoma_tdm_cmd_exec(fd, tdm_api))) {
+        return err;
+    }
 
-	rx_event = &tdm_api->wp_tdm_cmd.event;
+    rx_event = &tdm_api->wp_tdm_cmd.event;
 #endif
 
 	return 0;
 }
 
-static int analog_set_state(analog_channel_t * alc, analog_state_t state)
+static int analog_set_state(analog_channel_t *alc, analog_state_t state)
 {
 	alc->state = state;
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Changing State to %d\n", state);
 }
 
-static void analog_check_state(analog_channel_t * alc)
+static void analog_check_state(analog_channel_t *alc)
 {
 	wanpipe_tdm_api_t tdm_api;
 
-	switch (alc->state) {
+	switch(alc->state) {
 	case ANALOG_STATE_DOWN:
 		sangoma_tdm_enable_rxhook_events(alc->sock->fd, &tdm_api);
 		analog_set_state(alc, ANALOG_STATE_ONHOOK);
@@ -251,11 +251,11 @@
 	}
 }
 
-static void analog_parse_event(analog_channel_t * alc)
+static void analog_parse_event(analog_channel_t *alc)
 {
 	wp_tdm_api_rx_hdr_t rx_event;
 	int err = local_sangoma_tdm_read_event(alc->sock->fd, &rx_event);
-
+	
 	if (err < 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error reading event!\n");
 		return;
@@ -269,21 +269,21 @@
 
 }
 
-static void *SWITCH_THREAD_FUNC fxs_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC fxs_thread_run(switch_thread_t *thread, void *obj)
 {
 
-	for (;;) {
+	for(;;) {
 		int i = 0, sel_on = -1;
 		fd_set oob;
 		FD_ZERO(&oob);
-
-		for (i = 0; i < globals.fxs_index; i++) {
+		
+		for(i = 0; i < globals.fxs_index; i++) {
 			int fd;
 			assert(FXS_ANALOG_CHANNELS[i]);
 			assert(FXS_ANALOG_CHANNELS[i]->sock);
 
 			fd = FXS_ANALOG_CHANNELS[i]->sock->fd;
-
+			
 			analog_check_state(FXS_ANALOG_CHANNELS[i]);
 
 			FD_SET(fd, &oob);
@@ -295,7 +295,7 @@
 
 		if (sel_on > -1) {
 			if (select(++sel_on, NULL, NULL, &oob, NULL)) {
-				for (i = 0; i < globals.fxs_index; i++) {
+				for(i = 0; i < globals.fxs_index; i++) {
 					int fd = FXS_ANALOG_CHANNELS[i]->sock->fd;
 					if (FD_ISSET(fd, &oob)) {
 						analog_parse_event(FXS_ANALOG_CHANNELS[i]);
@@ -307,7 +307,7 @@
 }
 
 
-static int wp_close(private_object_t * tech_pvt)
+static int wp_close(private_object_t *tech_pvt)
 {
 	int ret = 0;
 
@@ -317,16 +317,16 @@
 		ret = 1;
 	}
 	switch_mutex_unlock(globals.hash_mutex);
-
+	
 	return ret;
 }
 
-static wpsock_t *wp_open(private_object_t * tech_pvt, int span, int chan)
+static wpsock_t *wp_open(private_object_t *tech_pvt, int span, int chan)
 {
 	sng_fd_t fd;
 	wpsock_t *sock;
 	char name[25];
-
+	
 	snprintf(name, sizeof(name), "s%dc%d", span, chan);
 
 	switch_mutex_lock(globals.hash_mutex);
@@ -364,7 +364,7 @@
 	wpsock_t *sock;
 	sng_fd_t fd;
 	char name[25];
-
+	
 	snprintf(name, sizeof(name), "s%dc%d", span, chan);
 
 	switch_mutex_lock(globals.hash_mutex);
@@ -380,7 +380,7 @@
 		sangoma_socket_close(&fd);
 		return 0;
 	}
-
+	
 	return -1;
 }
 
@@ -444,7 +444,7 @@
 	if (!strcasecmp(dp, "local"))
 		return PRI_LOCAL_ISDN;
 	if (!strcasecmp(dp, "private"))
-		return PRI_PRIVATE;
+		return PRI_PRIVATE;		
 	if (!strcasecmp(dp, "unknown"))
 		return PRI_UNKNOWN;
 
@@ -460,25 +460,26 @@
 static switch_status_t wanpipe_on_hangup(switch_core_session_t *session);
 static switch_status_t wanpipe_on_loopback(switch_core_session_t *session);
 static switch_status_t wanpipe_on_transmit(switch_core_session_t *session);
-static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session,
-													switch_caller_profile_t *outbound_profile,
+static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
 													switch_core_session_t **new_session, switch_memory_pool_t **pool);
-static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id);
-static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id);
-static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
-static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
-static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
+static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
+										switch_io_flag_t flags, int stream_id);
+static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
+										 switch_io_flag_t flags, int stream_id);
+static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
+static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
+static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
 static int check_flags(struct sangoma_pri *spri);
-static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
-static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
-static void *SWITCH_THREAD_FUNC pri_thread_run(switch_thread_t * thread, void *obj);
+static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
+static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
+static void *SWITCH_THREAD_FUNC pri_thread_run(switch_thread_t *thread, void *obj);
 static switch_status_t config_wanpipe(int reload);
 
 
-static switch_status_t wanpipe_codec_init(private_object_t * tech_pvt)
+static switch_status_t wanpipe_codec_init(private_object_t *tech_pvt)
 {
 	int err = 0;
-	wanpipe_tdm_api_t tdm_api = { {0} };
+	wanpipe_tdm_api_t tdm_api = {{0}};
 	unsigned int rate = 8000;
 	switch_channel_t *channel = NULL;
 
@@ -491,21 +492,21 @@
 	assert(channel != NULL);
 
 	err = sangoma_tdm_set_codec(tech_pvt->wpsock->fd, &tdm_api, WP_SLINEAR);
-
+	
 	sangoma_tdm_set_usr_period(tech_pvt->wpsock->fd, &tdm_api, globals.samples_per_frame / 8);
 	tech_pvt->frame_size = sangoma_tdm_get_usr_mtu_mru(tech_pvt->wpsock->fd, &tdm_api);
 
 	if (switch_core_codec_init
-		(&tech_pvt->read_codec, "L16", NULL, rate, globals.samples_per_frame / 8, 1,
-		 SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+		(&tech_pvt->read_codec, "L16", NULL, rate, globals.samples_per_frame / 8, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+		 switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n", switch_channel_get_name(channel));
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		return SWITCH_STATUS_FALSE;
 	}
 
 	if (switch_core_codec_init
-		(&tech_pvt->write_codec, "L16", NULL, rate, globals.samples_per_frame / 8, 1,
-		 SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+		(&tech_pvt->write_codec, "L16", NULL, rate, globals.samples_per_frame / 8, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+		 switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n", switch_channel_get_name(channel));
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		return SWITCH_STATUS_FALSE;
@@ -515,25 +516,25 @@
 	switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
 	switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
 
-#ifdef DOTRACE
-	tech_pvt->fd = open("/tmp/wp-in.raw", O_WRONLY | O_TRUNC | O_CREAT);
-	tech_pvt->fd2 = open("/tmp/wp-out.raw", O_WRONLY | O_TRUNC | O_CREAT);
+#ifdef DOTRACE	
+						tech_pvt->fd = open("/tmp/wp-in.raw", O_WRONLY | O_TRUNC | O_CREAT);
+						tech_pvt->fd2 = open("/tmp/wp-out.raw", O_WRONLY | O_TRUNC | O_CREAT);
 #endif
 
 	/* Setup artificial DTMF stuff */
 	memset(&tech_pvt->tone_session, 0, sizeof(tech_pvt->tone_session));
 	teletone_init_session(&tech_pvt->tone_session, 1024, NULL, NULL);
-
+	
 	if (globals.debug) {
 		tech_pvt->tone_session.debug = globals.debug;
 		tech_pvt->tone_session.debug_stream = stdout;
 	}
-
+	
 	tech_pvt->tone_session.rate = rate;
 	tech_pvt->tone_session.duration = globals.dtmf_on * (tech_pvt->tone_session.rate / 1000);
 	tech_pvt->tone_session.wait = globals.dtmf_off * (tech_pvt->tone_session.rate / 1000);
-
-	teletone_dtmf_detect_init(&tech_pvt->dtmf_detect, rate);
+	
+	teletone_dtmf_detect_init (&tech_pvt->dtmf_detect, rate);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio init %s\n", switch_channel_get_name(channel));
 
 	switch_set_flag(tech_pvt, TFLAG_CODEC);
@@ -562,46 +563,46 @@
 
 	tech_pvt->read_frame.data = tech_pvt->databuf;
 
-	if (tech_pvt->ss7boost_handle) {
+	if (tech_pvt->ss7boost_handle)  {
 		if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
 			ss7boost_client_event_t event;
 
 			event.calling_number_presentation = tech_pvt->boost_pres;
 			event.trunk_group = tech_pvt->boost_trunk_group;
-
+		
 			switch_mutex_lock(tech_pvt->ss7boost_handle->mutex);
 			tech_pvt->setup_index = ++tech_pvt->ss7boost_handle->setup_index;
 			if (tech_pvt->ss7boost_handle->setup_index == SETUP_LEN - 1) {
 				tech_pvt->ss7boost_handle->setup_index = 0;
 			}
 			switch_mutex_unlock(tech_pvt->ss7boost_handle->mutex);
-
+		
 			switch_copy_string(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index],
-							   switch_core_session_get_uuid(session), sizeof(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index]));
-
-
-			ss7boost_client_call_init(&event, tech_pvt->caller_profile->caller_id_number, tech_pvt->caller_profile->destination_number,
-									  tech_pvt->setup_index);
-
+							   switch_core_session_get_uuid(session), 
+							   sizeof(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index]));
+		
+			
+			ss7boost_client_call_init(&event, tech_pvt->caller_profile->caller_id_number, tech_pvt->caller_profile->destination_number, tech_pvt->setup_index);
+			
 			if (ss7boost_client_connection_write(&tech_pvt->ss7boost_handle->mcon, &event) <= 0) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Critical System Error: Failed to tx on ISUP socket [%s]\n", strerror(errno));
 			}
-
+			
 			switch_log_printf(SWITCH_CHAN