[Freeswitch-branches] [commit] r2507 - in freeswitch/branches/james: . conf src src/include src/mod/applications/mod_bridgecall src/mod/applications/mod_commands src/mod/applications/mod_conference src/mod/applications/mod_dptools src/mod/applications/mod_echo src/mod/applications/mod_ivrtest src/mod/applications/mod_playback src/mod/applications/mod_rss src/mod/asr_tts/mod_cepstral src/mod/codecs/mod_amr src/mod/codecs/mod_g711 src/mod/codecs/mod_g723_1 src/mod/codecs/mod_g726 src/mod/codecs/mod_g729 src/mod/codecs/mod_gsm src/mod/codecs/mod_ilbc src/mod/codecs/mod_l16 src/mod/codecs/mod_speex src/mod/dialplans/mod_dialplan_directory src/mod/dialplans/mod_dialplan_xml src/mod/directories/mod_ldap src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_exosip src/mod/endpoints/mod_iax src/mod/endpoints/mod_portaudio src/mod/endpoints/mod_sofia src/mod/endpoints/mod_woomera src/mod/event_handlers/mod_cdr src/mod/event_handlers/mod_event_multicast src/mod/event_handlers/mod_event_socket src/mod/event_handlers/mod_event_test src/mod/event_handlers/mod_xmpp_event src/mod/event_handlers/mod_zeroconf src/mod/formats/mod_sndfile src/mod/languages/mod_perl src/mod/languages/mod_spidermonkey src/mod/loggers/mod_console src/mod/loggers/mod_syslog src/mod/timers/mod_softtimer src/mod/xml_int/mod_xml_rpc

Freeswitch SVN james at freeswitch.org
Tue Sep 5 08:41:33 EDT 2006


Author: james
Date: Tue Sep  5 08:41:27 2006
New Revision: 2507

Added:
   freeswitch/branches/james/src/include/switch_bitpack.h
      - copied unchanged from r2485, /freeswitch/trunk/src/include/switch_bitpack.h
   freeswitch/branches/james/src/mod/codecs/mod_amr/
      - copied from r2485, /freeswitch/trunk/src/mod/codecs/mod_amr/
   freeswitch/branches/james/src/mod/codecs/mod_amr/Makefile
      - copied unchanged from r2485, /freeswitch/trunk/src/mod/codecs/mod_amr/Makefile
   freeswitch/branches/james/src/mod/codecs/mod_amr/mod_amr.c
      - copied unchanged from r2485, /freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c
   freeswitch/branches/james/src/mod/codecs/mod_g723_1/
      - copied from r2485, /freeswitch/trunk/src/mod/codecs/mod_g723_1/
   freeswitch/branches/james/src/mod/codecs/mod_g723_1/Makefile
      - copied unchanged from r2485, /freeswitch/trunk/src/mod/codecs/mod_g723_1/Makefile
   freeswitch/branches/james/src/mod/codecs/mod_g723_1/mod_g723_1.c
      - copied unchanged from r2485, /freeswitch/trunk/src/mod/codecs/mod_g723_1/mod_g723_1.c
   freeswitch/branches/james/src/mod/codecs/mod_g726/
      - copied from r2485, /freeswitch/trunk/src/mod/codecs/mod_g726/
   freeswitch/branches/james/src/mod/codecs/mod_g726/Makefile
      - copied unchanged from r2485, /freeswitch/trunk/src/mod/codecs/mod_g726/Makefile
   freeswitch/branches/james/src/mod/codecs/mod_g726/mod_g726.c
      - copied unchanged from r2485, /freeswitch/trunk/src/mod/codecs/mod_g726/mod_g726.c
   freeswitch/branches/james/src/mod/endpoints/mod_sofia/
      - copied from r2485, /freeswitch/trunk/src/mod/endpoints/mod_sofia/
   freeswitch/branches/james/src/mod/endpoints/mod_sofia/Makefile
      - copied unchanged from r2485, /freeswitch/trunk/src/mod/endpoints/mod_sofia/Makefile
   freeswitch/branches/james/src/mod/endpoints/mod_sofia/mod_sofia.c
      - copied unchanged from r2485, /freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/branches/james/src/mod/endpoints/mod_sofia/mod_sofia.vcproj
      - copied unchanged from r2485, /freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.vcproj
   freeswitch/branches/james/src/mod/formats/mod_sndfile/mod_sndfile.vcproj
      - copied unchanged from r2485, /freeswitch/trunk/src/mod/formats/mod_sndfile/mod_sndfile.vcproj
Removed:
   freeswitch/branches/james/src/mod/formats/mod_sndfile/mod_sndfilel.vcproj
Modified:
   freeswitch/branches/james/AUTHORS
   freeswitch/branches/james/Makefile.in
   freeswitch/branches/james/conf/freeswitch.xml
   freeswitch/branches/james/configure
   freeswitch/branches/james/src/include/switch_core.h
   freeswitch/branches/james/src/include/switch_event.h
   freeswitch/branches/james/src/include/switch_ivr.h
   freeswitch/branches/james/src/include/switch_platform.h
   freeswitch/branches/james/src/include/switch_rtp.h
   freeswitch/branches/james/src/include/switch_types.h
   freeswitch/branches/james/src/include/switch_utils.h
   freeswitch/branches/james/src/mod/applications/mod_bridgecall/mod_bridgecall.c
   freeswitch/branches/james/src/mod/applications/mod_bridgecall/mod_bridgecall.vcproj
   freeswitch/branches/james/src/mod/applications/mod_commands/mod_commands.c
   freeswitch/branches/james/src/mod/applications/mod_commands/mod_commands.vcproj
   freeswitch/branches/james/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/branches/james/src/mod/applications/mod_conference/mod_conference.vcproj
   freeswitch/branches/james/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/branches/james/src/mod/applications/mod_dptools/mod_dptools.vcproj
   freeswitch/branches/james/src/mod/applications/mod_echo/mod_echo.c
   freeswitch/branches/james/src/mod/applications/mod_echo/mod_echo.vcproj
   freeswitch/branches/james/src/mod/applications/mod_ivrtest/mod_ivrtest.vcproj
   freeswitch/branches/james/src/mod/applications/mod_playback/mod_playback.c
   freeswitch/branches/james/src/mod/applications/mod_playback/mod_playback.vcproj
   freeswitch/branches/james/src/mod/applications/mod_rss/mod_rss.vcproj
   freeswitch/branches/james/src/mod/asr_tts/mod_cepstral/mod_cepstral.vcproj
   freeswitch/branches/james/src/mod/codecs/mod_g711/mod_g711.c
   freeswitch/branches/james/src/mod/codecs/mod_g711/mod_g711.vcproj
   freeswitch/branches/james/src/mod/codecs/mod_g729/mod_g729.c
   freeswitch/branches/james/src/mod/codecs/mod_g729/mod_g729.vcproj
   freeswitch/branches/james/src/mod/codecs/mod_gsm/mod_gsm.c
   freeswitch/branches/james/src/mod/codecs/mod_gsm/mod_gsm.vcproj
   freeswitch/branches/james/src/mod/codecs/mod_ilbc/mod_ilbc.vcproj
   freeswitch/branches/james/src/mod/codecs/mod_l16/mod_l16.vcproj
   freeswitch/branches/james/src/mod/codecs/mod_speex/Makefile
   freeswitch/branches/james/src/mod/codecs/mod_speex/mod_speex.c
   freeswitch/branches/james/src/mod/codecs/mod_speex/mod_speex.vcproj
   freeswitch/branches/james/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.vcproj
   freeswitch/branches/james/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.vcproj
   freeswitch/branches/james/src/mod/directories/mod_ldap/mod_ldap.vcproj
   freeswitch/branches/james/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/branches/james/src/mod/endpoints/mod_dingaling/mod_dingaling.vcproj
   freeswitch/branches/james/src/mod/endpoints/mod_exosip/mod_exosip.c
   freeswitch/branches/james/src/mod/endpoints/mod_exosip/mod_exosip.vcproj
   freeswitch/branches/james/src/mod/endpoints/mod_iax/mod_iax.vcproj
   freeswitch/branches/james/src/mod/endpoints/mod_portaudio/mod_PortAudio.vcproj
   freeswitch/branches/james/src/mod/endpoints/mod_woomera/mod_woomera.vcproj
   freeswitch/branches/james/src/mod/event_handlers/mod_cdr/mod_cdr.vcproj
   freeswitch/branches/james/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.vcproj
   freeswitch/branches/james/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
   freeswitch/branches/james/src/mod/event_handlers/mod_event_socket/mod_event_socket.vcproj
   freeswitch/branches/james/src/mod/event_handlers/mod_event_test/mod_event_test.vcproj
   freeswitch/branches/james/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c
   freeswitch/branches/james/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.vcproj
   freeswitch/branches/james/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.vcproj
   freeswitch/branches/james/src/mod/languages/mod_perl/fs_perl.vcproj
   freeswitch/branches/james/src/mod/languages/mod_perl/mod_perl.vcproj
   freeswitch/branches/james/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
   freeswitch/branches/james/src/mod/languages/mod_spidermonkey/mod_spidermonkey.vcproj
   freeswitch/branches/james/src/mod/loggers/mod_console/mod_console.vcproj
   freeswitch/branches/james/src/mod/loggers/mod_syslog/mod_syslog.c
   freeswitch/branches/james/src/mod/timers/mod_softtimer/mod_softtimer.vcproj
   freeswitch/branches/james/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj
   freeswitch/branches/james/src/switch.c
   freeswitch/branches/james/src/switch_event.c

Log:
Update to trunk.


Modified: freeswitch/branches/james/AUTHORS
==============================================================================
--- freeswitch/branches/james/AUTHORS	(original)
+++ freeswitch/branches/james/AUTHORS	Tue Sep  5 08:41:27 2006
@@ -16,9 +16,9 @@
 people who have submitted patches, reported bugs, and generally made Freeswitch
 that much better:
 
- Joshua Colp - For his help making mod_exosip possible, and for just being a swell guy!
  Brian K. West - For countless hours of work on BSD and Mac support, finding countless bugs, 
-  and moral support.
+  and moral support.  Xcode project files.
+ Joshua Colp - For his help making mod_exosip possible, and for just being a swell guy!
  Michal "cypromis" Bielicki (michal.bielicki  AT halo2.pl) - Solaris porting, and autotools enhancements.
  James Martelletti <james at nerdc0re.com> - All around cool guy (mod_syslog)
  Johny Kadarisman <jkr888 at gmail.com>
@@ -27,4 +27,4 @@
 A big THANK YOU goes to:
 
 Justin Cassidy - Build related cleanups and automatic build setup.
-
+Bret McDanel - Javascript Documentation, constant feedback and input, many other things I am sure I am forgetting.

Modified: freeswitch/branches/james/Makefile.in
==============================================================================
--- freeswitch/branches/james/Makefile.in	(original)
+++ freeswitch/branches/james/Makefile.in	Tue Sep  5 08:41:27 2006
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,8 +17,6 @@
 
 
 
-SOURCES = $(libfreeswitch_la_SOURCES) $(nodist_libfreeswitch_la_SOURCES) $(freeswitch_SOURCES)
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -105,11 +103,11 @@
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
 	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
 	$(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
 SOURCES = $(libfreeswitch_la_SOURCES) \
 	$(nodist_libfreeswitch_la_SOURCES) $(freeswitch_SOURCES)
@@ -243,7 +241,7 @@
 EXTRA_DIST = 
 SUBDIRS = 
 AUTOMAKE_OPTS = gnu foreign
-AM_MAKE = `which gmake 2>/dev/null || which make 2>/dev/null || make`
+AM_MAKE = `which gmake 2>/dev/null || which make 2>/dev/null || echo make`
 MAKE = $(AM_MAKE)
 NAME = freeswitch
 PREFIX = $(prefix)
@@ -538,109 +536,109 @@
 @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
 
 libfreeswitch_la-switch_rtp.lo: src/switch_rtp.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_rtp.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_rtp.Tpo" -c -o libfreeswitch_la-switch_rtp.lo `test -f 'src/switch_rtp.c' || echo '$(srcdir)/'`src/switch_rtp.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_rtp.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_rtp.Tpo" -c -o libfreeswitch_la-switch_rtp.lo `test -f 'src/switch_rtp.c' || echo '$(srcdir)/'`src/switch_rtp.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_rtp.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_rtp.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_rtp.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_rtp.c' object='libfreeswitch_la-switch_rtp.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_rtp.lo `test -f 'src/switch_rtp.c' || echo '$(srcdir)/'`src/switch_rtp.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_rtp.lo `test -f 'src/switch_rtp.c' || echo '$(srcdir)/'`src/switch_rtp.c
 
 libfreeswitch_la-switch_buffer.lo: src/switch_buffer.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_buffer.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_buffer.Tpo" -c -o libfreeswitch_la-switch_buffer.lo `test -f 'src/switch_buffer.c' || echo '$(srcdir)/'`src/switch_buffer.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_buffer.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_buffer.Tpo" -c -o libfreeswitch_la-switch_buffer.lo `test -f 'src/switch_buffer.c' || echo '$(srcdir)/'`src/switch_buffer.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_buffer.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_buffer.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_buffer.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_buffer.c' object='libfreeswitch_la-switch_buffer.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_buffer.lo `test -f 'src/switch_buffer.c' || echo '$(srcdir)/'`src/switch_buffer.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_buffer.lo `test -f 'src/switch_buffer.c' || echo '$(srcdir)/'`src/switch_buffer.c
 
 libfreeswitch_la-switch_caller.lo: src/switch_caller.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_caller.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_caller.Tpo" -c -o libfreeswitch_la-switch_caller.lo `test -f 'src/switch_caller.c' || echo '$(srcdir)/'`src/switch_caller.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_caller.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_caller.Tpo" -c -o libfreeswitch_la-switch_caller.lo `test -f 'src/switch_caller.c' || echo '$(srcdir)/'`src/switch_caller.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_caller.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_caller.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_caller.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_caller.c' object='libfreeswitch_la-switch_caller.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_caller.lo `test -f 'src/switch_caller.c' || echo '$(srcdir)/'`src/switch_caller.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_caller.lo `test -f 'src/switch_caller.c' || echo '$(srcdir)/'`src/switch_caller.c
 
 libfreeswitch_la-switch_channel.lo: src/switch_channel.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_channel.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_channel.Tpo" -c -o libfreeswitch_la-switch_channel.lo `test -f 'src/switch_channel.c' || echo '$(srcdir)/'`src/switch_channel.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_channel.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_channel.Tpo" -c -o libfreeswitch_la-switch_channel.lo `test -f 'src/switch_channel.c' || echo '$(srcdir)/'`src/switch_channel.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_channel.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_channel.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_channel.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_channel.c' object='libfreeswitch_la-switch_channel.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_channel.lo `test -f 'src/switch_channel.c' || echo '$(srcdir)/'`src/switch_channel.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_channel.lo `test -f 'src/switch_channel.c' || echo '$(srcdir)/'`src/switch_channel.c
 
 libfreeswitch_la-switch_config.lo: src/switch_config.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_config.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_config.Tpo" -c -o libfreeswitch_la-switch_config.lo `test -f 'src/switch_config.c' || echo '$(srcdir)/'`src/switch_config.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_config.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_config.Tpo" -c -o libfreeswitch_la-switch_config.lo `test -f 'src/switch_config.c' || echo '$(srcdir)/'`src/switch_config.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_config.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_config.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_config.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_config.c' object='libfreeswitch_la-switch_config.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_config.lo `test -f 'src/switch_config.c' || echo '$(srcdir)/'`src/switch_config.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_config.lo `test -f 'src/switch_config.c' || echo '$(srcdir)/'`src/switch_config.c
 
 libfreeswitch_la-switch_console.lo: src/switch_console.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_console.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_console.Tpo" -c -o libfreeswitch_la-switch_console.lo `test -f 'src/switch_console.c' || echo '$(srcdir)/'`src/switch_console.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_console.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_console.Tpo" -c -o libfreeswitch_la-switch_console.lo `test -f 'src/switch_console.c' || echo '$(srcdir)/'`src/switch_console.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_console.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_console.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_console.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_console.c' object='libfreeswitch_la-switch_console.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_console.lo `test -f 'src/switch_console.c' || echo '$(srcdir)/'`src/switch_console.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_console.lo `test -f 'src/switch_console.c' || echo '$(srcdir)/'`src/switch_console.c
 
 libfreeswitch_la-switch_core.lo: src/switch_core.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_core.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_core.Tpo" -c -o libfreeswitch_la-switch_core.lo `test -f 'src/switch_core.c' || echo '$(srcdir)/'`src/switch_core.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_core.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_core.Tpo" -c -o libfreeswitch_la-switch_core.lo `test -f 'src/switch_core.c' || echo '$(srcdir)/'`src/switch_core.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_core.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_core.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_core.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_core.c' object='libfreeswitch_la-switch_core.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_core.lo `test -f 'src/switch_core.c' || echo '$(srcdir)/'`src/switch_core.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_core.lo `test -f 'src/switch_core.c' || echo '$(srcdir)/'`src/switch_core.c
 
 libfreeswitch_la-switch_loadable_module.lo: src/switch_loadable_module.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_loadable_module.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_loadable_module.Tpo" -c -o libfreeswitch_la-switch_loadable_module.lo `test -f 'src/switch_loadable_module.c' || echo '$(srcdir)/'`src/switch_loadable_module.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_loadable_module.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_loadable_module.Tpo" -c -o libfreeswitch_la-switch_loadable_module.lo `test -f 'src/switch_loadable_module.c' || echo '$(srcdir)/'`src/switch_loadable_module.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_loadable_module.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_loadable_module.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_loadable_module.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_loadable_module.c' object='libfreeswitch_la-switch_loadable_module.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_loadable_module.lo `test -f 'src/switch_loadable_module.c' || echo '$(srcdir)/'`src/switch_loadable_module.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_loadable_module.lo `test -f 'src/switch_loadable_module.c' || echo '$(srcdir)/'`src/switch_loadable_module.c
 
 libfreeswitch_la-switch_utils.lo: src/switch_utils.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_utils.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_utils.Tpo" -c -o libfreeswitch_la-switch_utils.lo `test -f 'src/switch_utils.c' || echo '$(srcdir)/'`src/switch_utils.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_utils.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_utils.Tpo" -c -o libfreeswitch_la-switch_utils.lo `test -f 'src/switch_utils.c' || echo '$(srcdir)/'`src/switch_utils.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_utils.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_utils.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_utils.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_utils.c' object='libfreeswitch_la-switch_utils.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_utils.lo `test -f 'src/switch_utils.c' || echo '$(srcdir)/'`src/switch_utils.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_utils.lo `test -f 'src/switch_utils.c' || echo '$(srcdir)/'`src/switch_utils.c
 
 libfreeswitch_la-switch_event.lo: src/switch_event.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_event.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_event.Tpo" -c -o libfreeswitch_la-switch_event.lo `test -f 'src/switch_event.c' || echo '$(srcdir)/'`src/switch_event.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_event.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_event.Tpo" -c -o libfreeswitch_la-switch_event.lo `test -f 'src/switch_event.c' || echo '$(srcdir)/'`src/switch_event.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_event.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_event.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_event.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_event.c' object='libfreeswitch_la-switch_event.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_event.lo `test -f 'src/switch_event.c' || echo '$(srcdir)/'`src/switch_event.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_event.lo `test -f 'src/switch_event.c' || echo '$(srcdir)/'`src/switch_event.c
 
 libfreeswitch_la-switch_resample.lo: src/switch_resample.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_resample.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_resample.Tpo" -c -o libfreeswitch_la-switch_resample.lo `test -f 'src/switch_resample.c' || echo '$(srcdir)/'`src/switch_resample.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_resample.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_resample.Tpo" -c -o libfreeswitch_la-switch_resample.lo `test -f 'src/switch_resample.c' || echo '$(srcdir)/'`src/switch_resample.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_resample.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_resample.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_resample.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_resample.c' object='libfreeswitch_la-switch_resample.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_resample.lo `test -f 'src/switch_resample.c' || echo '$(srcdir)/'`src/switch_resample.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_resample.lo `test -f 'src/switch_resample.c' || echo '$(srcdir)/'`src/switch_resample.c
 
 libfreeswitch_la-switch_ivr.lo: src/switch_ivr.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_ivr.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_ivr.Tpo" -c -o libfreeswitch_la-switch_ivr.lo `test -f 'src/switch_ivr.c' || echo '$(srcdir)/'`src/switch_ivr.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_ivr.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_ivr.Tpo" -c -o libfreeswitch_la-switch_ivr.lo `test -f 'src/switch_ivr.c' || echo '$(srcdir)/'`src/switch_ivr.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_ivr.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_ivr.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_ivr.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_ivr.c' object='libfreeswitch_la-switch_ivr.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_ivr.lo `test -f 'src/switch_ivr.c' || echo '$(srcdir)/'`src/switch_ivr.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_ivr.lo `test -f 'src/switch_ivr.c' || echo '$(srcdir)/'`src/switch_ivr.c
 
 libfreeswitch_la-switch_stun.lo: src/switch_stun.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_stun.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_stun.Tpo" -c -o libfreeswitch_la-switch_stun.lo `test -f 'src/switch_stun.c' || echo '$(srcdir)/'`src/switch_stun.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_stun.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_stun.Tpo" -c -o libfreeswitch_la-switch_stun.lo `test -f 'src/switch_stun.c' || echo '$(srcdir)/'`src/switch_stun.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_stun.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_stun.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_stun.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_stun.c' object='libfreeswitch_la-switch_stun.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_stun.lo `test -f 'src/switch_stun.c' || echo '$(srcdir)/'`src/switch_stun.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_stun.lo `test -f 'src/switch_stun.c' || echo '$(srcdir)/'`src/switch_stun.c
 
 libfreeswitch_la-switch_log.lo: src/switch_log.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_log.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_log.Tpo" -c -o libfreeswitch_la-switch_log.lo `test -f 'src/switch_log.c' || echo '$(srcdir)/'`src/switch_log.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_log.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_log.Tpo" -c -o libfreeswitch_la-switch_log.lo `test -f 'src/switch_log.c' || echo '$(srcdir)/'`src/switch_log.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_log.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_log.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_log.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_log.c' object='libfreeswitch_la-switch_log.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_log.lo `test -f 'src/switch_log.c' || echo '$(srcdir)/'`src/switch_log.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_log.lo `test -f 'src/switch_log.c' || echo '$(srcdir)/'`src/switch_log.c
 
 libfreeswitch_la-switch_xml.lo: src/switch_xml.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_xml.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_xml.Tpo" -c -o libfreeswitch_la-switch_xml.lo `test -f 'src/switch_xml.c' || echo '$(srcdir)/'`src/switch_xml.c; \
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -MT libfreeswitch_la-switch_xml.lo -MD -MP -MF "$(DEPDIR)/libfreeswitch_la-switch_xml.Tpo" -c -o libfreeswitch_la-switch_xml.lo `test -f 'src/switch_xml.c' || echo '$(srcdir)/'`src/switch_xml.c; \
 @am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libfreeswitch_la-switch_xml.Tpo" "$(DEPDIR)/libfreeswitch_la-switch_xml.Plo"; else rm -f "$(DEPDIR)/libfreeswitch_la-switch_xml.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/switch_xml.c' object='libfreeswitch_la-switch_xml.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_xml.lo `test -f 'src/switch_xml.c' || echo '$(srcdir)/'`src/switch_xml.c
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfreeswitch_la_CFLAGS) $(CFLAGS) -c -o libfreeswitch_la-switch_xml.lo `test -f 'src/switch_xml.c' || echo '$(srcdir)/'`src/switch_xml.c
 
 freeswitch-switch.o: src/switch.c
 @am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(freeswitch_CFLAGS) $(CFLAGS) -MT freeswitch-switch.o -MD -MP -MF "$(DEPDIR)/freeswitch-switch.Tpo" -c -o freeswitch-switch.o `test -f 'src/switch.c' || echo '$(srcdir)/'`src/switch.c; \
@@ -690,7 +688,13 @@
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -702,7 +706,7 @@
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -710,7 +714,13 @@
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive:
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	case "$@" in \
 	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -731,7 +741,7 @@
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -1098,6 +1108,7 @@
 	@if [ ! -f $(PWD)/modules.conf ] ; then cp $(PWD)/modules.conf.in $(PWD)/modules.conf ; fi
 	@echo making modules
 	@rm -f build/freeswitch.env
+	@if [ -f $(PWD)/modbuild.env ] ; then cp $(PWD)/modbuild.env build/freeswitch.env ; fi
 	@./build/addenv.sh build/freeswitch.env MAKE "$(MAKE)"
 	@./build/addenv.sh build/freeswitch.env DYLD_LIBRARY_PATH "$(PREFIX)/lib:$DYLD_LIBRARY_PATH"
 	@./build/addenv.sh build/freeswitch.env LD_LIBRARY_PATH "$(PREFIX)/lib:$LD_LIBRARY_PATH"

Modified: freeswitch/branches/james/conf/freeswitch.xml
==============================================================================
--- freeswitch/branches/james/conf/freeswitch.xml	(original)
+++ freeswitch/branches/james/conf/freeswitch.xml	Tue Sep  5 08:41:27 2006
@@ -102,7 +102,28 @@
       <param name="all" value="DEBUG"/>
       </mappings>
     </configuration>
-  
+    <configuration name="sofia.conf" description="sofia Endpoint">
+      <profile name="test">
+        <param name="debug" value="1"/>
+        <param name="rfc2833-pt" value="101"/>
+        <param name="sip-port" value="5060"/>
+        <param name="dialplan" value="XML"/>
+        <param name="dtmf-duration" value="100"/>
+        <param name="codec-prefs" value="PCMU at 20i"/>
+        <param name="codec-ms" value="20"/>
+        <param name="use-rtp-timer" value="true"/>
+        <param name="rtp-ip" value="192.168.1.20"/>
+        <param name="sip-ip" value="192.168.1.20"/>
+        <!-- optional ; -->
+        <!-- <param name="ext-rtp-ip" value="stun:stun.server.com"/>-->
+        <!-- <param name="ext-rtp-ip" value="100.101.102.103"/> -->
+        <!-- VAD choose one (out is a good choice); -->
+        <!-- <param name="vad" value="in"/> -->
+        <!-- <param name="vad" value="out"/> -->
+        <!-- <param name="vad" value="both"/> -->
+        <!--<param name="alias" value="sip:10.0.1.251:5555"/>-->
+      </profile>
+    </configuration>
     <configuration name="syslog.conf" description="Syslog Logger">
     <!-- SYSLOG -->
     <!-- emerg   - system is unusable  -->
@@ -349,9 +370,6 @@
           <param name="caller-id-number" value="8777423583"/>
         </profile>
       </profiles>
-      <rooms>
-        <room name="freeswitch" profile="default"/>
-      </rooms>
     </configuration>
   </section>
   <section name="dialplan" description="Regex/XML Dialplan">
@@ -374,6 +392,12 @@
         </condition>
       </extension>
 
+      <extension name="testmusic">
+        <condition field="destination_number" expression="^1234$">
+          <action application="bridge" data="exosip/1234 at 66.250.68.194"/>
+        </condition>
+      </extension>
+
       <!-- Enter an existing conference -->
       <extension name="1000">
         <condition field="destination_number" expression="^1000$">
@@ -389,10 +413,10 @@
       </extension>
 
       <!-- if the destination is an exact match on the extension name
-      you do not need any regex in the condition -->
+      you do not need any regex in the condition 
       <extension name="999">
         <condition><action application="bridge" data="exosip/888 at 66.250.68.194"/></condition>
-      </extension>
+      </extension>-->
       <!-- extensions starting with 4, all the numbers after 4 form a numeric filename
            continue=true means keep looking for more extensions to match
            *NOTE* The entire dialplan is parsed ONCE when the call starts 

Modified: freeswitch/branches/james/configure
==============================================================================
--- freeswitch/branches/james/configure	(original)
+++ freeswitch/branches/james/configure	Tue Sep  5 08:41:27 2006
@@ -280,15 +280,15 @@
 
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
-if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
 if test -z "$ECHO"; then
 if test "X${echo_test_string+set}" != Xset; then
 # find a string as large as possible, as long as the shell can cope with it
   for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
     # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
-       echo_test_string="`eval $cmd`" &&
+    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+       echo_test_string=`eval $cmd` &&
        (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
     then
       break
@@ -3358,7 +3358,7 @@
 # Add /usr/xpg4/bin/sed as it is typically found on Solaris
 # along with /bin/sed that truncates output.
 for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
-  test ! -f $lt_ac_sed && break
+  test ! -f $lt_ac_sed && continue
   cat /dev/null > conftest.in
   lt_ac_count=0
   echo $ECHO_N "0123456789$ECHO_C" >conftest.in
@@ -3383,10 +3383,10 @@
     fi
   done
 done
-SED=$lt_cv_path_SED
 
 fi
 
+SED=$lt_cv_path_SED
 echo "$as_me:$LINENO: result: $SED" >&5
 echo "${ECHO_T}$SED" >&6
 
@@ -3463,7 +3463,7 @@
     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
       lt_cv_path_LD="$ac_dir/$ac_prog"
       # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some GNU ld's only accept -v.
+      # but apparently some variants of GNU ld only accept -v.
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
       *GNU* | *'with BFD'*)
@@ -3497,7 +3497,7 @@
 if test "${lt_cv_prog_gnu_ld+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
 case `$LD -v 2>&1 </dev/null` in
 *GNU* | *'with BFD'*)
   lt_cv_prog_gnu_ld=yes
@@ -3527,6 +3527,15 @@
 *) reload_flag=" $reload_flag" ;;
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
 
 echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6
@@ -3613,7 +3622,7 @@
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-bsdi4*)
+bsdi[45]*)
   lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
   lt_cv_file_magic_cmd='/usr/bin/file -L'
   lt_cv_file_magic_test_file=/shlib/libc.so
@@ -3636,13 +3645,13 @@
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-freebsd* | kfreebsd*-gnu)
+freebsd* | kfreebsd*-gnu | dragonfly*)
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
     case $host_cpu in
     i*86 )
       # Not sure whether the presence of OpenBSD here was a mistake.
       # Let's accept both of them until this is cleared up.
-      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
       lt_cv_file_magic_cmd=/usr/bin/file
       lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
       ;;
@@ -3658,7 +3667,7 @@
 
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
-  case "$host_cpu" in
+  case $host_cpu in
   ia64*)
     lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
@@ -3686,15 +3695,6 @@
 
 # This must be Linux ELF.
 linux*)
-  case $host_cpu in
-  alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*)
-    lt_cv_deplibs_check_method=pass_all ;;
-  *)
-    # glibc up to 2.1.1 does not perform some relocations on ARM
-    # this will be overridden with pass_all, but let us keep it just in case
-    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
-  esac
-  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -3717,12 +3717,10 @@
   ;;
 
 openbsd*)
-  lt_cv_file_magic_cmd=/usr/bin/file
-  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
   if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
   else
-    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
   fi
   ;;
 
@@ -3815,7 +3813,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 3818 "configure"' > conftest.$ac_ext
+  echo '#line 3816 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -3858,7 +3856,7 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-    case "`/usr/bin/file conftest.o`" in
+    case `/usr/bin/file conftest.o` in
     *32-bit*)
       case $host in
         x86_64-*linux*)
@@ -5064,7 +5062,12 @@
 fi
 
 
-ac_ext=cc
+
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  ac_ext=cc
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -5294,7 +5297,9 @@
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
+fi
 
+
 ac_ext=f
 ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
 ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -5387,7 +5392,7 @@
 
 
 # Provide some information about the compiler.
-echo "$as_me:5390:" \
+echo "$as_me:5395:" \
      "checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -5577,11 +5582,38 @@
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
- *)
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  *)
     # If test is not a shell built-in, we'll probably end up computing a
     # maximum length that is only half of the actual maximum length, but
     # we can't tell.
-    while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+    SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+    while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
 	       = "XX$teststring") >/dev/null 2>&1 &&
 	    new_result=`expr "X$teststring" : ".*" 2>&1` &&
 	    lt_cv_sys_max_cmd_len=$new_result &&
@@ -5627,9 +5659,6 @@
 # Regexp to match symbols that can be accessed directly from C.
 sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
 
-# Transform the above into a raw symbol and a C symbol.
-symxfrm='\1 \2\3 \3'
-
 # Transform an extracted symbol line into a proper C declaration
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
 
@@ -5651,6 +5680,13 @@
   lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
   lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
   ;;
+linux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDGIRSTW]'
+    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
+  fi
+  ;;
 irix* | nonstopux*)
   symcode='[BCDEGRST]'
   ;;
@@ -5682,8 +5718,11 @@
 # Try without a prefix undercore, then with it.
 for ac_symprfx in "" "_"; do
 
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
   # Write the raw and C identifiers.
-  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -5845,7 +5884,7 @@
 
 # Sed substitution that helps us do robust quoting.  It backslashifies
 # metacharacters that are still active within double-quoted strings.
-Xsed='sed -e s/^X//'
+Xsed='sed -e 1s/^X//'
 sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
 
 # Same as above, but do not quote variable references.
@@ -5865,7 +5904,7 @@
 default_ofile=libtool
 can_build_shared=yes
 
-# All known linkers require a `.a' archive for static linking (except M$VC,
+# All known linkers require a `.a' archive for static linking (except MSVC,
 # which needs '.lib').
 libext=a
 ltmain="$ac_aux_dir/ltmain.sh"
@@ -6150,6 +6189,17 @@
   old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
 
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
 # Only perform the check for file, if the check method requires it
 case $deplibs_check_method in
 file_magic*)
@@ -6175,7 +6225,7 @@
       if test -n "$file_magic_test_file"; then
 	case $deplibs_check_method in
 	"file_magic "*)
-	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
 	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
 	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
 	    $EGREP "$file_magic_regex" > /dev/null; then
@@ -6237,7 +6287,7 @@
       if test -n "$file_magic_test_file"; then
 	case $deplibs_check_method in
 	"file_magic "*)
-	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
 	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
 	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
 	    $EGREP "$file_magic_regex" > /dev/null; then
@@ -6336,6 +6386,20 @@
 compiler=$CC
 
 
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
 #
 # Check for any special shared library compilation flags.
 #
@@ -6372,11 +6436,16 @@
    LDFLAGS="$LDFLAGS $lt_prog_compiler_static"
    printf "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The compiler can only warn and ignore the option if not recognized
+     # The linker can only warn and ignore the option if not recognized
      # So say no if there are warnings
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&5
+       $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp
+       $SED '/^$/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_prog_compiler_static_works=yes
+       fi
      else
        lt_prog_compiler_static_works=yes
      fi
@@ -6418,18 +6487,20 @@
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    # The option is referenced via a variable to avoid confusing sed.
    lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6424: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6493: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6428: \$? = $ac_status" >&5
+   echo "$as_me:6497: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test ! -s conftest.err; then
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp
+     $SED '/^$/d' conftest.err >conftest.er2
+     if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_rtti_exceptions=yes
      fi
    fi
@@ -6506,7 +6577,7 @@
     hpux*)
       # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
       # not for PA HP-UX.
-      case "$host_cpu" in
+      case $host_cpu in
       hppa*64*|ia64*)
 	# +Z the default
 	;;
@@ -6532,6 +6603,16 @@
 	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
       fi
       ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic='-qnocommon'
+         lt_prog_compiler_wl='-Wl,'
+         ;;
+       esac
+       ;;
 
     mingw* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
@@ -6543,7 +6624,7 @@
       lt_prog_compiler_wl='-Wl,'
       # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
       # not for PA HP-UX.
-      case "$host_cpu" in
+      case $host_cpu in
       hppa*64*|ia64*)
 	# +Z the default
 	;;
@@ -6567,12 +6648,19 @@
       ;;
 
     linux*)
-      case $CC in
+      case $cc_basename in
       icc* | ecc*)
 	lt_prog_compiler_wl='-Wl,'
 	lt_prog_compiler_pic='-KPIC'
 	lt_prog_compiler_static='-static'
         ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fpic'
+	lt_prog_compiler_static='-Bstatic'
+        ;;
       ccc*)
         lt_prog_compiler_wl='-Wl,'
         # All Alpha code is PIC.
@@ -6593,9 +6681,14 @@
       ;;
 
     solaris*)
-      lt_prog_compiler_wl='-Wl,'
       lt_prog_compiler_pic='-KPIC'
       lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl='-Wl,';;
+      esac
       ;;
 
     sunos4*)
@@ -6617,6 +6710,11 @@
       fi
       ;;
 
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
     uts4*)
       lt_prog_compiler_pic='-pic'
       lt_prog_compiler_static='-Bstatic'
@@ -6651,18 +6749,20 @@
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    # The option is referenced via a variable to avoid confusing sed.
    lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6657: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6755: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6661: \$? = $ac_status" >&5
+   echo "$as_me:6759: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test ! -s conftest.err; then
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp
+     $SED '/^$/d' conftest.err >conftest.er2
+     if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then
        lt_prog_compiler_pic_works=yes
      fi
    fi
@@ -6683,7 +6783,7 @@
 fi
 
 fi
-case "$host_os" in
+case $host_os in
   # For platforms which do not support PIC, -DPIC is meaningless:
   *djgpp*)
     lt_prog_compiler_pic=
@@ -6711,23 +6811,25 @@
    # Note that $ac_compile itself does not contain backslashes and begins
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6717: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6817: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:6721: \$? = $ac_status" >&5
+   echo "$as_me:6821: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     if test ! -s out/conftest.err; then
+     $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp
+     $SED '/^$/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
      fi
    fi
-   chmod u+w .
+   chmod u+w . 2>&5
    $rm conftest*
    # SGI C++ compiler will create directory out/ii_files/ for
    # template instantiation
@@ -6803,6 +6905,16 @@
   # rely on this symbol name, it's probably fine to never include it in
   # preloaded symbol tables.
   extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
   case $host_os in
   cygwin* | mingw* | pw32*)
@@ -6823,6 +6935,27 @@
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
     # See if GNU ld supports shared libraries.
     case $host_os in
     aix3* | aix4* | aix5*)
@@ -6873,7 +7006,7 @@
       allow_undefined_flag=unsupported
       always_export_symbols=no
       enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
 
       if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
         archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
@@ -6891,6 +7024,37 @@
       fi
       ;;
 
+    linux*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
     netbsd*)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
@@ -6929,31 +7093,6 @@
       hardcode_shlibpath_var=no
       ;;
 
-  linux*)
-    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-        tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_cmds="$tmp_archive_cmds"
-      supports_anon_versioning=no
-      case `$LD -v 2>/dev/null` in
-        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
-        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-        *\ 2.11.*) ;; # other 2.11 versions
-        *) supports_anon_versioning=yes ;;
-      esac
-      if test $supports_anon_versioning = yes; then
-        archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
-cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-$echo "local: *; };" >> $output_objdir/$libname.ver~
-        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-      else
-        archive_expsym_cmds="$tmp_archive_cmds"
-      fi
-    else
-      ld_shlibs=no
-    fi
-    ;;
-
     *)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
@@ -6964,16 +7103,11 @@
       ;;
     esac
 
-    if test "$ld_shlibs" = yes; then
-      runpath_var=LD_RUN_PATH
-      hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
-      export_dynamic_flag_spec='${wl}--export-dynamic'
-      # ancient GNU ld didn't support --whole-archive et. al.
-      if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
- 	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      else
-  	whole_archive_flag_spec=
-      fi
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
     fi
   else
     # PORTME fill in a description of your system's linker (not GNU ld)
@@ -7037,7 +7171,7 @@
       link_all_deplibs=yes
 
       if test "$GCC" = yes; then
-	case $host_os in aix4.012|aix4.012.*)
+	case $host_os in aix4.[012]|aix4.[012].*)
 	# We only want to do this on AIX 4.2 and lower, the check
 	# below for broken collect2 doesn't work under 4.3+
 	  collect2name=`${CC} -print-prog-name=collect2`
@@ -7058,6 +7192,9 @@
 	  fi
 	esac
 	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
       else
 	# not using gcc
 	if test "$host_cpu" = ia64; then
@@ -7204,7 +7341,7 @@
 	  # Exported symbols can be pulled into shared objects from archives
 	  whole_archive_flag_spec=' '
 	  archive_cmds_need_lc=yes
-	  # This is similar to how AIX traditionally builds it's shared libraries.
+	  # This is similar to how AIX traditionally builds its shared libraries.
 	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
 	fi
       fi
@@ -7218,7 +7355,7 @@
       ld_shlibs=no
       ;;
 
-    bsdi4*)
+    bsdi[45]*)
       export_dynamic_flag_spec=-rdynamic
       ;;
 
@@ -7244,52 +7381,52 @@
       ;;
 
     darwin* | rhapsody*)
-    if test "$GXX" = yes ; then
-      archive_cmds_need_lc=no
-      case "$host_os" in
-      rhapsody* | darwin1.[012])
-	allow_undefined_flag='-undefined suppress'
-	;;
-      *) # Darwin 1.3 on
-      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-      	allow_undefined_flag='-flat_namespace -undefined suppress'
-      else
-        case ${MACOSX_DEPLOYMENT_TARGET} in
-          10.[012])
-            allow_undefined_flag='-flat_namespace -undefined suppress'
-            ;;
-          10.*)
-            allow_undefined_flag='-undefined dynamic_lookup'
-            ;;
-        esac
-      fi
-	;;
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
       esac
-    	lt_int_apple_cc_single_mod=no
-    	output_verbose_link_cmd='echo'
-    	if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
-    	  lt_int_apple_cc_single_mod=yes
-    	fi
-    	if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-    	  archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-    	else
-        archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-      fi
-      module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
-        if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-          archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-        else
-          archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-        fi
-          module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      archive_cmds_need_lc=no
       hardcode_direct=no
       hardcode_automatic=yes
       hardcode_shlibpath_var=unsupported
-      whole_archive_flag_spec='-all_load $convenience'
+      whole_archive_flag_spec=''
       link_all_deplibs=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
     else
-      ld_shlibs=no
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs=no
+          ;;
+      esac
     fi
       ;;
 
@@ -7323,7 +7460,7 @@
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | kfreebsd*-gnu)
+    freebsd* | kfreebsd*-gnu | dragonfly*)
       archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
@@ -7348,7 +7485,7 @@
 
     hpux10* | hpux11*)
       if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	case "$host_cpu" in
+	case $host_cpu in
 	hppa*64*|ia64*)
 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
@@ -7357,7 +7494,7 @@
 	  ;;
 	esac
       else
-	case "$host_cpu" in
+	case $host_cpu in
 	hppa*64*|ia64*)
 	  archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
 	  ;;
@@ -7367,7 +7504,7 @@
 	esac
       fi
       if test "$with_gnu_ld" = no; then
-	case "$host_cpu" in
+	case $host_cpu in
 	hppa*64*)
 	  hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
 	  hardcode_libdir_flag_spec_ld='+b $libdir'
@@ -7434,6 +7571,7 @@
       hardcode_shlibpath_var=no
       if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
 	archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
 	hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
 	export_dynamic_flag_spec='${wl}-E'
       else
@@ -7479,7 +7617,7 @@
 	allow_undefined_flag=' -expect_unresolved \*'
 	archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
 	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
-	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	hardcode_libdir_flag_spec='-rpath $libdir'
@@ -7498,10 +7636,12 @@
     solaris*)
       no_undefined_flag=' -z text'
       if test "$GCC" = yes; then
+	wlarc='${wl}'
 	archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
 	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
       else
+	wlarc=''
 	archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
 	archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
   	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
@@ -7510,8 +7650,18 @@
       hardcode_shlibpath_var=no
       case $host_os in
       solaris2.[0-5] | solaris2.[0-5].*) ;;
-      *) # Supported since Solaris 2.6 (maybe 2.5.1?)
-	whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+      *)
+ 	# The compiler driver will combine linker options so we
+ 	# cannot just pass the convience library names through
+ 	# without $wl, iff we do not link with $LD.
+ 	# Luckily, gcc supports the same syntax we need for Sun Studio.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+ 	case $wlarc in
+ 	'')
+ 	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+ 	*)
+ 	  whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+ 	esac ;;
       esac
       link_all_deplibs=yes
       ;;
@@ -7785,7 +7935,7 @@
   shlibpath_var=LIBRARY_PATH
   ;;
 
-bsdi4*)
+bsdi[45]*)
   version_type=linux
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -7813,7 +7963,8 @@
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname'
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $rm \$dlpath'
@@ -7843,7 +7994,7 @@
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
     ;;
@@ -7866,7 +8017,7 @@
   soname_spec='${libname}${release}${major}$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
   # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
   if test "$GCC" = yes; then
     sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
@@ -7901,8 +8052,17 @@
   dynamic_linker='GNU ld.so'
   ;;
 
-freebsd*)
-  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
   version_type=freebsd-$objformat
   case $version_type in
     freebsd-elf*)
@@ -7920,7 +8080,7 @@
   freebsd2*)
     shlibpath_overrides_runpath=yes
     ;;
-  freebsd3.01* | freebsdelf3.01*)
+  freebsd3.[01]* | freebsdelf3.[01]*)
     shlibpath_overrides_runpath=yes
     hardcode_into_libs=yes
     ;;
@@ -7947,7 +8107,7 @@
   version_type=sunos
   need_lib_prefix=no
   need_version=no
-  case "$host_cpu" in
+  case $host_cpu in
   ia64*)
     shrext_cmds='.so'
     hardcode_into_libs=yes
@@ -8044,31 +8204,10 @@
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # find out which ABI we are using
-  libsuff=
-  case "$host_cpu" in
-  x86_64*|s390x*|powerpc64*)
-    echo '#line 8051 "configure"' > conftest.$ac_ext
-    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-      case `/usr/bin/file conftest.$ac_objext` in
-      *64-bit*)
-        libsuff=64
-        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
-        ;;
-      esac
-    fi
-    rm -rf conftest*
-    ;;
-  esac
-
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -8130,7 +8269,11 @@
 openbsd*)
   version_type=sunos
   need_lib_prefix=no
-  need_version=yes
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
   shlibpath_var=LD_LIBRARY_PATH
@@ -8252,8 +8395,8 @@
 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
 hardcode_action=
 if test -n "$hardcode_libdir_flag_spec" || \
-   test -n "$runpath_var " || \
-   test "X$hardcode_automatic"="Xyes" ; then
+   test -n "$runpath_var" || \
+   test "X$hardcode_automatic" = "Xyes" ; then
 
   # We can hardcode non-existant directories.
   if test "$hardcode_direct" != no &&
@@ -8919,7 +9062,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 8922 "configure"
+#line 9065 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -8985,7 +9128,7 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) 2>/dev/null
+    (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
       x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
@@ -9017,7 +9160,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9020 "configure"
+#line 9163 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -9083,7 +9226,7 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) 2>/dev/null
+    (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
       x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
@@ -9133,7 +9276,7 @@
 
 # On AIX, shared libraries and static libraries use the same namespace, and
 # are all built from PIC.
-case "$host_os" in
+case $host_os in
 aix3*)
   test "$enable_shared" = yes && enable_static=no
   if test -n "$RANLIB"; then
@@ -9146,43 +9289,6 @@
   if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
     test "$enable_shared" = yes && enable_static=no
   fi
-  ;;
-  darwin* | rhapsody*)
-  if test "$GCC" = yes; then
-    archive_cmds_need_lc=no
-    case "$host_os" in
-    rhapsody* | darwin1.[012])
-      allow_undefined_flag='-undefined suppress'
-      ;;
-    *) # Darwin 1.3 on
-      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-      	allow_undefined_flag='-flat_namespace -undefined suppress'
-      else
-        case ${MACOSX_DEPLOYMENT_TARGET} in
-          10.[012])
-            allow_undefined_flag='-flat_namespace -undefined suppress'
-            ;;
-          10.*)
-            allow_undefined_flag='-undefined dynamic_lookup'
-            ;;
-        esac
-      fi
-      ;;
-    esac
-    output_verbose_link_cmd='echo'
-    archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring'
-    module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-    # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
-    archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag  -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-    module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-    hardcode_direct=no
-    hardcode_automatic=yes
-    hardcode_shlibpath_var=unsupported
-    whole_archive_flag_spec='-all_load $convenience'
-    link_all_deplibs=yes
-  else
-    ld_shlibs=no
-  fi
     ;;
 esac
 echo "$as_me:$LINENO: result: $enable_shared" >&5
@@ -9312,7 +9418,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -9323,11 +9429,11 @@
 SED=$lt_SED
 
 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="$SED -e s/^X//"
+Xsed="$SED -e 1s/^X//"
 
 # The HP-UX ksh and POSIX shell print the target directory to stdout
 # if CDPATH is set.
-if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
 # The names of the tagged configurations supported by this script.
 available_tags=
@@ -9357,7 +9463,13 @@
 # The host system.
 host_alias=$host_alias
 host=$host
+host_os=$host_os
 
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
 # An echo program that does not interpret backslashes.
 echo=$lt_echo
 
@@ -9433,7 +9545,7 @@
 # Does compiler simultaneously support -c and -o options?
 compiler_c_o=$lt_lt_cv_prog_compiler_c_o
 
-# Must we lock files when doing compilation ?
+# Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
 # Do we need the lib prefix for modules?
@@ -9728,7 +9840,9 @@
 
       case $tagname in
       CXX)
-	if test -n "$CXX" && test "X$CXX" != "Xno"; then
+	if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+	    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+	    (test "X$CXX" != "Xg++"))) ; then
 	  ac_ext=cc
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -9765,7 +9879,7 @@
 compiler_lib_search_path_CXX=
 
 # Source file extension for C++ test sources.
-ac_ext=cc
+ac_ext=cpp
 
 # Object file extension for compiled C++ test sources.
 objext=o
@@ -9786,6 +9900,20 @@
 compiler=$CC
 
 
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
 # Allow CC to be a program name with arguments.
 lt_save_CC=$CC
 lt_save_LD=$LD
@@ -9807,8 +9935,17 @@
 CC=${CXX-"c++"}
 compiler=$CC
 compiler_CXX=$CC
-cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
+
 # We don't want -fno-exception wen compiling C++ code, so set the
 # no_builtin_flag separately
 if test "$GXX" = yes; then
@@ -9878,7 +10015,7 @@
     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
       lt_cv_path_LD="$ac_dir/$ac_prog"
       # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some GNU ld's only accept -v.
+      # but apparently some variants of GNU ld only accept -v.
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
       *GNU* | *'with BFD'*)
@@ -9912,7 +10049,7 @@
 if test "${lt_cv_prog_gnu_ld+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
 case `$LD -v 2>&1 </dev/null` in
 *GNU* | *'with BFD'*)
   lt_cv_prog_gnu_ld=yes
@@ -10021,7 +10158,7 @@
     link_all_deplibs_CXX=yes
 
     if test "$GXX" = yes; then
-      case $host_os in aix4.012|aix4.012.*)
+      case $host_os in aix4.[012]|aix4.[012].*)
       # We only want to do this on AIX 4.2 and lower, the check
       # below for broken collect2 doesn't work under 4.3+
 	collect2name=`${CC} -print-prog-name=collect2`
@@ -10042,6 +10179,9 @@
 	fi
       esac
       shared_flag='-shared'
+      if test "$aix_use_runtimelinking" = yes; then
+	shared_flag="$shared_flag "'${wl}-G'
+      fi
     else
       # not using gcc
       if test "$host_cpu" = ia64; then
@@ -10189,7 +10329,7 @@
 	# Exported symbols can be pulled into shared objects from archives
 	whole_archive_flag_spec_CXX=' '
 	archive_cmds_need_lc_CXX=yes
-	# This is similar to how AIX traditionally builds it's shared libraries.
+	# This is similar to how AIX traditionally builds its shared libraries.
 	archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
       fi
     fi
@@ -10203,6 +10343,7 @@
     esac
     ;;
 
+
   cygwin* | mingw* | pw32*)
     # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
     # as there is no search path for DLLs.
@@ -10226,65 +10367,76 @@
       ld_shlibs_CXX=no
     fi
   ;;
+      darwin* | rhapsody*)
+        case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
+        esac
+      archive_cmds_need_lc_CXX=no
+      hardcode_direct_CXX=no
+      hardcode_automatic_CXX=yes
+      hardcode_shlibpath_var_CXX=unsupported
+      whole_archive_flag_spec_CXX=''
+      link_all_deplibs_CXX=yes
 
-  darwin* | rhapsody*)
-  if test "$GXX" = yes; then
-    archive_cmds_need_lc_CXX=no
-    case "$host_os" in
-    rhapsody* | darwin1.[012])
-      allow_undefined_flag_CXX='-undefined suppress'
-      ;;
-    *) # Darwin 1.3 on
-      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-      	allow_undefined_flag_CXX='-flat_namespace -undefined suppress'
+    if test "$GXX" = yes ; then
+      lt_int_apple_cc_single_mod=no
+      output_verbose_link_cmd='echo'
+      if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+       lt_int_apple_cc_single_mod=yes
+      fi
+      if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+       archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
       else
-        case ${MACOSX_DEPLOYMENT_TARGET} in
-          10.[012])
-            allow_undefined_flag_CXX='-flat_namespace -undefined suppress'
-            ;;
-          10.*)
-            allow_undefined_flag_CXX='-undefined dynamic_lookup'
-            ;;
-        esac
+          archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+        fi
+        module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+        # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+            archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          else
+            archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          fi
+            module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      else
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+          archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+          module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+          archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_CXX=no
+          ;;
+      esac
       fi
-      ;;
-    esac
-    lt_int_apple_cc_single_mod=no
-    output_verbose_link_cmd='echo'
-    if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
-      lt_int_apple_cc_single_mod=yes
-    fi
-    if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-      archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-    else
-      archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-    fi
-    module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+        ;;
 
-    # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
-    if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-      archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-    else
-      archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-    fi
-    module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-    hardcode_direct_CXX=no
-    hardcode_automatic_CXX=yes
-    hardcode_shlibpath_var_CXX=unsupported
-    whole_archive_flag_spec_CXX='-all_load $convenience'
-    link_all_deplibs_CXX=yes
-  else
-    ld_shlibs_CXX=no
-  fi
-    ;;
-
   dgux*)
     case $cc_basename in
-      ec++)
+      ec++*)
 	# FIXME: insert proper C++ library support
 	ld_shlibs_CXX=no
 	;;
-      ghcx)
+      ghcx*)
 	# Green Hills C++ Compiler
 	# FIXME: insert proper C++ library support
 	ld_shlibs_CXX=no
@@ -10295,14 +10447,14 @@
 	;;
     esac
     ;;
-  freebsd12*)
+  freebsd[12]*)
     # C++ shared libraries reported to be fairly broken before switch to ELF
     ld_shlibs_CXX=no
     ;;
   freebsd-elf*)
     archive_cmds_need_lc_CXX=no
     ;;
-  freebsd* | kfreebsd*-gnu)
+  freebsd* | kfreebsd*-gnu | dragonfly*)
     # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
     # conventions
     ld_shlibs_CXX=yes
@@ -10319,11 +10471,11 @@
 				# location of the library.
 
     case $cc_basename in
-    CC)
+    CC*)
       # FIXME: insert proper C++ library support
       ld_shlibs_CXX=no
       ;;
-    aCC)
+    aCC*)
       archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       # Commands to make compiler produce verbose output that lists
       # what "hidden" libraries, object files and flags are used when
@@ -10333,7 +10485,7 @@
       # explicitly linking system object files so we need to strip them
       # from the output so that they don't get included in the library
       # dependencies.
-      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
       ;;
     *)
       if test "$GXX" = yes; then
@@ -10347,7 +10499,7 @@
     ;;
   hpux10*|hpux11*)
     if test $with_gnu_ld = no; then
-      case "$host_cpu" in
+      case $host_cpu in
       hppa*64*)
 	hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
 	hardcode_libdir_flag_spec_ld_CXX='+b $libdir'
@@ -10363,7 +10515,7 @@
         ;;
       esac
     fi
-    case "$host_cpu" in
+    case $host_cpu in
     hppa*64*)
       hardcode_direct_CXX=no
       hardcode_shlibpath_var_CXX=no
@@ -10384,12 +10536,12 @@
     esac
 
     case $cc_basename in
-      CC)
+      CC*)
 	# FIXME: insert proper C++ library support
 	ld_shlibs_CXX=no
 	;;
-      aCC)
-	case "$host_cpu" in
+      aCC*)
+	case $host_cpu in
 	hppa*64*|ia64*)
 	  archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
 	  ;;
@@ -10410,7 +10562,7 @@
       *)
 	if test "$GXX" = yes; then
 	  if test $with_gnu_ld = no; then
-	    case "$host_cpu" in
+	    case $host_cpu in
 	    ia64*|hppa*64*)
 	      archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs'
 	      ;;
@@ -10428,9 +10580,9 @@
     ;;
   irix5* | irix6*)
     case $cc_basename in
-      CC)
+      CC*)
 	# SGI C++
-	archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+	archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
 
 	# Archives containing C++ object files must be created using
 	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
@@ -10441,7 +10593,7 @@
       *)
 	if test "$GXX" = yes; then
 	  if test "$with_gnu_ld" = no; then
-	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	  else
 	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
 	  fi
@@ -10454,7 +10606,7 @@
     ;;
   linux*)
     case $cc_basename in
-      KCC)
+      KCC*)
 	# Kuck and Associates, Inc. (KAI) C++ Compiler
 
 	# KCC will only create a shared library if the output file
@@ -10479,17 +10631,41 @@
 	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
 	old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
 	;;
-      icpc)
+      icpc*)
 	# Intel C++
 	with_gnu_ld=yes
+	# version 8.0 and above of icpc choke on multiply defined symbols
+	# if we add $predep_objects and $postdep_objects, however 7.1 and
+	# earlier do not add the objects themselves.
+	case `$CC -V 2>&1` in
+	*"Version 7."*)
+  	  archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+  	  archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	*)  # Version 8.0 or newer
+	  tmp_idyn=
+	  case $host_cpu in
+	    ia64*) tmp_idyn=' -i_dynamic';;
+	  esac
+  	  archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	  archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  ;;
+	esac
 	archive_cmds_need_lc_CXX=no
-	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
 	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
 	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
 	whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
 	;;
-      cxx)
+      pgCC*)
+        # Portland Group C++ compiler
+	archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+  	archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+	hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+        ;;
+      cxx*)
 	# Compaq C++
 	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
 	archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
@@ -10520,7 +10696,7 @@
     ;;
   mvs*)
     case $cc_basename in
-      cxx)
+      cxx*)
 	# FIXME: insert proper C++ library support
 	ld_shlibs_CXX=no
 	;;
@@ -10541,9 +10717,25 @@
     # Workaround some broken pre-1.5 toolchains
     output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
     ;;
+  openbsd2*)
+    # C++ shared libraries are fairly broken
+    ld_shlibs_CXX=no
+    ;;
+  openbsd*)
+    hardcode_direct_CXX=yes
+    hardcode_shlibpath_var_CXX=no
+    archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+      archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+      export_dynamic_flag_spec_CXX='${wl}-E'
+      whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    fi
+    output_verbose_link_cmd='echo'
+    ;;
   osf3*)
     case $cc_basename in
-      KCC)
+      KCC*)
 	# Kuck and Associates, Inc. (KAI) C++ Compiler
 
 	# KCC will only create a shared library if the output file
@@ -10559,14 +10751,14 @@
 	old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
 
 	;;
-      RCC)
+      RCC*)
 	# Rational C++ 2.4.1
 	# FIXME: insert proper C++ library support
 	ld_shlibs_CXX=no
 	;;
-      cxx)
+      cxx*)
 	allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
 
 	hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
 	hardcode_libdir_separator_CXX=:
@@ -10584,7 +10776,7 @@
       *)
 	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
 	  allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
-	  archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+	  archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 
 	  hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
 	  hardcode_libdir_separator_CXX=:
@@ -10603,7 +10795,7 @@
     ;;
   osf4* | osf5*)
     case $cc_basename in
-      KCC)
+      KCC*)
 	# Kuck and Associates, Inc. (KAI) C++ Compiler
 
 	# KCC will only create a shared library if the output file
@@ -10618,17 +10810,17 @@
 	# the KAI C++ compiler.
 	old_archive_cmds_CXX='$CC -o $oldlib $oldobjs'
 	;;
-      RCC)
+      RCC*)
 	# Rational C++ 2.4.1
 	# FIXME: insert proper C++ library support
 	ld_shlibs_CXX=no
 	;;
-      cxx)
+      cxx*)
 	allow_undefined_flag_CXX=' -expect_unresolved \*'
-	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
+	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
 	archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
 	  echo "-hidden">> $lib.exp~
-	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry $objdir/so_locations -o $lib~
+	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry ${output_objdir}/so_locations -o $lib~
 	  $rm $lib.exp'
 
 	hardcode_libdir_flag_spec_CXX='-rpath $libdir'
@@ -10647,7 +10839,7 @@
       *)
 	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
 	  allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
-	 archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
+	 archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 
 	  hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
 	  hardcode_libdir_separator_CXX=:
@@ -10671,7 +10863,7 @@
   sco*)
     archive_cmds_need_lc_CXX=no
     case $cc_basename in
-      CC)
+      CC*)
 	# FIXME: insert proper C++ library support
 	ld_shlibs_CXX=no
 	;;
@@ -10683,12 +10875,12 @@
     ;;
   sunos4*)
     case $cc_basename in
-      CC)
+      CC*)
 	# Sun C++ 4.x
 	# FIXME: insert proper C++ library support
 	ld_shlibs_CXX=no
 	;;
-      lcc)
+      lcc*)
 	# Lucid
 	# FIXME: insert proper C++ library support
 	ld_shlibs_CXX=no
@@ -10701,36 +10893,33 @@
     ;;
   solaris*)
     case $cc_basename in
-      CC)
+      CC*)
 	# Sun C++ 4.2, 5.x and Centerline C++
+        archive_cmds_need_lc_CXX=yes
 	no_undefined_flag_CXX=' -zdefs'
-	archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-	$CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+	$CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
 
 	hardcode_libdir_flag_spec_CXX='-R$libdir'
 	hardcode_shlibpath_var_CXX=no
 	case $host_os in
-	  solaris2.0-5 | solaris2.0-5.*) ;;
+	  solaris2.[0-5] | solaris2.[0-5].*) ;;
 	  *)
 	    # The C++ compiler is used as linker so we must use $wl
 	    # flag to pass the commands to the underlying system
-	    # linker.
+	    # linker. We must also pass each convience library through
+	    # to the system linker between allextract/defaultextract.
+	    # The C++ compiler will combine linker options so we
+	    # cannot just pass the convience library names through
+	    # without $wl.
 	    # Supported since Solaris 2.6 (maybe 2.5.1?)
-	    whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	    whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
 	    ;;
 	esac
 	link_all_deplibs_CXX=yes
 
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	output_verbose_link_cmd='echo'
 
 	# Archives containing C++ object files must be created using
 	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -10738,7 +10927,7 @@
 	# in the archive.
 	old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
 	;;
-      gcx)
+      gcx*)
 	# Green Hills C++ Compiler
 	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
 
@@ -10781,7 +10970,7 @@
     ;;
   tandem*)
     case $cc_basename in
-      NCC)
+      NCC*)
 	# NonStop-UX NCC 3.20
 	# FIXME: insert proper C++ library support
 	ld_shlibs_CXX=no
@@ -10834,7 +11023,7 @@
   # The `*' in the case matches for architectures that use `case' in
   # $output_verbose_cmd can trigger glob expansion during the loop
   # eval without this substitution.
-  output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`"
+  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
 
   for p in `eval $output_verbose_link_cmd`; do
     case $p in
@@ -10910,6 +11099,20 @@
 
 $rm -f confest.$objext
 
+# PORTME: override above test on systems where it is broken
+case $host_os in
+solaris*)
+  case $cc_basename in
+  CC*)
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    postdeps_CXX='-lCstd -lCrun'
+    ;;
+  esac
+esac
+
+
 case " $postdeps_CXX " in
 *" -lc "*) archive_cmds_need_lc_CXX=no ;;
 esac
@@ -10965,7 +11168,7 @@
     hpux*)
       # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
       # not for PA HP-UX.
-      case "$host_cpu" in
+      case $host_cpu in
       hppa*64*|ia64*)
 	;;
       *)
@@ -10990,18 +11193,28 @@
 	;;
       chorus*)
 	case $cc_basename in
-	cxch68)
+	cxch68*)
 	  # Green Hills C++ Compiler
 	  # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
 	  ;;
 	esac
 	;;
+       darwin*)
+         # PIC is the default on this platform
+         # Common symbols not allowed in MH_DYLIB files
+         case $cc_basename in
+           xlc*)
+           lt_prog_compiler_pic_CXX='-qnocommon'
+           lt_prog_compiler_wl_CXX='-Wl,'
+           ;;
+         esac
+       ;;
       dgux*)
 	case $cc_basename in
-	  ec++)
+	  ec++*)
 	    lt_prog_compiler_pic_CXX='-KPIC'
 	    ;;
-	  ghcx)
+	  ghcx*)
 	    # Green Hills C++ Compiler
 	    lt_prog_compiler_pic_CXX='-pic'
 	    ;;
@@ -11009,22 +11222,22 @@
 	    ;;
 	esac
 	;;
-      freebsd* | kfreebsd*-gnu)
+      freebsd* | kfreebsd*-gnu | dragonfly*)
 	# FreeBSD uses GNU C++
 	;;
       hpux9* | hpux10* | hpux11*)
 	case $cc_basename in
-	  CC)
+	  CC*)
 	    lt_prog_compiler_wl_CXX='-Wl,'
 	    lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
 	    if test "$host_cpu" != ia64; then
 	      lt_prog_compiler_pic_CXX='+Z'
 	    fi
 	    ;;
-	  aCC)
+	  aCC*)
 	    lt_prog_compiler_wl_CXX='-Wl,'
 	    lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive"
-	    case "$host_cpu" in
+	    case $host_cpu in
 	    hppa*64*|ia64*)
 	      # +Z the default
 	      ;;
@@ -11039,7 +11252,7 @@
 	;;
       irix5* | irix6* | nonstopux*)
 	case $cc_basename in
-	  CC)
+	  CC*)
 	    lt_prog_compiler_wl_CXX='-Wl,'
 	    lt_prog_compiler_static_CXX='-non_shared'
 	    # CC pic flag -KPIC is the default.
@@ -11050,18 +11263,24 @@
 	;;
       linux*)
 	case $cc_basename in
-	  KCC)
+	  KCC*)
 	    # KAI C++ Compiler
 	    lt_prog_compiler_wl_CXX='--backend -Wl,'
 	    lt_prog_compiler_pic_CXX='-fPIC'
 	    ;;
-	  icpc)
+	  icpc* | ecpc*)
 	    # Intel C++
 	    lt_prog_compiler_wl_CXX='-Wl,'
 	    lt_prog_compiler_pic_CXX='-KPIC'
 	    lt_prog_compiler_static_CXX='-static'
 	    ;;
-	  cxx)
+	  pgCC*)
+	    # Portland Group C++ compiler.
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-fpic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  cxx*)
 	    # Compaq C++
 	    # Make sure the PIC flag is empty.  It appears that all Alpha
 	    # Linux and Compaq Tru64 Unix objects are PIC.
@@ -11078,7 +11297,7 @@
 	;;
       mvs*)
 	case $cc_basename in
-	  cxx)
+	  cxx*)
 	    lt_prog_compiler_pic_CXX='-W c,exportall'
 	    ;;
 	  *)
@@ -11089,14 +11308,14 @@
 	;;
       osf3* | osf4* | osf5*)
 	case $cc_basename in
-	  KCC)
+	  KCC*)
 	    lt_prog_compiler_wl_CXX='--backend -Wl,'
 	    ;;
-	  RCC)
+	  RCC*)
 	    # Rational C++ 2.4.1
 	    lt_prog_compiler_pic_CXX='-pic'
 	    ;;
-	  cxx)
+	  cxx*)
 	    # Digital/Compaq C++
 	    lt_prog_compiler_wl_CXX='-Wl,'
 	    # Make sure the PIC flag is empty.  It appears that all Alpha
@@ -11112,7 +11331,7 @@
 	;;
       sco*)
 	case $cc_basename in
-	  CC)
+	  CC*)
 	    lt_prog_compiler_pic_CXX='-fPIC'
 	    ;;
 	  *)
@@ -11121,13 +11340,13 @@
 	;;
       solaris*)
 	case $cc_basename in
-	  CC)
+	  CC*)
 	    # Sun C++ 4.2, 5.x and Centerline C++
 	    lt_prog_compiler_pic_CXX='-KPIC'
 	    lt_prog_compiler_static_CXX='-Bstatic'
 	    lt_prog_compiler_wl_CXX='-Qoption ld '
 	    ;;
-	  gcx)
+	  gcx*)
 	    # Green Hills C++ Compiler
 	    lt_prog_compiler_pic_CXX='-PIC'
 	    ;;
@@ -11137,12 +11356,12 @@
 	;;
       sunos4*)
 	case $cc_basename in
-	  CC)
+	  CC*)
 	    # Sun C++ 4.x
 	    lt_prog_compiler_pic_CXX='-pic'
 	    lt_prog_compiler_static_CXX='-Bstatic'
 	    ;;
-	  lcc)
+	  lcc*)
 	    # Lucid
 	    lt_prog_compiler_pic_CXX='-pic'
 	    ;;
@@ -11152,7 +11371,7 @@
 	;;
       tandem*)
 	case $cc_basename in
-	  NCC)
+	  NCC*)
 	    # NonStop-UX NCC 3.20
 	    lt_prog_compiler_pic_CXX='-KPIC'
 	    ;;
@@ -11193,18 +11412,20 @@
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    # The option is referenced via a variable to avoid confusing sed.
    lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11199: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11418: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:11203: \$? = $ac_status" >&5
+   echo "$as_me:11422: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test ! -s conftest.err; then
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp
+     $SED '/^$/d' conftest.err >conftest.er2
+     if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then
        lt_prog_compiler_pic_works_CXX=yes
      fi
    fi
@@ -11225,7 +11446,7 @@
 fi
 
 fi
-case "$host_os" in
+case $host_os in
   # For platforms which do not support PIC, -DPIC is meaningless:
   *djgpp*)
     lt_prog_compiler_pic_CXX=
@@ -11253,23 +11474,25 @@
    # Note that $ac_compile itself does not contain backslashes and begins
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11259: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11480: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:11263: \$? = $ac_status" >&5
+   echo "$as_me:11484: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     if test ! -s out/conftest.err; then
+     $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp
+     $SED '/^$/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o_CXX=yes
      fi
    fi
-   chmod u+w .
+   chmod u+w . 2>&5
    $rm conftest*
    # SGI C++ compiler will create directory out/ii_files/ for
    # template instantiation
@@ -11324,7 +11547,7 @@
     export_symbols_cmds_CXX="$ltdll_cmds"
   ;;
   cygwin* | mingw*)
-    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
   ;;
   *)
     export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
@@ -11504,7 +11727,7 @@
   shlibpath_var=LIBRARY_PATH
   ;;
 
-bsdi4*)
+bsdi[45]*)
   version_type=linux
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -11532,7 +11755,8 @@
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname'
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $rm \$dlpath'
@@ -11562,7 +11786,7 @@
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
     ;;
@@ -11585,7 +11809,7 @@
   soname_spec='${libname}${release}${major}$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
   # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
   if test "$GCC" = yes; then
     sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
@@ -11620,8 +11844,17 @@
   dynamic_linker='GNU ld.so'
   ;;
 
-freebsd*)
-  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
   version_type=freebsd-$objformat
   case $version_type in
     freebsd-elf*)
@@ -11639,7 +11872,7 @@
   freebsd2*)
     shlibpath_overrides_runpath=yes
     ;;
-  freebsd3.01* | freebsdelf3.01*)
+  freebsd3.[01]* | freebsdelf3.[01]*)
     shlibpath_overrides_runpath=yes
     hardcode_into_libs=yes
     ;;
@@ -11666,7 +11899,7 @@
   version_type=sunos
   need_lib_prefix=no
   need_version=no
-  case "$host_cpu" in
+  case $host_cpu in
   ia64*)
     shrext_cmds='.so'
     hardcode_into_libs=yes
@@ -11763,31 +11996,10 @@
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # find out which ABI we are using
-  libsuff=
-  case "$host_cpu" in
-  x86_64*|s390x*|powerpc64*)
-    echo '#line 11770 "configure"' > conftest.$ac_ext
-    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-      case `/usr/bin/file conftest.$ac_objext` in
-      *64-bit*)
-        libsuff=64
-        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
-        ;;
-      esac
-    fi
-    rm -rf conftest*
-    ;;
-  esac
-
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -11849,7 +12061,11 @@
 openbsd*)
   version_type=sunos
   need_lib_prefix=no
-  need_version=yes
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
   shlibpath_var=LD_LIBRARY_PATH
@@ -11971,8 +12187,8 @@
 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
 hardcode_action_CXX=
 if test -n "$hardcode_libdir_flag_spec_CXX" || \
-   test -n "$runpath_var CXX" || \
-   test "X$hardcode_automatic_CXX"="Xyes" ; then
+   test -n "$runpath_var_CXX" || \
+   test "X$hardcode_automatic_CXX" = "Xyes" ; then
 
   # We can hardcode non-existant directories.
   if test "$hardcode_direct_CXX" != no &&
@@ -12638,7 +12854,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 12641 "configure"
+#line 12857 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12704,7 +12920,7 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) 2>/dev/null
+    (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
       x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
@@ -12736,7 +12952,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 12739 "configure"
+#line 12955 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12802,7 +13018,7 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) 2>/dev/null
+    (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
       x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
@@ -12954,7 +13170,13 @@
 # The host system.
 host_alias=$host_alias
 host=$host
+host_os=$host_os
 
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
 # An echo program that does not interpret backslashes.
 echo=$lt_echo
 
@@ -13030,7 +13252,7 @@
 # Does compiler simultaneously support -c and -o options?
 compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
 
-# Must we lock files when doing compilation ?
+# Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
 # Do we need the lib prefix for modules?
@@ -13311,13 +13533,36 @@
 compiler=$CC
 
 
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
 # Allow CC to be a program name with arguments.
 lt_save_CC="$CC"
 CC=${F77-"f77"}
 compiler=$CC
 compiler_F77=$CC
-cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
+
 echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6
 echo "$as_me:$LINENO: result: $can_build_shared" >&5
@@ -13329,7 +13574,7 @@
 
 # On AIX, shared libraries and static libraries use the same namespace, and
 # are all built from PIC.
-case "$host_os" in
+case $host_os in
 aix3*)
   test "$enable_shared" = yes && enable_static=no
   if test -n "$RANLIB"; then
@@ -13338,7 +13583,9 @@
   fi
   ;;
 aix4* | aix5*)
-  test "$enable_shared" = yes && enable_static=no
+  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+    test "$enable_shared" = yes && enable_static=no
+  fi
   ;;
 esac
 echo "$as_me:$LINENO: result: $enable_shared" >&5
@@ -13415,7 +13662,7 @@
     hpux*)
       # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
       # not for PA HP-UX.
-      case "$host_cpu" in
+      case $host_cpu in
       hppa*64*|ia64*)
 	# +Z the default
 	;;
@@ -13441,6 +13688,16 @@
 	lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
       fi
       ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic_F77='-qnocommon'
+         lt_prog_compiler_wl_F77='-Wl,'
+         ;;
+       esac
+       ;;
 
     mingw* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
@@ -13452,7 +13709,7 @@
       lt_prog_compiler_wl_F77='-Wl,'
       # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
       # not for PA HP-UX.
-      case "$host_cpu" in
+      case $host_cpu in
       hppa*64*|ia64*)
 	# +Z the default
 	;;
@@ -13476,12 +13733,19 @@
       ;;
 
     linux*)
-      case $CC in
+      case $cc_basename in
       icc* | ecc*)
 	lt_prog_compiler_wl_F77='-Wl,'
 	lt_prog_compiler_pic_F77='-KPIC'
 	lt_prog_compiler_static_F77='-static'
         ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl_F77='-Wl,'
+	lt_prog_compiler_pic_F77='-fpic'
+	lt_prog_compiler_static_F77='-Bstatic'
+        ;;
       ccc*)
         lt_prog_compiler_wl_F77='-Wl,'
         # All Alpha code is PIC.
@@ -13502,9 +13766,14 @@
       ;;
 
     solaris*)
-      lt_prog_compiler_wl_F77='-Wl,'
       lt_prog_compiler_pic_F77='-KPIC'
       lt_prog_compiler_static_F77='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl_F77='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl_F77='-Wl,';;
+      esac
       ;;
 
     sunos4*)
@@ -13526,6 +13795,11 @@
       fi
       ;;
 
+    unicos*)
+      lt_prog_compiler_wl_F77='-Wl,'
+      lt_prog_compiler_can_build_shared_F77=no
+      ;;
+
     uts4*)
       lt_prog_compiler_pic_F77='-pic'
       lt_prog_compiler_static_F77='-Bstatic'
@@ -13560,18 +13834,20 @@
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    # The option is referenced via a variable to avoid confusing sed.
    lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13566: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13840: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13570: \$? = $ac_status" >&5
+   echo "$as_me:13844: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test ! -s conftest.err; then
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp
+     $SED '/^$/d' conftest.err >conftest.er2
+     if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then
        lt_prog_compiler_pic_works_F77=yes
      fi
    fi
@@ -13592,7 +13868,7 @@
 fi
 
 fi
-case "$host_os" in
+case $host_os in
   # For platforms which do not support PIC, -DPIC is meaningless:
   *djgpp*)
     lt_prog_compiler_pic_F77=
@@ -13620,23 +13896,25 @@
    # Note that $ac_compile itself does not contain backslashes and begins
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13626: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13902: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13630: \$? = $ac_status" >&5
+   echo "$as_me:13906: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     if test ! -s out/conftest.err; then
+     $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp
+     $SED '/^$/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o_F77=yes
      fi
    fi
-   chmod u+w .
+   chmod u+w . 2>&5
    $rm conftest*
    # SGI C++ compiler will create directory out/ii_files/ for
    # template instantiation
@@ -13712,6 +13990,16 @@
   # rely on this symbol name, it's probably fine to never include it in
   # preloaded symbol tables.
   extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
   case $host_os in
   cygwin* | mingw* | pw32*)
@@ -13732,6 +14020,27 @@
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_F77='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec_F77=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
     # See if GNU ld supports shared libraries.
     case $host_os in
     aix3* | aix4* | aix5*)
@@ -13782,7 +14091,7 @@
       allow_undefined_flag_F77=unsupported
       always_export_symbols_F77=no
       enable_shared_with_static_runtimes_F77=yes
-      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
 
       if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
         archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
@@ -13796,10 +14105,41 @@
 	fi~
 	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000  ${wl}--out-implib,$lib'
       else
-	ld_shlibs=no
+	ld_shlibs_F77=no
       fi
       ;;
 
+    linux*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+      else
+	ld_shlibs_F77=no
+      fi
+      ;;
+
     netbsd*)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
@@ -13838,31 +14178,6 @@
       hardcode_shlibpath_var_F77=no
       ;;
 
-  linux*)
-    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-        tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_cmds_F77="$tmp_archive_cmds"
-      supports_anon_versioning=no
-      case `$LD -v 2>/dev/null` in
-        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
-        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-        *\ 2.11.*) ;; # other 2.11 versions
-        *) supports_anon_versioning=yes ;;
-      esac
-      if test $supports_anon_versioning = yes; then
-        archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
-cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-$echo "local: *; };" >> $output_objdir/$libname.ver~
-        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-      else
-        archive_expsym_cmds_F77="$tmp_archive_cmds"
-      fi
-    else
-      ld_shlibs_F77=no
-    fi
-    ;;
-
     *)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
@@ -13873,16 +14188,11 @@
       ;;
     esac
 
-    if test "$ld_shlibs_F77" = yes; then
-      runpath_var=LD_RUN_PATH
-      hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir'
-      export_dynamic_flag_spec_F77='${wl}--export-dynamic'
-      # ancient GNU ld didn't support --whole-archive et. al.
-      if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
- 	whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      else
-  	whole_archive_flag_spec_F77=
-      fi
+    if test "$ld_shlibs_F77" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_F77=
+      export_dynamic_flag_spec_F77=
+      whole_archive_flag_spec_F77=
     fi
   else
     # PORTME fill in a description of your system's linker (not GNU ld)
@@ -13946,7 +14256,7 @@
       link_all_deplibs_F77=yes
 
       if test "$GCC" = yes; then
-	case $host_os in aix4.012|aix4.012.*)
+	case $host_os in aix4.[012]|aix4.[012].*)
 	# We only want to do this on AIX 4.2 and lower, the check
 	# below for broken collect2 doesn't work under 4.3+
 	  collect2name=`${CC} -print-prog-name=collect2`
@@ -13967,6 +14277,9 @@
 	  fi
 	esac
 	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
       else
 	# not using gcc
 	if test "$host_cpu" = ia64; then
@@ -14093,7 +14406,7 @@
 	  # Exported symbols can be pulled into shared objects from archives
 	  whole_archive_flag_spec_F77=' '
 	  archive_cmds_need_lc_F77=yes
-	  # This is similar to how AIX traditionally builds it's shared libraries.
+	  # This is similar to how AIX traditionally builds its shared libraries.
 	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
 	fi
       fi
@@ -14107,7 +14420,7 @@
       ld_shlibs_F77=no
       ;;
 
-    bsdi4*)
+    bsdi[45]*)
       export_dynamic_flag_spec_F77=-rdynamic
       ;;
 
@@ -14128,57 +14441,57 @@
       old_archive_From_new_cmds_F77='true'
       # FIXME: Should let the user specify the lib program.
       old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      fix_srcfile_path_F77='`cygpath -w "$srcfile"`'
       enable_shared_with_static_runtimes_F77=yes
       ;;
 
     darwin* | rhapsody*)
-    if test "$GXX" = yes ; then
-      archive_cmds_need_lc_F77=no
-      case "$host_os" in
-      rhapsody* | darwin1.[012])
-	allow_undefined_flag_F77='-undefined suppress'
-	;;
-      *) # Darwin 1.3 on
-      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-      	allow_undefined_flag_F77='-flat_namespace -undefined suppress'
-      else
-        case ${MACOSX_DEPLOYMENT_TARGET} in
-          10.[012])
-            allow_undefined_flag_F77='-flat_namespace -undefined suppress'
-            ;;
-          10.*)
-            allow_undefined_flag_F77='-undefined dynamic_lookup'
-            ;;
-        esac
-      fi
-	;;
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_F77='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
       esac
-    	lt_int_apple_cc_single_mod=no
-    	output_verbose_link_cmd='echo'
-    	if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
-    	  lt_int_apple_cc_single_mod=yes
-    	fi
-    	if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-    	  archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-    	else
-        archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-      fi
-      module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
-        if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-          archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-        else
-          archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-        fi
-          module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      archive_cmds_need_lc_F77=no
       hardcode_direct_F77=no
       hardcode_automatic_F77=yes
       hardcode_shlibpath_var_F77=unsupported
-      whole_archive_flag_spec_F77='-all_load $convenience'
+      whole_archive_flag_spec_F77=''
       link_all_deplibs_F77=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
     else
-      ld_shlibs_F77=no
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_F77=no
+          ;;
+      esac
     fi
       ;;
 
@@ -14212,7 +14525,7 @@
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | kfreebsd*-gnu)
+    freebsd* | kfreebsd*-gnu | dragonfly*)
       archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec_F77='-R$libdir'
       hardcode_direct_F77=yes
@@ -14237,7 +14550,7 @@
 
     hpux10* | hpux11*)
       if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	case "$host_cpu" in
+	case $host_cpu in
 	hppa*64*|ia64*)
 	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
@@ -14246,7 +14559,7 @@
 	  ;;
 	esac
       else
-	case "$host_cpu" in
+	case $host_cpu in
 	hppa*64*|ia64*)
 	  archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
 	  ;;
@@ -14256,7 +14569,7 @@
 	esac
       fi
       if test "$with_gnu_ld" = no; then
-	case "$host_cpu" in
+	case $host_cpu in
 	hppa*64*)
 	  hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
 	  hardcode_libdir_flag_spec_ld_F77='+b $libdir'
@@ -14323,6 +14636,7 @@
       hardcode_shlibpath_var_F77=no
       if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
 	archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
 	hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
 	export_dynamic_flag_spec_F77='${wl}-E'
       else
@@ -14368,7 +14682,7 @@
 	allow_undefined_flag_F77=' -expect_unresolved \*'
 	archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
 	archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
-	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	hardcode_libdir_flag_spec_F77='-rpath $libdir'
@@ -14387,10 +14701,12 @@
     solaris*)
       no_undefined_flag_F77=' -z text'
       if test "$GCC" = yes; then
+	wlarc='${wl}'
 	archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
 	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
       else
+	wlarc=''
 	archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
 	archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
   	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
@@ -14399,8 +14715,18 @@
       hardcode_shlibpath_var_F77=no
       case $host_os in
       solaris2.[0-5] | solaris2.[0-5].*) ;;
-      *) # Supported since Solaris 2.6 (maybe 2.5.1?)
-	whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;;
+      *)
+ 	# The compiler driver will combine linker options so we
+ 	# cannot just pass the convience library names through
+ 	# without $wl, iff we do not link with $LD.
+ 	# Luckily, gcc supports the same syntax we need for Sun Studio.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+ 	case $wlarc in
+ 	'')
+ 	  whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;;
+ 	*)
+ 	  whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+ 	esac ;;
       esac
       link_all_deplibs_F77=yes
       ;;
@@ -14674,7 +15000,7 @@
   shlibpath_var=LIBRARY_PATH
   ;;
 
-bsdi4*)
+bsdi[45]*)
   version_type=linux
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -14702,7 +15028,8 @@
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname'
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $rm \$dlpath'
@@ -14732,7 +15059,7 @@
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
     ;;
@@ -14755,7 +15082,7 @@
   soname_spec='${libname}${release}${major}$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
   # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
   if test "$GCC" = yes; then
     sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
@@ -14790,8 +15117,17 @@
   dynamic_linker='GNU ld.so'
   ;;
 
-freebsd*)
-  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
   version_type=freebsd-$objformat
   case $version_type in
     freebsd-elf*)
@@ -14809,7 +15145,7 @@
   freebsd2*)
     shlibpath_overrides_runpath=yes
     ;;
-  freebsd3.01* | freebsdelf3.01*)
+  freebsd3.[01]* | freebsdelf3.[01]*)
     shlibpath_overrides_runpath=yes
     hardcode_into_libs=yes
     ;;
@@ -14836,7 +15172,7 @@
   version_type=sunos
   need_lib_prefix=no
   need_version=no
-  case "$host_cpu" in
+  case $host_cpu in
   ia64*)
     shrext_cmds='.so'
     hardcode_into_libs=yes
@@ -14933,31 +15269,10 @@
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # find out which ABI we are using
-  libsuff=
-  case "$host_cpu" in
-  x86_64*|s390x*|powerpc64*)
-    echo '#line 14940 "configure"' > conftest.$ac_ext
-    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-      case `/usr/bin/file conftest.$ac_objext` in
-      *64-bit*)
-        libsuff=64
-        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
-        ;;
-      esac
-    fi
-    rm -rf conftest*
-    ;;
-  esac
-
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -15019,7 +15334,11 @@
 openbsd*)
   version_type=sunos
   need_lib_prefix=no
-  need_version=yes
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
   shlibpath_var=LD_LIBRARY_PATH
@@ -15141,8 +15460,8 @@
 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
 hardcode_action_F77=
 if test -n "$hardcode_libdir_flag_spec_F77" || \
-   test -n "$runpath_var F77" || \
-   test "X$hardcode_automatic_F77"="Xyes" ; then
+   test -n "$runpath_var_F77" || \
+   test "X$hardcode_automatic_F77" = "Xyes" ; then
 
   # We can hardcode non-existant directories.
   if test "$hardcode_direct_F77" != no &&
@@ -15319,7 +15638,13 @@
 # The host system.
 host_alias=$host_alias
 host=$host
+host_os=$host_os
 
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
 # An echo program that does not interpret backslashes.
 echo=$lt_echo
 
@@ -15395,7 +15720,7 @@
 # Does compiler simultaneously support -c and -o options?
 compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
 
-# Must we lock files when doing compilation ?
+# Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
 # Do we need the lib prefix for modules?
@@ -15633,7 +15958,7 @@
 lt_simple_compile_test_code="class foo {}\n"
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n'
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n'
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 
@@ -15644,16 +15969,42 @@
 compiler=$CC
 
 
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
 # Allow CC to be a program name with arguments.
 lt_save_CC="$CC"
 CC=${GCJ-"gcj"}
 compiler=$CC
 compiler_GCJ=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
+
 # GCJ did not exist at the time GCC didn't implicitly link libc in.
 archive_cmds_need_lc_GCJ=no
 
+old_archive_cmds_GCJ=$old_archive_cmds
 
+
 lt_prog_compiler_no_builtin_flag_GCJ=
 
 if test "$GCC" = yes; then
@@ -15675,18 +16026,20 @@
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    # The option is referenced via a variable to avoid confusing sed.
    lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15681: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16032: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:15685: \$? = $ac_status" >&5
+   echo "$as_me:16036: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test ! -s conftest.err; then
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp
+     $SED '/^$/d' conftest.err >conftest.er2
+     if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_rtti_exceptions=yes
      fi
    fi
@@ -15763,7 +16116,7 @@
     hpux*)
       # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
       # not for PA HP-UX.
-      case "$host_cpu" in
+      case $host_cpu in
       hppa*64*|ia64*)
 	# +Z the default
 	;;
@@ -15789,6 +16142,16 @@
 	lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
       fi
       ;;
+      darwin*)
+        # PIC is the default on this platform
+        # Common symbols not allowed in MH_DYLIB files
+       case $cc_basename in
+         xlc*)
+         lt_prog_compiler_pic_GCJ='-qnocommon'
+         lt_prog_compiler_wl_GCJ='-Wl,'
+         ;;
+       esac
+       ;;
 
     mingw* | pw32* | os2*)
       # This hack is so that the source file can tell whether it is being
@@ -15800,7 +16163,7 @@
       lt_prog_compiler_wl_GCJ='-Wl,'
       # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
       # not for PA HP-UX.
-      case "$host_cpu" in
+      case $host_cpu in
       hppa*64*|ia64*)
 	# +Z the default
 	;;
@@ -15824,12 +16187,19 @@
       ;;
 
     linux*)
-      case $CC in
+      case $cc_basename in
       icc* | ecc*)
 	lt_prog_compiler_wl_GCJ='-Wl,'
 	lt_prog_compiler_pic_GCJ='-KPIC'
 	lt_prog_compiler_static_GCJ='-static'
         ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl_GCJ='-Wl,'
+	lt_prog_compiler_pic_GCJ='-fpic'
+	lt_prog_compiler_static_GCJ='-Bstatic'
+        ;;
       ccc*)
         lt_prog_compiler_wl_GCJ='-Wl,'
         # All Alpha code is PIC.
@@ -15850,9 +16220,14 @@
       ;;
 
     solaris*)
-      lt_prog_compiler_wl_GCJ='-Wl,'
       lt_prog_compiler_pic_GCJ='-KPIC'
       lt_prog_compiler_static_GCJ='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl_GCJ='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl_GCJ='-Wl,';;
+      esac
       ;;
 
     sunos4*)
@@ -15874,6 +16249,11 @@
       fi
       ;;
 
+    unicos*)
+      lt_prog_compiler_wl_GCJ='-Wl,'
+      lt_prog_compiler_can_build_shared_GCJ=no
+      ;;
+
     uts4*)
       lt_prog_compiler_pic_GCJ='-pic'
       lt_prog_compiler_static_GCJ='-Bstatic'
@@ -15908,18 +16288,20 @@
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    # The option is referenced via a variable to avoid confusing sed.
    lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15914: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16294: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:15918: \$? = $ac_status" >&5
+   echo "$as_me:16298: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test ! -s conftest.err; then
+     # So say no if there are warnings other than the usual output.
+     $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp
+     $SED '/^$/d' conftest.err >conftest.er2
+     if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then
        lt_prog_compiler_pic_works_GCJ=yes
      fi
    fi
@@ -15940,7 +16322,7 @@
 fi
 
 fi
-case "$host_os" in
+case $host_os in
   # For platforms which do not support PIC, -DPIC is meaningless:
   *djgpp*)
     lt_prog_compiler_pic_GCJ=
@@ -15968,23 +16350,25 @@
    # Note that $ac_compile itself does not contain backslashes and begins
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15974: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16356: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:15978: \$? = $ac_status" >&5
+   echo "$as_me:16360: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     if test ! -s out/conftest.err; then
+     $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp
+     $SED '/^$/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o_GCJ=yes
      fi
    fi
-   chmod u+w .
+   chmod u+w . 2>&5
    $rm conftest*
    # SGI C++ compiler will create directory out/ii_files/ for
    # template instantiation
@@ -16060,6 +16444,16 @@
   # rely on this symbol name, it's probably fine to never include it in
   # preloaded symbol tables.
   extract_expsyms_cmds=
+  # Just being paranoid about ensuring that cc_basename is set.
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
   case $host_os in
   cygwin* | mingw* | pw32*)
@@ -16080,6 +16474,27 @@
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir'
+    export_dynamic_flag_spec_GCJ='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+	whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+  	whole_archive_flag_spec_GCJ=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>/dev/null` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
     # See if GNU ld supports shared libraries.
     case $host_os in
     aix3* | aix4* | aix5*)
@@ -16130,7 +16545,7 @@
       allow_undefined_flag_GCJ=unsupported
       always_export_symbols_GCJ=no
       enable_shared_with_static_runtimes_GCJ=yes
-      export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
+      export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
 
       if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
         archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
@@ -16144,10 +16559,41 @@
 	fi~
 	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000  ${wl}--out-implib,$lib'
       else
-	ld_shlibs=no
+	ld_shlibs_GCJ=no
       fi
       ;;
 
+    linux*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+	tmp_addflag=
+	case $cc_basename,$host_cpu in
+	pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	esac
+	archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+	if test $supports_anon_versioning = yes; then
+	  archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
+  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+  $echo "local: *; };" >> $output_objdir/$libname.ver~
+	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	fi
+      else
+	ld_shlibs_GCJ=no
+      fi
+      ;;
+
     netbsd*)
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
 	archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
@@ -16186,31 +16632,6 @@
       hardcode_shlibpath_var_GCJ=no
       ;;
 
-  linux*)
-    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-        tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_cmds_GCJ="$tmp_archive_cmds"
-      supports_anon_versioning=no
-      case `$LD -v 2>/dev/null` in
-        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
-        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-        *\ 2.11.*) ;; # other 2.11 versions
-        *) supports_anon_versioning=yes ;;
-      esac
-      if test $supports_anon_versioning = yes; then
-        archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
-cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-$echo "local: *; };" >> $output_objdir/$libname.ver~
-        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-      else
-        archive_expsym_cmds_GCJ="$tmp_archive_cmds"
-      fi
-    else
-      ld_shlibs_GCJ=no
-    fi
-    ;;
-
     *)
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
@@ -16221,16 +16642,11 @@
       ;;
     esac
 
-    if test "$ld_shlibs_GCJ" = yes; then
-      runpath_var=LD_RUN_PATH
-      hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir'
-      export_dynamic_flag_spec_GCJ='${wl}--export-dynamic'
-      # ancient GNU ld didn't support --whole-archive et. al.
-      if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
- 	whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      else
-  	whole_archive_flag_spec_GCJ=
-      fi
+    if test "$ld_shlibs_GCJ" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec_GCJ=
+      export_dynamic_flag_spec_GCJ=
+      whole_archive_flag_spec_GCJ=
     fi
   else
     # PORTME fill in a description of your system's linker (not GNU ld)
@@ -16294,7 +16710,7 @@
       link_all_deplibs_GCJ=yes
 
       if test "$GCC" = yes; then
-	case $host_os in aix4.012|aix4.012.*)
+	case $host_os in aix4.[012]|aix4.[012].*)
 	# We only want to do this on AIX 4.2 and lower, the check
 	# below for broken collect2 doesn't work under 4.3+
 	  collect2name=`${CC} -print-prog-name=collect2`
@@ -16315,6 +16731,9 @@
 	  fi
 	esac
 	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
       else
 	# not using gcc
 	if test "$host_cpu" = ia64; then
@@ -16461,7 +16880,7 @@
 	  # Exported symbols can be pulled into shared objects from archives
 	  whole_archive_flag_spec_GCJ=' '
 	  archive_cmds_need_lc_GCJ=yes
-	  # This is similar to how AIX traditionally builds it's shared libraries.
+	  # This is similar to how AIX traditionally builds its shared libraries.
 	  archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
 	fi
       fi
@@ -16475,7 +16894,7 @@
       ld_shlibs_GCJ=no
       ;;
 
-    bsdi4*)
+    bsdi[45]*)
       export_dynamic_flag_spec_GCJ=-rdynamic
       ;;
 
@@ -16496,57 +16915,57 @@
       old_archive_From_new_cmds_GCJ='true'
       # FIXME: Should let the user specify the lib program.
       old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`'
       enable_shared_with_static_runtimes_GCJ=yes
       ;;
 
     darwin* | rhapsody*)
-    if test "$GXX" = yes ; then
-      archive_cmds_need_lc_GCJ=no
-      case "$host_os" in
-      rhapsody* | darwin1.[012])
-	allow_undefined_flag_GCJ='-undefined suppress'
-	;;
-      *) # Darwin 1.3 on
-      if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-      	allow_undefined_flag_GCJ='-flat_namespace -undefined suppress'
-      else
-        case ${MACOSX_DEPLOYMENT_TARGET} in
-          10.[012])
-            allow_undefined_flag_GCJ='-flat_namespace -undefined suppress'
-            ;;
-          10.*)
-            allow_undefined_flag_GCJ='-undefined dynamic_lookup'
-            ;;
-        esac
-      fi
-	;;
+      case $host_os in
+        rhapsody* | darwin1.[012])
+         allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress'
+         ;;
+       *) # Darwin 1.3 on
+         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+           allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+         else
+           case ${MACOSX_DEPLOYMENT_TARGET} in
+             10.[012])
+               allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+               ;;
+             10.*)
+               allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup'
+               ;;
+           esac
+         fi
+         ;;
       esac
-    	lt_int_apple_cc_single_mod=no
-    	output_verbose_link_cmd='echo'
-    	if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then
-    	  lt_int_apple_cc_single_mod=yes
-    	fi
-    	if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-    	  archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-    	else
-        archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
-      fi
-      module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's
-        if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
-          archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-        else
-          archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-        fi
-          module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      archive_cmds_need_lc_GCJ=no
       hardcode_direct_GCJ=no
       hardcode_automatic_GCJ=yes
       hardcode_shlibpath_var_GCJ=unsupported
-      whole_archive_flag_spec_GCJ='-all_load $convenience'
+      whole_archive_flag_spec_GCJ=''
       link_all_deplibs_GCJ=yes
+    if test "$GCC" = yes ; then
+    	output_verbose_link_cmd='echo'
+        archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+      module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+      # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+      archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
     else
-      ld_shlibs_GCJ=no
+      case $cc_basename in
+        xlc*)
+         output_verbose_link_cmd='echo'
+         archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
+         module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+         archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+          ;;
+       *)
+         ld_shlibs_GCJ=no
+          ;;
+      esac
     fi
       ;;
 
@@ -16580,7 +16999,7 @@
       ;;
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | kfreebsd*-gnu)
+    freebsd* | kfreebsd*-gnu | dragonfly*)
       archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec_GCJ='-R$libdir'
       hardcode_direct_GCJ=yes
@@ -16605,7 +17024,7 @@
 
     hpux10* | hpux11*)
       if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	case "$host_cpu" in
+	case $host_cpu in
 	hppa*64*|ia64*)
 	  archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
@@ -16614,7 +17033,7 @@
 	  ;;
 	esac
       else
-	case "$host_cpu" in
+	case $host_cpu in
 	hppa*64*|ia64*)
 	  archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags'
 	  ;;
@@ -16624,7 +17043,7 @@
 	esac
       fi
       if test "$with_gnu_ld" = no; then
-	case "$host_cpu" in
+	case $host_cpu in
 	hppa*64*)
 	  hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
 	  hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
@@ -16691,6 +17110,7 @@
       hardcode_shlibpath_var_GCJ=no
       if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
 	archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
 	hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
 	export_dynamic_flag_spec_GCJ='${wl}-E'
       else
@@ -16736,7 +17156,7 @@
 	allow_undefined_flag_GCJ=' -expect_unresolved \*'
 	archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
 	archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
-	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	hardcode_libdir_flag_spec_GCJ='-rpath $libdir'
@@ -16755,10 +17175,12 @@
     solaris*)
       no_undefined_flag_GCJ=' -z text'
       if test "$GCC" = yes; then
+	wlarc='${wl}'
 	archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
 	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
       else
+	wlarc=''
 	archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
 	archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
   	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
@@ -16767,8 +17189,18 @@
       hardcode_shlibpath_var_GCJ=no
       case $host_os in
       solaris2.[0-5] | solaris2.[0-5].*) ;;
-      *) # Supported since Solaris 2.6 (maybe 2.5.1?)
-	whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;;
+      *)
+ 	# The compiler driver will combine linker options so we
+ 	# cannot just pass the convience library names through
+ 	# without $wl, iff we do not link with $LD.
+ 	# Luckily, gcc supports the same syntax we need for Sun Studio.
+ 	# Supported since Solaris 2.6 (maybe 2.5.1?)
+ 	case $wlarc in
+ 	'')
+ 	  whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;;
+ 	*)
+ 	  whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
+ 	esac ;;
       esac
       link_all_deplibs_GCJ=yes
       ;;
@@ -17042,7 +17474,7 @@
   shlibpath_var=LIBRARY_PATH
   ;;
 
-bsdi4*)
+bsdi[45]*)
   version_type=linux
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -17070,7 +17502,8 @@
       dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname'
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname'
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
        $rm \$dlpath'
@@ -17100,7 +17533,7 @@
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
     ;;
@@ -17123,7 +17556,7 @@
   soname_spec='${libname}${release}${major}$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)'
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
   # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
   if test "$GCC" = yes; then
     sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
@@ -17158,8 +17591,17 @@
   dynamic_linker='GNU ld.so'
   ;;
 
-freebsd*)
-  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
   version_type=freebsd-$objformat
   case $version_type in
     freebsd-elf*)
@@ -17177,7 +17619,7 @@
   freebsd2*)
     shlibpath_overrides_runpath=yes
     ;;
-  freebsd3.01* | freebsdelf3.01*)
+  freebsd3.[01]* | freebsdelf3.[01]*)
     shlibpath_overrides_runpath=yes
     hardcode_into_libs=yes
     ;;
@@ -17204,7 +17646,7 @@
   version_type=sunos
   need_lib_prefix=no
   need_version=no
-  case "$host_cpu" in
+  case $host_cpu in
   ia64*)
     shrext_cmds='.so'
     hardcode_into_libs=yes
@@ -17301,31 +17743,10 @@
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # find out which ABI we are using
-  libsuff=
-  case "$host_cpu" in
-  x86_64*|s390x*|powerpc64*)
-    echo '#line 17308 "configure"' > conftest.$ac_ext
-    if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-      case `/usr/bin/file conftest.$ac_objext` in
-      *64-bit*)
-        libsuff=64
-        sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
-        ;;
-      esac
-    fi
-    rm -rf conftest*
-    ;;
-  esac
-
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -17387,7 +17808,11 @@
 openbsd*)
   version_type=sunos
   need_lib_prefix=no
-  need_version=yes
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+    *)                         need_version=no  ;;
+  esac
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
   shlibpath_var=LD_LIBRARY_PATH
@@ -17509,8 +17934,8 @@
 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
 hardcode_action_GCJ=
 if test -n "$hardcode_libdir_flag_spec_GCJ" || \
-   test -n "$runpath_var GCJ" || \
-   test "X$hardcode_automatic_GCJ"="Xyes" ; then
+   test -n "$runpath_var_GCJ" || \
+   test "X$hardcode_automatic_GCJ" = "Xyes" ; then
 
   # We can hardcode non-existant directories.
   if test "$hardcode_direct_GCJ" != no &&
@@ -18176,7 +18601,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 18179 "configure"
+#line 18604 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18242,7 +18667,7 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) 2>/dev/null
+    (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
       x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
@@ -18274,7 +18699,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 18277 "configure"
+#line 18702 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18340,7 +18765,7 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) 2>/dev/null
+    (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
       x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
@@ -18492,7 +18917,13 @@
 # The host system.
 host_alias=$host_alias
 host=$host
+host_os=$host_os
 
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
 # An echo program that does not interpret backslashes.
 echo=$lt_echo
 
@@ -18568,7 +18999,7 @@
 # Does compiler simultaneously support -c and -o options?
 compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ
 
-# Must we lock files when doing compilation ?
+# Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
 # Do we need the lib prefix for modules?
@@ -18816,11 +19247,35 @@
 compiler=$CC
 
 
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$rm conftest*
+
+ac_outfile=conftest.$ac_objext
+printf "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$rm conftest*
+
+
 # Allow CC to be a program name with arguments.
 lt_save_CC="$CC"
 CC=${RC-"windres"}
 compiler=$CC
 compiler_RC=$CC
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
 lt_cv_prog_compiler_c_o_RC=yes
 
 # The else clause should only fire when bootstrapping the
@@ -18937,7 +19392,13 @@
 # The host system.
 host_alias=$host_alias
 host=$host
+host_os=$host_os
 
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
 # An echo program that does not interpret backslashes.
 echo=$lt_echo
 
@@ -19013,7 +19474,7 @@
 # Does compiler simultaneously support -c and -o options?
 compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC
 
-# Must we lock files when doing compilation ?
+# Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
 # Do we need the lib prefix for modules?

Modified: freeswitch/branches/james/src/include/switch_core.h
==============================================================================
--- freeswitch/branches/james/src/include/switch_core.h	(original)
+++ freeswitch/branches/james/src/include/switch_core.h	Tue Sep  5 08:41:27 2006
@@ -89,6 +89,8 @@
 struct switch_core_thread_session {
 	/*! status of the thread */
 	int running;
+	/*! mutex */
+	switch_mutex_t *mutex;
 	/*! array of void pointers to pass mutiple data objects */
 	void *objs[SWITCH_MAX_CORE_THREAD_SESSION_OBJS];
 	/*! a pointer to a memory pool if the thread has it's own pool */
@@ -117,6 +119,14 @@
 SWITCH_DECLARE(switch_status_t) switch_core_init(char *console, const char **err);
 
 /*! 
+  \brief Initilize the core and load modules
+  \param console optional FILE stream for output
+  \param err a pointer to set any errors to
+  \note to be called at application startup instead of switch_core_init.  Includes module loading.
+*/
+SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(char *console, const char **err);
+
+/*! 
   \brief Set/Get Session Limit
   \param new_limit new value (if > 0)
   \return the current session limit
@@ -442,6 +452,14 @@
   \return the status returned by the message handler
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(switch_core_session_t *session, switch_event_t **event);
+
+
+/*! 
+  \brief Indicate the number of waiting events on a session
+  \param session the session to check
+  \return the number of events
+*/
+SWITCH_DECLARE(int32_t) switch_core_session_event_count(switch_core_session_t *session);
 
 /*! 
   \brief DE-Queue an event on a given session

Modified: freeswitch/branches/james/src/include/switch_event.h
==============================================================================
--- freeswitch/branches/james/src/include/switch_event.h	(original)
+++ freeswitch/branches/james/src/include/switch_event.h	Tue Sep  5 08:41:27 2006
@@ -156,6 +156,13 @@
 SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, char *header_name);
 
 /*!
+  \brief Retrieve the body value from an event
+  \param event the event to read the body from
+  \return the value of the body or NULL
+*/
+SWITCH_DECLARE(char *) switch_event_get_body(switch_event_t *event);
+
+/*!
   \brief Add a header to an event
   \param event the event to add the header to
   \param stack the stack sense (stack it on the top or on the bottom)

Modified: freeswitch/branches/james/src/include/switch_ivr.h
==============================================================================
--- freeswitch/branches/james/src/include/switch_ivr.h	(original)
+++ freeswitch/branches/james/src/include/switch_ivr.h	Tue Sep  5 08:41:27 2006
@@ -169,34 +169,36 @@
   \param session originating session
   \param bleg B leg session
   \param bridgeto the desired remote callstring
+  \param timelimit_sec timeout in seconds for outgoing call
   \param table optional state handler table to install on the channel
   \param cid_name_override override the caller id name
   \param cid_num_override override the caller id number
+  \param caller_profile_override override the entire calling caller profile
   \return SWITCH_STATUS_SUCCESS if bleg is a running session.
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *session,
 													 switch_core_session_t **bleg,
 													 char *bridgeto,
+													 uint32_t timelimit_sec,
 													 const switch_state_handler_table_t *table,
 													 char *cid_name_override,
-													 char *cid_num_override);
+													 char *cid_num_override,
+													 switch_caller_profile_t *caller_profile_override);
 
 /*!
   \brief Bridge Audio from one session to another
   \param session one session
   \param peer_session the other session
-  \param timelimit maximum number of seconds to wait for both channels to be answered
   \param dtmf_callback code to execute if any dtmf is dialed during the bridge
   \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
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_session_t *session, 
-															   switch_core_session_t *peer_session,
-															   unsigned int timelimit,
-															   switch_input_callback_function_t dtmf_callback,
-															   void *session_data,
-															   void *peer_session_data);
+																 switch_core_session_t *peer_session,
+																 switch_input_callback_function_t dtmf_callback,
+																 void *session_data,
+																 void *peer_session_data);
 
 
 /*!

Modified: freeswitch/branches/james/src/include/switch_platform.h
==============================================================================
--- freeswitch/branches/james/src/include/switch_platform.h	(original)
+++ freeswitch/branches/james/src/include/switch_platform.h	Tue Sep  5 08:41:27 2006
@@ -44,13 +44,6 @@
 
 #ifdef _MSC_VER
 
-#ifndef FREESWITCHCORE_EXPORTS
-#pragma comment(lib, "FreeSwitchCore.lib")
-#pragma comment(lib, "libapr-1.lib")
-#pragma comment(lib, "libaprutil-1.lib")
-#pragma comment(lib, "libapriconv-1.lib")
-#pragma comment(lib, "sqlite.lib")
-#endif
 
 /* disable the following warnings 
  * C4152: non standard extension, function/data ptr conversion in expression
@@ -81,6 +74,8 @@
 #define __FUNCTION__ ""
 #endif
 #endif
+
+#define inline __inline
 
 #ifndef uint32_t
 typedef unsigned __int8		uint8_t;

Modified: freeswitch/branches/james/src/include/switch_rtp.h
==============================================================================
--- freeswitch/branches/james/src/include/switch_rtp.h	(original)
+++ freeswitch/branches/james/src/include/switch_rtp.h	Tue Sep  5 08:41:27 2006
@@ -140,6 +140,13 @@
 SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session);
 
 /*! 
+  \brief Test if an RTP session is ready
+  \param rtp_session an RTP session to test
+  \return a true value if it's ready
+*/
+SWITCH_DECLARE(uint8_t) switch_rtp_ready(switch_rtp_t *rtp_session);
+
+/*! 
   \brief Destroy an RTP session
   \param rtp_session an RTP session to destroy
 */

Modified: freeswitch/branches/james/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/james/src/include/switch_types.h	(original)
+++ freeswitch/branches/james/src/include/switch_types.h	Tue Sep  5 08:41:27 2006
@@ -72,6 +72,32 @@
 #define SWITCH_HTDOCS_DIR SWITCH_PREFIX_DIR SWITCH_PATH_SEPARATOR "htdocs"
 #endif
 
+#define SWITCH_BITS_PER_BYTE 8
+typedef uint8_t switch_byte_t;
+
+typedef enum {
+	SWITCH_BITPACK_MODE_RFC3551,
+	SWITCH_BITPACK_MODE_AAL2
+} switch_bitpack_mode_t;
+
+
+typedef struct {
+	switch_byte_t *buf;
+	uint32_t buflen;
+	switch_byte_t *cur;
+	uint32_t bytes;
+	uint32_t bits_tot;
+	switch_byte_t bits_cur;
+	switch_byte_t bits_rem;
+	switch_byte_t frame_bits;
+	switch_byte_t shiftby;
+	switch_byte_t this;
+	switch_byte_t under;
+	switch_byte_t over;
+	switch_bitpack_mode_t mode;
+} switch_bitpack_t;
+
+
 struct switch_directories {
 	char *base_dir;
 	char *mod_dir;
@@ -355,6 +381,8 @@
 CF_BRIDGED		= (1 <<  7) - Channel in a bridge
 CF_HOLD			= (1 <<  8) - Channel is on hold
 CF_SERVICE		= (1 <<  9) - Channel has a service thread
+CF_TAGGED		= (1 << 10) - Channel is tagged
+CF_WINNER		= (1 << 10) - Channel is the winner
 </pre>
  */
 
@@ -368,7 +396,9 @@
 	CF_LOCK_THREAD	= (1 <<  6),
 	CF_BRIDGED		= (1 <<  7),
 	CF_HOLD			= (1 <<  8),
-	CF_SERVICE		= (1 <<  9)
+	CF_SERVICE		= (1 <<  9),
+	CF_TAGGED		= (1 << 10),
+	CF_WINNER		= (1 << 11)
 } switch_channel_flag_t;
 
 
@@ -413,6 +443,7 @@
 SWITCH_CODEC_FLAG_SILENCE_STOP =	(1 <<  3) - End period of silence
 SWITCH_CODEC_FLAG_SILENCE =			(1 <<  4) - Silence
 SWITCH_CODEC_FLAG_FREE_POOL =		(1 <<  5) - Free codec's pool on destruction
+SWITCH_CODEC_FLAG_AAL2 =			(1 <<  6) - USE AAL2 Bitpacking
 </pre>
 */
 typedef enum {
@@ -422,7 +453,7 @@
 	SWITCH_CODEC_FLAG_SILENCE_STOP =	(1 <<  3),
 	SWITCH_CODEC_FLAG_SILENCE =			(1 <<  4),
 	SWITCH_CODEC_FLAG_FREE_POOL =		(1 <<  5),
-
+	SWITCH_CODEC_FLAG_AAL2 =			(1 <<  6)
 } switch_codec_flag_t;
 
 
@@ -554,6 +585,9 @@
 	SWITCH_EVENT_MODULE_LOAD		- Module was loaded
 	SWITCH_EVENT_DTMF				- DTMF was sent
 	SWITCH_EVENT_MESSAGE			- A Basic Message
+	SWITCH_EVENT_CODEC				- Codec Change
+	SWITCH_EVENT_PROGRESS			- Early Media
+	SWITCH_EVENT_OUTGOING			- Outgoing Channel
     SWITCH_EVENT_ALL				- All events at once
 </pre>
 
@@ -568,6 +602,8 @@
 	SWITCH_EVENT_CHANNEL_EXECUTE,
 	SWITCH_EVENT_CHANNEL_BRIDGE,
 	SWITCH_EVENT_CHANNEL_UNBRIDGE,
+	SWITCH_EVENT_CHANNEL_PROGRESS,
+	SWITCH_EVENT_CHANNEL_OUTGOING,
 	SWITCH_EVENT_API,
 	SWITCH_EVENT_LOG,
 	SWITCH_EVENT_INBOUND_CHAN,
@@ -582,6 +618,7 @@
 	SWITCH_EVENT_MODULE_LOAD,
 	SWITCH_EVENT_DTMF,
 	SWITCH_EVENT_MESSAGE,
+	SWITCH_EVENT_CODEC,
 	SWITCH_EVENT_ALL
 } switch_event_types_t;
 
@@ -636,7 +673,8 @@
 	SWITCH_CAUSE_PROTOCOL_ERROR = 111,
 	SWITCH_CAUSE_INTERWORKING = 127,
 	SWITCH_CAUSE_CRASH = 500,
-	SWITCH_CAUSE_SYSTEM_SHUTDOWN = 501
+	SWITCH_CAUSE_SYSTEM_SHUTDOWN = 501,
+	SWITCH_CAUSE_LOSE_RACE = 502
 } switch_call_cause_t;
 
 

Modified: freeswitch/branches/james/src/include/switch_utils.h
==============================================================================
--- freeswitch/branches/james/src/include/switch_utils.h	(original)
+++ freeswitch/branches/james/src/include/switch_utils.h	Tue Sep  5 08:41:27 2006
@@ -61,7 +61,7 @@
 !strcasecmp(expr, "true") ||\
 atoi(expr))) ? SWITCH_TRUE : SWITCH_FALSE
 
-#define SWITCH_STATUS_IS_BREAK(x) (x || x == SWITCH_STATUS_BREAK || x == 730035 || x == 35)
+#define SWITCH_STATUS_IS_BREAK(x) (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35)
 
 /*!
   \brief Return a printable name of a switch_priority_t

Modified: freeswitch/branches/james/src/mod/applications/mod_bridgecall/mod_bridgecall.c
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_bridgecall/mod_bridgecall.c	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_bridgecall/mod_bridgecall.c	Tue Sep  5 08:41:27 2006
@@ -40,18 +40,22 @@
 {
 	switch_channel_t *caller_channel;
 	switch_core_session_t *peer_session;
-	unsigned int timelimit = 60; /* probably a useful option to pass in when there's time */
+	unsigned int timelimit = 60;
+	char *var;
 
 	caller_channel = switch_core_session_get_channel(session);
 	assert(caller_channel != NULL);
 
-	if (switch_ivr_originate(session, &peer_session, data, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
+	if ((var = switch_channel_get_variable(caller_channel, "call_timeout"))) {
+		timelimit = atoi(var);
+	}
+
+	if (switch_ivr_originate(session, &peer_session, data, timelimit, NULL, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel!\n");
 		switch_channel_hangup(caller_channel, SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL);
 		return;
 	} else {
-		/* peer channel is read locked now the bridge func will unlock it for us */
-		switch_ivr_multi_threaded_bridge(session, peer_session, timelimit, NULL, NULL, NULL);
+		switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL);
 	}
 }
 

Modified: freeswitch/branches/james/src/mod/applications/mod_bridgecall/mod_bridgecall.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_bridgecall/mod_bridgecall.vcproj	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_bridgecall/mod_bridgecall.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_bridgecall.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_bridgecall.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_bridgecall.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_bridgecall.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_commands/mod_commands.c	Tue Sep  5 08:41:27 2006
@@ -117,7 +117,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if ((session = switch_core_session_locate(dest))) {
+	if (dest && (session = switch_core_session_locate(dest))) {
 		switch_channel_t *channel = switch_core_session_get_channel(session);
 		switch_core_session_kill_channel(session, SWITCH_SIG_KILL);
 		switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
@@ -209,6 +209,72 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+static switch_status_t originate_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
+{
+	switch_channel_t *caller_channel;
+	switch_core_session_t *caller_session;
+	char *argv[7] = {0};
+	int x, argc = 0;
+	char *aleg, *exten, *dp, *context, *cid_name, *cid_num;
+	uint32_t timeout = 60;
+
+	if (isession) {
+		stream->write_function(stream, "Illegal Usage\n");
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	if (switch_strlen_zero(cmd)) {
+		stream->write_function(stream, "Usage: originate <call url> <exten> [<dialplan>] [<context>] [<cid_name>] [<cid_num>] [<timeout_sec>]\n");
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	argc = switch_separate_string(cmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+
+	for(x = 0; x < argc; x++) {
+		if (!strcasecmp(argv[x], "undef")) {
+			argv[x] = NULL;
+		}
+	}
+
+	aleg = argv[0];
+	exten = argv[1];
+	dp = argv[2];
+	context = argv[3];
+	cid_name = argv[4];
+	cid_num = argv[5];
+	
+	if (!dp) {
+		dp = "XML";
+	}
+
+	if (!context) {
+		context = "default";
+	}
+
+	if (argv[6]) {
+		timeout = atoi(argv[6]);
+	}
+
+	if (!aleg && exten) {
+		stream->write_function(stream, "Invalid Arguements\n");
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	if (switch_ivr_originate(NULL, &caller_session, aleg, timeout, NULL, cid_name, cid_num, NULL) != SWITCH_STATUS_SUCCESS) {
+		stream->write_function(stream, "Cannot Create Outgoing Channel! [%s]\n", aleg);
+		return SWITCH_STATUS_SUCCESS;
+	} 
+
+	caller_channel = switch_core_session_get_channel(caller_session);
+	assert(caller_channel != NULL);
+	switch_channel_clear_state_handler(caller_channel, NULL);
+	switch_core_session_rwunlock(caller_session);
+
+	switch_ivr_session_transfer(caller_session, exten, dp, context);
+
+	return SWITCH_STATUS_SUCCESS;;
+}
+
 struct holder {
 	switch_stream_handle_t *stream;
 	char *http;
@@ -349,7 +415,7 @@
 
 static switch_api_interface_t load_api_interface = {
 	/*.interface_name */ "load",
-	/*.desc */ "Load Modile",
+	/*.desc */ "Load Module",
 	/*.function */ load_function,
 	/*.next */ &transfer_api_interface
 };
@@ -369,6 +435,14 @@
 	/*.next */ &reload_api_interface
 };
 
+static switch_api_interface_t originate_api_interface = {
+	/*.interface_name */ "originate",
+	/*.desc */ "Originate a Call",
+	/*.function */ originate_function,
+	/*.next */ &commands_api_interface
+};
+
+
 static const switch_loadable_module_interface_t mod_commands_module_interface = {
 	/*.module_name */ modname,
 	/*.endpoint_interface */ NULL,
@@ -376,7 +450,7 @@
 	/*.dialplan_interface */ NULL,
 	/*.codec_interface */ NULL,
 	/*.application_interface */ NULL,
-	/*.api_interface */ &commands_api_interface
+	/*.api_interface */ &originate_api_interface
 };
 
 

Modified: freeswitch/branches/james/src/mod/applications/mod_commands/mod_commands.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_commands/mod_commands.vcproj	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_commands/mod_commands.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_commands.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_commands.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_commands.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_commands.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_conference/mod_conference.c	Tue Sep  5 08:41:27 2006
@@ -121,6 +121,7 @@
 	char *pin;
 	char *pin_sound;
 	char *bad_pin_sound;
+	char *profile_name;
 	uint32_t flags;
 	switch_mutex_t *flag_mutex;
 	uint32_t rate;
@@ -192,7 +193,12 @@
 static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim);
 static switch_status_t conf_function(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream);
 static switch_status_t audio_bridge_on_ring(switch_core_session_t *session);
-static switch_status_t conference_outcall(conference_obj_t *conference, switch_core_session_t *session, char *bridgeto, char *cid_name, char *cid_num);
+static switch_status_t conference_outcall(conference_obj_t *conference,
+										  switch_core_session_t *session,
+										  char *bridgeto,
+										  uint32_t timeout,
+										  char *cid_name,
+										  char *cid_num);
 static void conference_function(switch_core_session_t *session, char *data);
 static void launch_conference_thread(conference_obj_t *conference);
 static void *SWITCH_THREAD_FUNC input_thread_run(switch_thread_t *thread, void *obj);
@@ -691,8 +697,10 @@
 		return;
 	}
 
-	/* Answer the channel */
-	switch_channel_answer(channel);
+	if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
+		/* Answer the channel */
+		switch_channel_answer(channel);
+	}
 
 	/* Prepare the write frame */
 	write_frame.data = data;
@@ -1387,7 +1395,7 @@
 					goto done;
 				} else if (!strcasecmp(argv[1], "dial")) {
 					if (argc > 2) {
-						conference_outcall(conference, NULL, argv[2], argv[3], argv[4]);
+						conference_outcall(conference, NULL, argv[2], 60, argv[3], argv[4]);
 						stream->write_function(stream, "OK\n");
 						goto done;
 					} else {
@@ -1800,34 +1808,83 @@
 						conference_member_t *member = NULL;
 						uint32_t id = atoi(argv[2]);
 						conference_obj_t *new_conference = NULL;
+						switch_channel_t *channel;
+						switch_event_t *event;
+						char *profile_name;
+						switch_xml_t cxml = NULL, cfg = NULL, profile = NULL, profiles = NULL;
 
-						if ((new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[3]))) {
-							if ((member = conference_member_get(conference, id))) {								
-								switch_channel_t *channel = switch_core_session_get_channel(member->session);
-								switch_event_t *event;
-								
-								conference_del_member(member->last_conference, member);
-								conference_add_member(new_conference, member);
-								stream->write_function(stream, "OK Member %u sent to conference %s.\n", id, argv[3]);
+						if (!(member = conference_member_get(conference, id))) {								
+							stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
+							goto done;
+						}
+						
+						channel = switch_core_session_get_channel(member->session);
+						
+						if (!(new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[3]))) {
+							switch_memory_pool_t *pool;
+							char *conf_name;
 
-								if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-									switch_channel_event_set_data(channel, event);
-									switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
-									switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-Conference-Name", conference->name);
-									switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Conference-Name", argv[3]);
-									switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
-									switch_event_fire(&event);
+							/* Setup a memory pool to use. */
+							if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
+								goto done;
+							}
+
+							conf_name = switch_core_strdup(pool, argv[3]);
+							
+							if ((profile_name = strchr(conf_name, '@'))) {
+								*profile_name++ = '\0';
+								
+								/* Open the config from the xml registry */
+								if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
+									goto done;
 								}
+								
+								if ((profiles = switch_xml_child(cfg, "profiles"))) {
+									profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
+								}
+							} 
+							
+
+							/* Release the config registry handle */
+							if (cxml) {
+								switch_xml_free(cxml);
+								cxml = NULL;
+							}
+
+							/* Create the conference object. */
+							new_conference = conference_new(conf_name, profile, pool);
+							
+							
+							if (!new_conference) {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
 								goto done;
-							} else {
-								stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
-								goto done;
 							}
-						} else {
-							stream->write_function(stream, "No Conference called %s found.\n", argv[3]);
-							goto done;
+							
+							/* Set the minimum number of members (once you go above it you cannot go below it) */
+							new_conference->min = 1;
+							
+							/* Indicate the conference is dynamic */
+							switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
+							
+							/* Start the conference thread for this conference */
+							launch_conference_thread(new_conference);
 						}
 
+						conference_del_member(member->last_conference, member);
+						conference_add_member(new_conference, member);
+						stream->write_function(stream, "OK Member %u sent to conference %s.\n", id, argv[3]);
+						
+						if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+							switch_channel_event_set_data(channel, event);
+							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
+							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-Conference-Name", conference->name);
+							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Conference-Name", argv[3]);
+							switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
+							switch_event_fire(&event);
+						}
+						
 					} else {
 						stream->write_function(stream, transfer_usage);
 						goto done;
@@ -1958,6 +2015,7 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM RING\n");
 
 	/* put the channel in a passive state so we can loop audio to it */
+	switch_channel_set_state(channel, CS_TRANSMIT);
 	return SWITCH_STATUS_FALSE;
 }
 
@@ -1971,7 +2029,12 @@
 	/*.on_hold */ NULL,
 };
 
-static switch_status_t conference_outcall(conference_obj_t *conference, switch_core_session_t *session, char *bridgeto, char *cid_name, char *cid_num)
+static switch_status_t conference_outcall(conference_obj_t *conference,
+										  switch_core_session_t *session,
+										  char *bridgeto,
+										  uint32_t timeout,
+										  char *cid_name,
+										  char *cid_num)
 {
 	switch_core_session_t *peer_session;
 	switch_channel_t *peer_channel;
@@ -1979,7 +2042,7 @@
 	switch_channel_t *caller_channel = NULL;
 
 
-	if (switch_ivr_originate(session, &peer_session, bridgeto, &audio_bridge_peer_state_handlers, cid_name, cid_num) != SWITCH_STATUS_SUCCESS) {
+	if (switch_ivr_originate(session, &peer_session, bridgeto, timeout, &audio_bridge_peer_state_handlers, cid_name, cid_num, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel!\n");
 		if (session) {
 			caller_channel = switch_core_session_get_channel(session);
@@ -1989,7 +2052,6 @@
 	} 
 
 
-	switch_core_session_rwunlock(peer_session);
 	peer_channel = switch_core_session_get_channel(peer_session);
 	assert(peer_channel != NULL);
 	
@@ -2060,6 +2122,8 @@
 	char *flags_str;
 	member_flag_t uflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
 	switch_core_session_message_t msg = {0};
+	uint8_t isbr = 0;
+	char *dpin = NULL;
 	
 	channel = switch_core_session_get_channel(session);
     assert(channel != NULL);
@@ -2093,32 +2157,39 @@
 	}
 
 	if (!strncasecmp(mydata, bridge_prefix, strlen(bridge_prefix))) {
-		char *uuid = switch_core_session_get_uuid(session);
-		
+		isbr = 1;
 		mydata += strlen(bridge_prefix);
-		conf_name = mydata;
-
-		if ((bridgeto = strchr(conf_name, ':'))) {
+		if ((bridgeto = strchr(mydata, ':'))) {
 			*bridgeto++ = '\0';
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Config Error!\n");
 			goto done;
 		}
+	}
 
-		if ((profile_name = strchr(conf_name, '@'))) {
-			*profile_name++ = '\0';
+	conf_name = mydata;
 
-			/* Open the config from the xml registry */
-			if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
-				goto done;
-			}
-			
-			if ((profiles = switch_xml_child(cfg, "profiles"))) {
-				profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
-			}
+	if ((dpin = strchr(conf_name, '+'))) {
+		*dpin++ = '\0';
+	}
+
+	if ((profile_name = strchr(conf_name, '@'))) {
+		*profile_name++ = '\0';
+
+		/* Open the config from the xml registry */
+		if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
+			goto done;
 		}
+		
+		if ((profiles = switch_xml_child(cfg, "profiles"))) {
+			profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
+		}
+	} 
 
+	if (isbr) {
+		char *uuid = switch_core_session_get_uuid(session);
+		
 		if (!strcmp(conf_name, "_uuid_")) {
 			conf_name = uuid;
 		}
@@ -2131,10 +2202,6 @@
 		/* Create the conference object. */
 		conference = conference_new(conf_name, profile, pool);
 
-		/* Release the config registry handle */
-		switch_xml_free(cxml);
-		cxml = NULL;
-
 		if (!conference) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
 			goto done;
@@ -2143,6 +2210,10 @@
 		/* Set the minimum number of members (once you go above it you cannot go below it) */
 		conference->min = 2;
 
+		if (dpin) {
+			conference->pin = switch_core_strdup(conference->pool, dpin);
+		}
+
 		/* Indicate the conference is dynamic */
 		switch_set_flag_locked(conference, CFLAG_DYNAMIC);	
 
@@ -2150,12 +2221,32 @@
 		launch_conference_thread(conference);
 
 	} else {
-		conf_name = mydata;
-		freepool = pool;
 		/* Figure out what conference to call. */
-		if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Conference called %s found.\n", conf_name);
-			goto done;
+		if ((conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
+			freepool = pool;
+		} else {
+			/* Create the conference object. */
+			conference = conference_new(conf_name, profile, pool);
+		
+
+			if (!conference) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+				goto done;
+			}
+			
+			if (dpin) {
+				conference->pin = switch_core_strdup(conference->pool, dpin);
+			}
+				
+			/* Set the minimum number of members (once you go above it you cannot go below it) */
+			conference->min = 1;
+
+			/* Indicate the conference is dynamic */
+			switch_set_flag_locked(conference, CFLAG_DYNAMIC);
+
+			/* Start the conference thread for this conference */
+			launch_conference_thread(conference);
+
 		}
 
 		if (conference->pin) {
@@ -2168,11 +2259,15 @@
 
 			if (conference->pin_sound) {
 				conference_local_play_file(session, conference->pin_sound, 20, pin, sizeof(pin));
-			}
+			} 
 
 			if (strlen(pin) < strlen(conference->pin)) {
 				buf = pin + strlen(pin);
-				switch_ivr_collect_digits_count(session, buf, sizeof(pin) - (unsigned int)strlen(pin), (unsigned int)strlen(conference->pin) - (unsigned int)strlen(pin), "#", &term, 10000);
+				switch_ivr_collect_digits_count(session,
+												buf,
+												sizeof(pin) - (unsigned int)strlen(pin),
+												(unsigned int)strlen(conference->pin) - (unsigned int)strlen(pin),
+												"#", &term, 10000);
 			}
 
 			if (strcmp(pin, conference->pin)) {
@@ -2195,8 +2290,15 @@
 		
 	}
 
-	if (bridgeto) {
-		if (conference_outcall(conference, session, bridgeto, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
+	/* Release the config registry handle */
+	if (cxml) {
+		switch_xml_free(cxml);
+		cxml = NULL;
+	}
+
+
+	if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
+		if (conference_outcall(conference, session, bridgeto, 60, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
 			goto done;
 		}
 	}
@@ -2743,8 +2845,6 @@
 /* Called by FreeSWITCH when the module loads */
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
 {
-	switch_xml_t cfg, cxml, room, rooms, profiles, profile = NULL;
-	conference_obj_t *conference;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	
 	memset(&globals, 0, sizeof(globals));
@@ -2763,38 +2863,11 @@
 		return SWITCH_STATUS_TERM;
 	}
 
-	/* Open the config from the xml registry */
-	if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
-        return SWITCH_STATUS_TERM;
-    }
-
 	/* Setup a hash to store conferences by name */
 	switch_core_hash_init(&globals.conference_hash, globals.conference_pool);
 	switch_mutex_init(&globals.conference_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
 	switch_mutex_init(&globals.id_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
 	switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
-
-	/* Itterate the config */
-	if ((rooms = switch_xml_child(cfg, "rooms"))) {
-		/* Parse various rooms. */
-		for (room = switch_xml_child(rooms, "room"); room; room = room->next) {
-			char *name = (char *) switch_xml_attr_soft(room, "name");
-			char *pname = (char *) switch_xml_attr_soft(room, "profile");
-			
-			if ((profiles = switch_xml_child(cfg, "profiles"))) {
-				profile = switch_xml_find_child(profiles, "profile", "name", pname);
-			}
-
-			if ((conference = conference_new(name, profile, NULL))) {
-				/* Start the conference thread for this conference */
-				launch_conference_thread(conference);
-			}
-		}
-	}
-	
-	/* Release the config registry handle */
-	switch_xml_free(cxml);
 
 	globals.running = 1;
 	/* indicate that the module should continue to be loaded */

Modified: freeswitch/branches/james/src/mod/applications/mod_conference/mod_conference.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_conference/mod_conference.vcproj	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_conference/mod_conference.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_conference.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_conference.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_conference.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_conference.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_dptools/mod_dptools.c	Tue Sep  5 08:41:27 2006
@@ -45,6 +45,14 @@
 	}
 }
 
+static void answer_function(switch_core_session_t *session, char *data)
+{
+	switch_channel_t *channel;
+	channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
+	switch_channel_answer(channel);
+}
+
 static void set_function(switch_core_session_t *session, char *data)
 {
 	switch_channel_t *channel;
@@ -118,11 +126,19 @@
 	/*.application_function */ set_function
 };
 
+static const switch_application_interface_t answer_application_interface = {
+	/*.interface_name */ "answer",
+	/*.application_function */ answer_function,
+	NULL,NULL,NULL,
+	&set_application_interface
+
+};
+
 static const switch_application_interface_t strftime_application_interface = {
 	/*.interface_name */ "strftime",
 	/*.application_function */ strftime_function,
 	NULL,NULL,NULL,
-	&set_application_interface
+	&answer_application_interface
 
 };
 

Modified: freeswitch/branches/james/src/mod/applications/mod_dptools/mod_dptools.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_dptools/mod_dptools.vcproj	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_dptools/mod_dptools.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_dptools.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_dptools.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_dptools.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_dptools.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/applications/mod_echo/mod_echo.c
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_echo/mod_echo.c	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_echo/mod_echo.c	Tue Sep  5 08:41:27 2006
@@ -24,7 +24,7 @@
  * Contributor(s):
  * 
  * Anthony Minessale II <anthmct at yahoo.com>
- *
+ * Brian K. West <brian.west at mac.com>
  *
  * mod_echo.c -- Echo application
  *

Modified: freeswitch/branches/james/src/mod/applications/mod_echo/mod_echo.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_echo/mod_echo.vcproj	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_echo/mod_echo.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_echo.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_echo.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_echo.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_echo.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/applications/mod_ivrtest/mod_ivrtest.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_ivrtest/mod_ivrtest.vcproj	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_ivrtest/mod_ivrtest.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_ivrtest.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_ivrtest.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_ivrtest.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_ivrtest.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/applications/mod_playback/mod_playback.c
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_playback/mod_playback.c	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_playback/mod_playback.c	Tue Sep  5 08:41:27 2006
@@ -91,7 +91,7 @@
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 	}
 
-	switch_channel_answer(channel);
+	switch_channel_pre_answer(channel);
 	switch_ivr_speak_text(session, engine, voice, timer_name, codec->implementation->samples_per_second, on_dtmf, text, buf, sizeof(buf));
 	
 }
@@ -111,7 +111,7 @@
 	channel = switch_core_session_get_channel(session);
     assert(channel != NULL);
 
-	switch_channel_answer(channel);
+	switch_channel_pre_answer(channel);
 
 	if (switch_ivr_play_file(session, NULL, file_name, timer_name, on_dtmf, NULL, 0) != SWITCH_STATUS_SUCCESS) {
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);

Modified: freeswitch/branches/james/src/mod/applications/mod_playback/mod_playback.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_playback/mod_playback.vcproj	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_playback/mod_playback.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_playback.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_playback.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_playback.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_playback.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/applications/mod_rss/mod_rss.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/applications/mod_rss/mod_rss.vcproj	(original)
+++ freeswitch/branches/james/src/mod/applications/mod_rss/mod_rss.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_rss.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_rss.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_rss.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_rss.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/asr_tts/mod_cepstral/mod_cepstral.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/asr_tts/mod_cepstral/mod_cepstral.vcproj	(original)
+++ freeswitch/branches/james/src/mod/asr_tts/mod_cepstral/mod_cepstral.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -65,11 +65,11 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="swift.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_cepstral.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="C:\Program Files\Cepstral\sdk\lib\winnt;..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_cepstral.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_cepstral.lib"
 				TargetMachine="1"
@@ -101,8 +101,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -146,10 +146,11 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="swift.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_cepstral.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="C:\Program Files\Cepstral\sdk\lib\winnt;..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/codecs/mod_g711/mod_g711.c
==============================================================================
--- freeswitch/branches/james/src/mod/codecs/mod_g711/mod_g711.c	(original)
+++ freeswitch/branches/james/src/mod/codecs/mod_g711/mod_g711.c	Tue Sep  5 08:41:27 2006
@@ -207,8 +207,8 @@
 	/*.decode */ switch_g711u_decode,
 	/*.destroy */ switch_g711u_destroy
 };
-#endif
 
+
 static const switch_codec_implementation_t g711u_8k_30ms_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
 	/*.ianacode */ 0,
@@ -248,6 +248,7 @@
 	/*.destroy */ switch_g711u_destroy,
 	/*.next */ &g711u_8k_30ms_implementation
 };
+#endif
 
 static const switch_codec_implementation_t g711u_8k_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
@@ -266,7 +267,7 @@
 	/*.encode */ switch_g711u_encode,
 	/*.decode */ switch_g711u_decode,
 	/*.destroy */ switch_g711u_destroy,
-	/*.next */ &g711u_16k_implementation
+	///*.next */ &g711u_16k_implementation
 };
 
 

Modified: freeswitch/branches/james/src/mod/codecs/mod_g711/mod_g711.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/codecs/mod_g711/mod_g711.vcproj	(original)
+++ freeswitch/branches/james/src/mod/codecs/mod_g711/mod_g711.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_g711.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_g711.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_g711.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -141,10 +141,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_g711.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/codecs/mod_g729/mod_g729.c
==============================================================================
--- freeswitch/branches/james/src/mod/codecs/mod_g729/mod_g729.c	(original)
+++ freeswitch/branches/james/src/mod/codecs/mod_g729/mod_g729.c	Tue Sep  5 08:41:27 2006
@@ -26,22 +26,21 @@
  * Anthony Minessale II <anthmct at yahoo.com>
  * Michael Jerris <mike at jerris.com>
  *
- * mod_codec_g729.c -- G729 Codec Module
+ * The g729 codec itself is not distributed with this module.
  *
+ * mod_g729.c -- G729 Codec Module
+ *
  */  
 #include "switch.h"
 #include "g729.h"
 
-static const char modname[] = "mod_codec_g729";
+static const char modname[] = "mod_g729";
 
-
 struct g729_context {
-
 	struct dec_state decoder_object;
 	struct cod_state encoder_object;
 };
 
-
 static switch_status_t switch_g729_init(switch_codec_t *codec, switch_codec_flag_t flags,
 									  const switch_codec_settings_t *codec_settings) 
 {
@@ -71,15 +70,12 @@
 	}
 }
 
-
 static switch_status_t switch_g729_destroy(switch_codec_t *codec) 
 {
 	codec->private_info = NULL;
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
-
 static switch_status_t switch_g729_encode(switch_codec_t *codec, 
 										switch_codec_t *other_codec, 
 										void *decoded_data,
@@ -92,7 +88,6 @@
 										uint32_t *encoded_rate, 
 										unsigned int *flag) 
 {
-
 	struct g729_context *context = codec->private_info;
 	int cbret = 0;
 
@@ -121,12 +116,9 @@
 			return SWITCH_STATUS_FALSE;
 		}
 	}
-
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
-
 static switch_status_t switch_g729_decode(switch_codec_t *codec, 
 										switch_codec_t *other_codec, 
 										void *encoded_data,
@@ -139,7 +131,6 @@
 										uint32_t *decoded_rate, 
 										unsigned int *flag) 
 {
-
 	struct g729_context *context = codec->private_info;
 	int divisor = 10;
 	int plen = 10;
@@ -166,15 +157,10 @@
 
 		if (encoded_data_len % divisor == 0) {
 			uint8_t *test;
-
 			int loops = (int) encoded_data_len / divisor;
-
 			char *edp = encoded_data;
-
 			short *ddp = decoded_data;
-
 			int x;
-
 			uint32_t new_len = 0;
 
 			test = (uint8_t *) encoded_data;
@@ -207,15 +193,9 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "yo this frame is an odd size [%d]\n", encoded_data_len);
 		return SWITCH_STATUS_FALSE;
 	}
-
-
-
 	return SWITCH_STATUS_SUCCESS;
-
 }
 
-
-
 /* Registration */ 
 
 static const switch_codec_implementation_t g729_10ms_8k_implementation = { 
@@ -257,13 +237,51 @@
 	&g729_10ms_8k_implementation
 };
 
+static const switch_codec_implementation_t g729a_10ms_8k_implementation = { 
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
+	/*.ianacode */ 18, 
+	/*.iananame */ "G729a", 
+	/*.samples_per_second */ 8000, 
+	/*.bits_per_second */ 32000, 
+	/*.microseconds_per_frame */ 10000, 
+	/*.samples_per_frame */ 80, 
+	/*.bytes_per_frame */ 160, 
+	/*.encoded_bytes_per_frame */ 10, 
+	/*.number_of_channels */ 1, 
+	/*.pref_frames_per_packet */ 1, 
+	/*.max_frames_per_packet */ 1, 
+	/*.init */ switch_g729_init, 
+	/*.encode */ switch_g729_encode, 
+	/*.decode */ switch_g729_decode, 
+	/*.destroy */ switch_g729_destroy, 
+	&g729_8k_implementation
+};
 
+static const switch_codec_implementation_t g729a_8k_implementation = { 
+	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO, 
+	/*.ianacode */ 18, 
+	/*.iananame */ "G729a", 
+	/*.samples_per_second */ 8000, 
+	/*.bits_per_second */ 64000, 
+	/*.microseconds_per_frame */ 20000, 
+	/*.samples_per_frame */ 160, 
+	/*.bytes_per_frame */ 320, 
+	/*.encoded_bytes_per_frame */ 20, 
+	/*.number_of_channels */ 1, 
+	/*.pref_frames_per_packet */ 1, 
+	/*.max_frames_per_packet */ 1, 
+	/*.init */ switch_g729_init, 
+	/*.encode */ switch_g729_encode, 
+	/*.decode */ switch_g729_decode, 
+	/*.destroy */ switch_g729_destroy, 
+	&g729a_10ms_8k_implementation
+};
+
 static const switch_codec_interface_t g729_codec_interface = { 
 	/*.interface_name */ "g729", 
-	/*.implementations */ &g729_8k_implementation, 
+	/*.implementations */ &g729a_8k_implementation, 
 };
 
-
 static switch_loadable_module_interface_t g729_module_interface = { 
 	/*.module_name */ modname, 
 	/*.endpoint_interface */ NULL, 
@@ -273,17 +291,12 @@
 	/*.application_interface */ NULL 
 };
 
-
-
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface,
 													 char *filename)
 {
-
 	/* connect my internal structure to the blank pointer passed to me */ 
 	*module_interface = &g729_module_interface;
 
-
 	/* indicate that the module should continue to be loaded */ 
 	return SWITCH_STATUS_SUCCESS;
-
 }

Modified: freeswitch/branches/james/src/mod/codecs/mod_g729/mod_g729.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/codecs/mod_g729/mod_g729.vcproj	(original)
+++ freeswitch/branches/james/src/mod/codecs/mod_g729/mod_g729.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -65,11 +65,11 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="libg729.lib FreeSwitchCore.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_g729.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_g729.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_g729.lib"
 				TargetMachine="1"
@@ -101,8 +101,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -145,10 +145,11 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="libg729.lib FreeSwitchCore.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_g729.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/codecs/mod_gsm/mod_gsm.c
==============================================================================
--- freeswitch/branches/james/src/mod/codecs/mod_gsm/mod_gsm.c	(original)
+++ freeswitch/branches/james/src/mod/codecs/mod_gsm/mod_gsm.c	Tue Sep  5 08:41:27 2006
@@ -31,7 +31,7 @@
  */  
 #include "switch.h"
 #include "gsm.h"
-static const char modname[] = "mod_codec_gsm";
+static const char modname[] = "mod_gsm";
 struct gsm_context {
 	gsm encoder;
 	gsm decoder;

Modified: freeswitch/branches/james/src/mod/codecs/mod_gsm/mod_gsm.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/codecs/mod_gsm/mod_gsm.vcproj	(original)
+++ freeswitch/branches/james/src/mod/codecs/mod_gsm/mod_gsm.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,15 +17,15 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_CodecGSM Debug"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -64,12 +64,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libgsm.lib FreeSwitchCore.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_gsm.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\libs\codec\gsm\$(OutDir);..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_gsm.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_gsm.lib"
 				TargetMachine="1"
@@ -101,15 +100,15 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_CodecGSM Release"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -144,11 +143,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libgsm.lib FreeSwitchCore.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_gsm.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\libs\codec\gsm\$(OutDir);..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/codecs/mod_ilbc/mod_ilbc.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/codecs/mod_ilbc/mod_ilbc.vcproj	(original)
+++ freeswitch/branches/james/src/mod/codecs/mod_ilbc/mod_ilbc.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,15 +17,15 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_ilbc Debug"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -50,7 +50,7 @@
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,12 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libilbc.lib FreeSwitchCore.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_ilbc.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\libs\codec\ilbc\$(OutDir);..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_ilbc.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_ilbc.lib"
 				TargetMachine="1"
@@ -100,15 +99,15 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_ilbc Release"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -143,11 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libilbc.lib FreeSwitchCore.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_ilbc.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\libs\codec\ilbc\$(OutDir);..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/codecs/mod_l16/mod_l16.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/codecs/mod_l16/mod_l16.vcproj	(original)
+++ freeswitch/branches/james/src/mod/codecs/mod_l16/mod_l16.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -64,12 +64,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libresampled.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_l16.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\libresample\win&quot;;..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_l16.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_l16.lib"
 				TargetMachine="1"
@@ -101,8 +100,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -144,11 +143,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libresample.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_l16.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\libresample\win&quot;;..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/codecs/mod_speex/Makefile
==============================================================================
--- freeswitch/branches/james/src/mod/codecs/mod_speex/Makefile	(original)
+++ freeswitch/branches/james/src/mod/codecs/mod_speex/Makefile	Tue Sep  5 08:41:27 2006
@@ -1,7 +1,7 @@
 all:	depends $(MODNAME).$(DYNAMIC_LIB_EXTEN)
 
 depends:
-	MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install speex-1.1.11.1.tar.gz --prefix=$(PREFIX)
+	MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install speex-1.1.12.tar.gz --prefix=$(PREFIX) --disable-shared --with-pic
 
 $(MODNAME).$(DYNAMIC_LIB_EXTEN): $(MODNAME).c
 	$(CC) $(CFLAGS) -fPIC -c $(MODNAME).c -o $(MODNAME).o

Modified: freeswitch/branches/james/src/mod/codecs/mod_speex/mod_speex.c
==============================================================================
--- freeswitch/branches/james/src/mod/codecs/mod_speex/mod_speex.c	(original)
+++ freeswitch/branches/james/src/mod/codecs/mod_speex/mod_speex.c	Tue Sep  5 08:41:27 2006
@@ -33,7 +33,7 @@
 #include <speex/speex.h>
 #include <speex/speex_preprocess.h>
 
-static const char modname[] = "mod_speexcodec";
+static const char modname[] = "mod_speex";
 
 static const switch_codec_settings_t default_codec_settings = {
 	/*.quality */ 5,
@@ -205,6 +205,7 @@
 	speex_bits_pack(&context->encoder_bits, 15, 5);
 	*encoded_data_len = speex_bits_write(&context->encoder_bits, (char *) encoded_data, context->encoder_frame_size);
 	speex_bits_reset(&context->encoder_bits);
+	(*encoded_data_len)--;
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -271,7 +272,7 @@
 	/*.ianacode */ 102,
 	/*.iananame */ "speex",
 	/*.samples_per_second */ 32000,
-	/*.bits_per_second */ 512000,
+	/*.bits_per_second */ 256000,
 	/*.nanoseconds_per_frame */ 20000,
 	/*.samples_per_frame */ 640,
 	/*.bytes_per_frame */ 1280,
@@ -287,10 +288,10 @@
 
 static const switch_codec_implementation_t speex_16k_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
-	/*.ianacode */ 100,
+	/*.ianacode */ 99,
 	/*.iananame */ "speex",
 	/*.samples_per_second */ 16000,
-	/*.bits_per_second */ 256000,
+	/*.bits_per_second */ 22000,
 	/*.nanoseconds_per_frame */ 20000,
 	/*.samples_per_frame */ 320,
 	/*.bytes_per_frame */ 640,
@@ -307,10 +308,10 @@
 
 static const switch_codec_implementation_t speex_8k_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
-	/*.ianacode */ 97,
+	/*.ianacode */ 98,
 	/*.iananame */ "speex",
 	/*.samples_per_second */ 8000,
-	/*.bits_per_second */ 128000,
+	/*.bits_per_second */ 11000,
 	/*.nanoseconds_per_frame */ 20000,
 	/*.samples_per_frame */ 160,
 	/*.bytes_per_frame */ 320,

Modified: freeswitch/branches/james/src/mod/codecs/mod_speex/mod_speex.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/codecs/mod_speex/mod_speex.vcproj	(original)
+++ freeswitch/branches/james/src/mod/codecs/mod_speex/mod_speex.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,15 +17,15 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_SpeexCodec Debug"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -42,7 +42,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\speex\include&quot;;&quot;$(InputDir)..\..\..\..\libs\speex\include\speex&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\speex-1.1.11.1\include&quot;;&quot;$(InputDir)..\..\..\..\libs\speex-1.1.11.1\include\speex&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -64,12 +64,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libspeex.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_speex.dll"
-				LinkIncremental="2"
-				AdditionalLibraryDirectories="$(InputDir)..\..\..\..\libs\speex\win32\libspeex\$(OutDir);..\..\..\..\w32\vsnet\$(OutDir)"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="$(InputDir)..\..\..\..\libs\speex-1.1.11.1\win32\libspeex\$(OutDir);..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_speex.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_speex.lib"
 				TargetMachine="1"
@@ -101,15 +100,15 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_SpeexCodec Release"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -125,7 +124,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\speex\include&quot;;&quot;$(InputDir)..\..\..\..\libs\speex\include\speex&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\speex-1.1.11.1\include&quot;;&quot;$(InputDir)..\..\..\..\libs\speex-1.1.11.1\include\speex&quot;"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
 				RuntimeLibrary="0"
 				UsePrecompiledHeader="0"
@@ -144,11 +143,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libspeex.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_speex.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
-				AdditionalLibraryDirectories="$(InputDir)..\..\..\..\libs\speex\win32\libspeex\$(OutDir);..\..\..\..\w32\vsnet\$(OutDir)"
+				AdditionalLibraryDirectories="$(InputDir)..\..\..\..\libs\speex-1.1.11.1\win32\libspeex\$(OutDir);..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.vcproj	(original)
+++ freeswitch/branches/james/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_dialplan_directory.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_dialplan_directory.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_dialplan_directory.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -141,10 +141,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_dialplan_directory.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.vcproj	(original)
+++ freeswitch/branches/james/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,15 +17,15 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_dialplan_xml Debug"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -64,12 +64,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libpcre.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_dialplan_xml.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;..\..\..\..\w32\vsnet\$(OutDir)&quot;"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_dialplan_xml.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_dialplan_xml.lib"
 				TargetMachine="1"
@@ -101,15 +100,15 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_dialplan_xml Release"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -144,11 +143,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libpcre.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_dialplan_xml.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;..\..\..\..\w32\vsnet\$(OutDir)&quot;"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/directories/mod_ldap/mod_ldap.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/directories/mod_ldap/mod_ldap.vcproj	(original)
+++ freeswitch/branches/james/src/mod/directories/mod_ldap/mod_ldap.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -65,11 +65,11 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="Ws2_32.lib olber32.lib oldap_r.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_ldap.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="2"
 				AdditionalLibraryDirectories="$(InputDir)..\..\..\..\libs\openldap\$(OutDir);..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_ldap.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_ldap.lib"
 				TargetMachine="1"
@@ -101,8 +101,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -146,10 +146,11 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="Ws2_32.lib olber32.lib oldap_r.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_ldap.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="$(InputDir)..\..\..\..\libs\openldap\$(OutDir);..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"
@@ -183,7 +184,7 @@
 		</Configuration>
 		<Configuration
 			Name="Debug MS-LDAP|Win32"
-			OutputDirectory="$(ConfigurationName)"
+			OutputDirectory="Debug"
 			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
@@ -217,7 +218,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -231,11 +232,11 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="Ws2_32.lib Wldap32.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_ldap.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="$(InputDir)..\..\..\..\libs\openldap\$(OutDir);..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_ldap.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_ldap.lib"
 				TargetMachine="1"
@@ -267,7 +268,7 @@
 		</Configuration>
 		<Configuration
 			Name="Release MS-LDAP|Win32"
-			OutputDirectory="$(ConfigurationName)"
+			OutputDirectory="Release"
 			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
@@ -312,10 +313,11 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="Ws2_32.lib Wldap32.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_ldap.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="$(InputDir)..\..\..\..\libs\openldap\$(OutDir);..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/james/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/branches/james/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Tue Sep  5 08:41:27 2006
@@ -65,7 +65,9 @@
 	TFLAG_LANADDR = (1 << 16),
 	TFLAG_AUTO = (1 << 17),
 	TFLAG_DTMF = (1 << 18),
-	TFLAG_TIMER = ( 1 << 19)
+	TFLAG_TIMER = ( 1 << 19),
+	TFLAG_TERM = ( 1 << 20),
+	TFLAG_TRANSPORT_ACCEPT = (1 << 21),
 } TFLAGS;
 
 typedef enum {
@@ -134,6 +136,8 @@
 	uint32_t last_read;
 	char *codec_name;
 	switch_payload_t codec_num;
+	switch_payload_t r_codec_num;
+	uint32_t codec_rate;
 	switch_time_t next_desc;
 	switch_time_t next_cand;
 	char *stun_ip;
@@ -171,6 +175,41 @@
 static ldl_status handle_response(ldl_handle_t *handle, char *id);
 static switch_status_t load_config(void);
 
+
+static void terminate_session(switch_core_session_t **session, switch_call_cause_t cause)
+{
+	if (*session) {
+		switch_channel_t *channel = switch_core_session_get_channel(*session);
+		switch_channel_state_t state = switch_channel_get_state(channel);
+		struct private_object *tech_pvt = NULL;
+			
+		tech_pvt = switch_core_session_get_private(*session);
+
+		if (tech_pvt && tech_pvt->dlsession) {
+			if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
+				ldl_session_terminate(tech_pvt->dlsession);
+				switch_set_flag_locked(tech_pvt, TFLAG_TERM);
+			}
+			ldl_session_destroy(&tech_pvt->dlsession);
+		}
+
+		if (state > CS_INIT && state < CS_HANGUP) {
+			switch_channel_hangup(channel, cause);
+		}
+		
+		if (!switch_core_session_runing(*session)) {
+			if (state > CS_INIT && state < CS_HANGUP) {
+				channel_on_hangup(*session);
+			}
+
+			if (tech_pvt && tech_pvt->dlsession) {
+				ldl_session_set_private(tech_pvt->dlsession, NULL);
+			}
+			switch_core_session_destroy(session);
+		}
+	}
+}
+
 static void dl_logger(char *file, const char *func, int line, int level, char *fmt, ...)
 {
 	va_list ap;
@@ -184,24 +223,28 @@
 	va_end(ap);
 }
 
-static void get_codecs(struct private_object *tech_pvt)
+static int get_codecs(struct private_object *tech_pvt)
 {
 	assert(tech_pvt != NULL);
 	assert(tech_pvt->session != NULL);
 
-	if (globals.codec_string) {
-		if ((tech_pvt->num_codecs = switch_loadable_module_get_codecs_sorted(tech_pvt->codecs,
-																			 SWITCH_MAX_CODECS,
-																			 globals.codec_order,
-																			 globals.codec_order_last)) <= 0) {
+	if (!tech_pvt->num_codecs) {
+		if (globals.codec_string) {
+			if ((tech_pvt->num_codecs = switch_loadable_module_get_codecs_sorted(tech_pvt->codecs,
+																				 SWITCH_MAX_CODECS,
+																				 globals.codec_order,
+																				 globals.codec_order_last)) <= 0) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
+				return 0;
+			}
+		} else if (((tech_pvt->num_codecs =
+					 switch_loadable_module_get_codecs(switch_core_session_get_pool(tech_pvt->session), tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
-			return;
+			return 0;
 		}
-	} else if (((tech_pvt->num_codecs =
-				 switch_loadable_module_get_codecs(switch_core_session_get_pool(tech_pvt->session), tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
-		return;
 	}
+
+	return tech_pvt->num_codecs;
 }
 
 
@@ -243,8 +286,8 @@
 	int ms = 20;
 	switch_rtp_flag_t flags;
 
-	if (tech_pvt->rtp_session) {
-		return 0;
+	if (switch_rtp_ready(tech_pvt->rtp_session)) {
+		return 1;
 	}
 
 	if (!strncasecmp(tech_pvt->codec_name, "ilbc", 4)) {
@@ -252,33 +295,35 @@
 	}
 
 	if (switch_core_codec_init(&tech_pvt->read_codec,
-				   tech_pvt->codec_name,
-				   8000,
-				   ms,
-				   1,
-				   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
-				   NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+							   tech_pvt->codec_name,
+							   tech_pvt->codec_rate,
+							   ms,
+							   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_DEBUG, "Can't load codec?\n");
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-		return -1;
+		return 0;
 	}
 	tech_pvt->read_frame.rate = tech_pvt->read_codec.implementation->samples_per_second;
 	tech_pvt->read_frame.codec = &tech_pvt->read_codec;
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Read Codec to %s\n", tech_pvt->codec_name);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Read Codec to %s@%d\n", 
+					  tech_pvt->codec_name, (int)tech_pvt->read_codec.implementation->samples_per_second);
 	
 	if (switch_core_codec_init(&tech_pvt->write_codec,
-				   tech_pvt->codec_name,
-				   8000,
-				   ms,
-				   1,
-				   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
-				   NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+							   tech_pvt->codec_name,
+							   tech_pvt->codec_rate,
+							   ms,
+							   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_DEBUG, "Can't load codec?\n");
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-		return -1;
+		return 0;
 	}
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Write Codec to %s\n",  tech_pvt->codec_name);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Write Codec to %s@%d\n",  
+					  tech_pvt->codec_name,(int)tech_pvt->write_codec.implementation->samples_per_second);
 							
 	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);
@@ -287,6 +332,7 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", tech_pvt->profile->ip, tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
 	
 	flags = SWITCH_RTP_FLAG_GOOGLEHACK | SWITCH_RTP_FLAG_AUTOADJ;
+	//flags = SWITCH_RTP_FLAG_AUTOADJ;
 
 	if (switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
 	  flags |= SWITCH_RTP_FLAG_USE_TIMER;
@@ -304,7 +350,7 @@
 												 &err, switch_core_session_get_pool(tech_pvt->session)))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err);
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-		return -1;
+		return 0;
 	} else {
 		uint8_t vad_in = switch_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0;
 		uint8_t vad_out = switch_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0;
@@ -316,7 +362,7 @@
 		}
 	}
 
-	return 0;
+	return 1;
 }
 
 
@@ -327,14 +373,12 @@
 	assert(channel != NULL);
 
 	if (switch_test_flag(tech_pvt, TFLAG_DO_CAND)) {
-		return 0;
+		return 1;
 	}
 
-
-
 	tech_pvt->next_cand += DL_CAND_WAIT;
 	if (switch_test_flag(tech_pvt, TFLAG_BYE)) {
-		return -1;
+		return 0;
 	}
 	switch_set_flag_locked(tech_pvt, TFLAG_DO_CAND);
 
@@ -365,7 +409,7 @@
 				if (!stun_ip) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! NO STUN SERVER!\n");
 					switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-					return -1;
+					return 0;
 				}
 
 				cand[0].address = tech_pvt->profile->ip;
@@ -378,7 +422,7 @@
 									   switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
 					switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-					return -1;
+					return 0;
 				}
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Stun Success %s:%d\n", cand[0].address, cand[0].port);
 			}
@@ -399,7 +443,7 @@
 		switch_set_flag_locked(tech_pvt, TFLAG_RTP_READY);
 	}
 	switch_clear_flag_locked(tech_pvt, TFLAG_DO_CAND);
-	return 0;
+	return 1;
 }
 
 static char *lame(char *in)
@@ -414,54 +458,60 @@
 static int do_describe(struct private_object *tech_pvt, int force)
 {
 	ldl_payload_t payloads[5];
-	switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session);
-	assert(channel != NULL);
 
-	if (switch_test_flag(tech_pvt, TFLAG_DO_DESC)) {
+	if (!tech_pvt->session) {
 		return 0;
 	}
 
+	if (switch_test_flag(tech_pvt, TFLAG_DO_DESC)) {
+		return 1;
+	}
+
 	tech_pvt->next_desc += DL_CAND_WAIT;
 
 	if (switch_test_flag(tech_pvt, TFLAG_BYE)) {
-		return -1;
+		return 0;
 	}
 
 	memset(payloads, 0, sizeof(payloads));
 	switch_set_flag_locked(tech_pvt, TFLAG_DO_CAND);
-	if (!tech_pvt->num_codecs) {
-		get_codecs(tech_pvt);
-		if (!tech_pvt->num_codecs) {
-			switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
-			switch_set_flag_locked(tech_pvt, TFLAG_BYE);
-			switch_clear_flag_locked(tech_pvt, TFLAG_IO);
-			return -1;
-		}
+	if (!get_codecs(tech_pvt)) {
+		terminate_session(&tech_pvt->session, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
+		switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+		switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+		return 0;
 	}
 
+
 	if (force || !switch_test_flag(tech_pvt, TFLAG_CODEC_READY)) {
 		if (tech_pvt->codec_index < 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Don't have my codec yet here's one\n");
 			tech_pvt->codec_name = lame(tech_pvt->codecs[0]->iananame);
 			tech_pvt->codec_num = tech_pvt->codecs[0]->ianacode;
+			tech_pvt->codec_rate = tech_pvt->codecs[0]->samples_per_second;
+			tech_pvt->r_codec_num = tech_pvt->codecs[0]->ianacode;
 			tech_pvt->codec_index = 0;
 					
 			payloads[0].name = lame(tech_pvt->codecs[0]->iananame);
 			payloads[0].id = tech_pvt->codecs[0]->ianacode;
+			payloads[0].rate = tech_pvt->codecs[0]->samples_per_second;
+			payloads[0].bps = tech_pvt->codecs[0]->bits_per_second;
 			
 		} else {
 			payloads[0].name = lame(tech_pvt->codecs[tech_pvt->codec_index]->iananame);
 			payloads[0].id = tech_pvt->codecs[tech_pvt->codec_index]->ianacode;
+			payloads[0].rate = tech_pvt->codecs[tech_pvt->codec_index]->samples_per_second;
+			payloads[0].bps = tech_pvt->codecs[tech_pvt->codec_index]->bits_per_second;
 		}
 
 				
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send Describe [%s]\n", payloads[0].name);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send Describe [%s@%d]\n", payloads[0].name, payloads[0].rate);
 		tech_pvt->desc_id = ldl_session_describe(tech_pvt->dlsession, payloads, 1,
 												 switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? LDL_DESCRIPTION_INITIATE : LDL_DESCRIPTION_ACCEPT);
 		switch_set_flag_locked(tech_pvt, TFLAG_CODEC_READY);
 	} 
 	switch_clear_flag_locked(tech_pvt, TFLAG_DO_CAND);
-	return 0;
+	return 1;
 }
 
 static void *SWITCH_THREAD_FUNC negotiate_thread_run(switch_thread_t *thread, void *obj)
@@ -494,28 +544,29 @@
 	while(! (switch_test_flag(tech_pvt, TFLAG_CODEC_READY) && 
 			 switch_test_flag(tech_pvt, TFLAG_RTP_READY) && 
 			 switch_test_flag(tech_pvt, TFLAG_ANSWER) && 
+			 switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) &&
 			 switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) {
 		now = switch_time_now();
 		elapsed = (unsigned int)((now - started) / 1000);
 
 		if (switch_channel_get_state(channel) >= CS_HANGUP || switch_test_flag(tech_pvt, TFLAG_BYE)) {
-			return NULL;
+			goto out;
 		}
 
 		
 		if (now >= tech_pvt->next_desc) {
-			if (do_describe(tech_pvt, 0) < 0) {
-				break;
+			if (!do_describe(tech_pvt, 0)) {
+				goto out;
 			}
 		}
 		
 		if (tech_pvt->next_cand && now >= tech_pvt->next_cand) {
-			if (do_candidates(tech_pvt, 0) < 0) {
-				break;
+			if (!do_candidates(tech_pvt, 0)) {
+				goto out;
 			}
 		}
 		if (elapsed > 60000) {
-			switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+			terminate_session(&tech_pvt->session, SWITCH_CAUSE_NORMAL_CLEARING);
 			switch_set_flag_locked(tech_pvt, TFLAG_BYE);
 			switch_clear_flag_locked(tech_pvt, TFLAG_IO);
 			return NULL;
@@ -528,13 +579,17 @@
 	}
 	
 	if (switch_channel_get_state(channel) >= CS_HANGUP || switch_test_flag(tech_pvt, TFLAG_BYE)) {
-		return NULL;
+		goto out;
 	}	
 
-	activate_rtp(tech_pvt);
+	if (!activate_rtp(tech_pvt)) {
+		goto out;
+	}
 	
 	if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
-		do_candidates(tech_pvt, 0);
+		if (!do_candidates(tech_pvt, 0)) {
+			goto out;
+		}
 		switch_channel_answer(channel);
 		//printf("***************************ANSWER\n");
 	} else {
@@ -542,6 +597,10 @@
 	}
 	switch_channel_set_state(channel, CS_INIT);
 	return NULL;
+	
+ out:
+	terminate_session(&session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+	return NULL;
 }
 
 
@@ -632,11 +691,14 @@
 	switch_set_flag_locked(tech_pvt, TFLAG_BYE);
 	
 	if (tech_pvt->dlsession) {
-		ldl_session_terminate(tech_pvt->dlsession);
+		if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
+			ldl_session_terminate(tech_pvt->dlsession);
+			switch_set_flag_locked(tech_pvt, TFLAG_TERM);
+		}
 		ldl_session_destroy(&tech_pvt->dlsession);
 	}
 
-	if (tech_pvt->rtp_session) {
+	if (switch_rtp_ready(tech_pvt->rtp_session)) {
 		switch_rtp_destroy(&tech_pvt->rtp_session);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NUKE RTP\n");
 		tech_pvt->rtp_session = NULL;
@@ -665,13 +727,20 @@
 			switch_clear_flag_locked(tech_pvt, TFLAG_IO);
 			switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
 			switch_set_flag_locked(tech_pvt, TFLAG_BYE);
-			switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+
 			if (tech_pvt->dlsession) {
-				ldl_session_terminate(tech_pvt->dlsession);
+				if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
+					ldl_session_terminate(tech_pvt->dlsession);
+					switch_set_flag_locked(tech_pvt, TFLAG_TERM);
+				}
+				ldl_session_destroy(&tech_pvt->dlsession);
+
 			}
-			if (tech_pvt->rtp_session) {
+
+			if (switch_rtp_ready(tech_pvt->rtp_session)) {
 				switch_rtp_kill_socket(tech_pvt->rtp_session);
 			}
+
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
 		}
 	}
@@ -808,7 +877,7 @@
 	switch_clear_flag_locked(tech_pvt, TFLAG_READING);
 
 	if (switch_test_flag(tech_pvt, TFLAG_BYE)) {
-		switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+		terminate_session(&session, SWITCH_CAUSE_NORMAL_CLEARING);
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -841,7 +910,7 @@
 
 
 	if (switch_test_flag(tech_pvt, TFLAG_BYE)) {
-		switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+		terminate_session(&session, SWITCH_CAUSE_NORMAL_CLEARING);
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -920,6 +989,33 @@
 
 	return SWITCH_STATUS_SUCCESS;
 }
+
+static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event)
+{
+	switch_channel_t *channel;
+    struct private_object *tech_pvt;
+	char *subject, *body;
+
+    channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
+
+    tech_pvt = switch_core_session_get_private(session);
+    assert(tech_pvt != NULL);
+
+
+	if (!(body = switch_event_get_body(event))) {
+		body = "";
+	}
+
+	if (!(subject = switch_event_get_header(event, "subject"))) {
+		subject = "None";
+	}
+
+	ldl_session_send_msg(tech_pvt->dlsession, subject, body);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
 static const switch_state_handler_table_t channel_event_handlers = {
 	/*.on_init */ channel_on_init,
 	/*.on_ring */ channel_on_ring,
@@ -938,7 +1034,8 @@
 	/*.waitfor_read */ channel_waitfor_read,
 	/*.waitfor_write */ channel_waitfor_write,
 	/*.send_dtmf */ channel_send_dtmf,
-	/*.receive_message*/ channel_receive_message
+	/*.receive_message*/ channel_receive_message,
+	/*.receive_event*/ channel_receive_event
 };
 
 static const switch_endpoint_interface_t channel_endpoint_interface = {
@@ -1004,7 +1101,7 @@
 			*callto++ = '\0';
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid URL!\n");
-			switch_core_session_destroy(new_session);
+			terminate_session(new_session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			return SWITCH_STATUS_GENERR;
 		}
 		
@@ -1015,17 +1112,17 @@
 		if ((mdl_profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
 			if (!ldl_handle_ready(mdl_profile->handle)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doh! we are not logged in yet!\n");
-				switch_core_session_destroy(new_session);
+				terminate_session(new_session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 				return SWITCH_STATUS_GENERR;
 			}
 			if (!(full_id = ldl_handle_probe(mdl_profile->handle, callto, idbuf, sizeof(idbuf)))) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unknown Recipient!\n");
-				switch_core_session_destroy(new_session);
+				terminate_session(new_session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 				return SWITCH_STATUS_GENERR;
 			}
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unknown Profile!\n");
-			switch_core_session_destroy(new_session);
+			terminate_session(new_session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			return SWITCH_STATUS_GENERR;
 		}
 		
@@ -1045,7 +1142,7 @@
 			tech_pvt->dnis = switch_core_session_strdup(*new_session, dnis);
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
-			switch_core_session_destroy(new_session);
+			terminate_session(new_session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			return SWITCH_STATUS_GENERR;
 		}
 
@@ -1060,7 +1157,7 @@
 			tech_pvt->caller_profile = caller_profile;
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doh! no caller profile\n");
-			switch_core_session_destroy(new_session);
+			terminate_session(new_session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			return SWITCH_STATUS_GENERR;
 		}
 
@@ -1076,7 +1173,10 @@
 		ldl_session_set_value(dlsession, "caller_id_name", outbound_profile->caller_id_name);
 		ldl_session_set_value(dlsession, "caller_id_number", outbound_profile->caller_id_number);
 		tech_pvt->dlsession = dlsession;
-		get_codecs(tech_pvt);
+		if (!get_codecs(tech_pvt)) {
+			terminate_session(new_session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+            return SWITCH_STATUS_GENERR;
+		}
 		//tech_pvt->desc_id = ldl_session_describe(dlsession, NULL, 0, LDL_DESCRIPTION_INITIATE);
 		negotiate_thread_launch(*new_session);
 		return SWITCH_STATUS_SUCCESS;
@@ -1511,9 +1611,10 @@
 				tech_pvt->local_port = switch_rtp_request_port();
 				switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
 				tech_pvt->recip = switch_core_session_strdup(session, from);
+				switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
-				switch_core_session_destroy(&session);
+				terminate_session(&session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 				return LDL_STATUS_FALSE;
 			}
 
@@ -1531,7 +1632,9 @@
 			if (*msg == '+') {
 				switch_channel_queue_dtmf(channel, msg + 1);
 				switch_set_flag_locked(tech_pvt, TFLAG_DTMF);
-				switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_BREAK);
+				if (switch_rtp_ready(tech_pvt->rtp_session)) {
+					switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_BREAK);
+				}
 			}
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SESSION MSG [%s]\n", msg);
 		}
@@ -1549,7 +1652,8 @@
 
 		}
 		break;
-
+	case LDL_SIGNAL_TRANSPORT_ACCEPT:
+		switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT);
 		break;
 	case LDL_SIGNAL_INITIATE:
 		if (signal) {
@@ -1560,7 +1664,9 @@
 			if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
 				if (!strcasecmp(msg, "accept")) {
 					switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
-					do_candidates(tech_pvt, 0);
+					if (!do_candidates(tech_pvt, 0)) {
+						terminate_session(&session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+					}
 				}
 			}
 
@@ -1569,11 +1675,10 @@
 				break;
 			}
 
-			if (!tech_pvt->num_codecs) {
-				get_codecs(tech_pvt);
-				if (!tech_pvt->num_codecs) {
-					return LDL_STATUS_FALSE;
-				}
+
+			if (!get_codecs(tech_pvt)) {
+				terminate_session(&session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+				return LDL_STATUS_FALSE;
 			}
 
 			
@@ -1594,20 +1699,28 @@
 							match = (payloads[x].id == tech_pvt->codecs[y]->ianacode) ? 1 : 0;
 						}
 						
-						if (match) {
+						if (match && payloads[x].rate == tech_pvt->codecs[y]->samples_per_second) {
 							tech_pvt->codec_index = y;
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing Payload index %u %s %u\n", y, payloads[x].name, payloads[x].id);
 							tech_pvt->codec_name = tech_pvt->codecs[y]->iananame;
 							tech_pvt->codec_num = tech_pvt->codecs[y]->ianacode;
+							tech_pvt->r_codec_num = (switch_payload_t)(payloads[x].id);
+							tech_pvt->codec_rate = payloads[x].rate;
 							if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
-								do_describe(tech_pvt, 0);
+								if (!do_describe(tech_pvt, 0)) {
+									terminate_session(&session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+									return LDL_STATUS_FALSE;
+								}
 							}
 							return LDL_STATUS_SUCCESS;
 						}
 					}
 				}
 				if (!match && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
-					do_describe(tech_pvt, 0);
+					if (!do_describe(tech_pvt, 0)) {
+						terminate_session(&session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+						return LDL_STATUS_FALSE;
+					}
 				}
 			}
 		}
@@ -1663,8 +1776,10 @@
 
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Acceptable Candidate %s:%d\n", candidates[x].address, candidates[x].port);
 
+						if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
+							ldl_session_accept_candidate(dlsession, &candidates[x]);
+						}
 
-
 						if (!(exten = ldl_session_get_value(dlsession, "dnis"))) {
 							exten = profile->exten;
 						}
@@ -1708,21 +1823,26 @@
 							switch_set_flag_locked(tech_pvt, TFLAG_LANADDR);
 						}
 
-						if (!tech_pvt->num_codecs) {
-							get_codecs(tech_pvt);
-							if (!tech_pvt->num_codecs) {
-								return LDL_STATUS_FALSE;
-							}
+						if (!get_codecs(tech_pvt)) {
+							terminate_session(&session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+							return LDL_STATUS_FALSE;
 						}
+
 						
 						tech_pvt->remote_ip = switch_core_session_strdup(session, candidates[x].address);
 						ldl_session_set_ip(dlsession, tech_pvt->remote_ip);
 						tech_pvt->remote_port = candidates[x].port;
 						tech_pvt->remote_user = switch_core_session_strdup(session, candidates[x].username);
+
 						
 						if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
-							do_candidates(tech_pvt, 0);
+							if (!do_candidates(tech_pvt, 0)) {
+								terminate_session(&session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+								return LDL_STATUS_FALSE;
+							}
 						}
+				
+						
 						switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT);
 						
 						return LDL_STATUS_SUCCESS;
@@ -1737,14 +1857,15 @@
 			switch_channel_state_t state = switch_channel_get_state(channel);
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hungup %s %u %d\n", switch_channel_get_name(channel), state, CS_INIT);
 			switch_mutex_lock(tech_pvt->flag_mutex);
+			switch_set_flag(tech_pvt, TFLAG_TERM);
 			switch_set_flag(tech_pvt, TFLAG_BYE);
 			switch_clear_flag(tech_pvt, TFLAG_IO);
 			switch_mutex_unlock(tech_pvt->flag_mutex);
-			switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+			terminate_session(&session, SWITCH_CAUSE_NORMAL_CLEARING);
 
 			if (state <= CS_INIT && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroy unused Session\n");
-				switch_core_session_destroy(&session);
+				terminate_session(&session, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "End Call\n");
 			}

Modified: freeswitch/branches/james/src/mod/endpoints/mod_dingaling/mod_dingaling.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/endpoints/mod_dingaling/mod_dingaling.vcproj	(original)
+++ freeswitch/branches/james/src/mod/endpoints/mod_dingaling/mod_dingaling.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,15 +17,15 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_Dingaling Debug"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -65,12 +65,12 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="/NODEFAULTLIB:LIMBCTD"
-				AdditionalDependencies="libdingaling.lib Ws2_32.lib iksemel.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_dingaling.dll"
-				LinkIncremental="2"
+				AdditionalDependencies="Ws2_32.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\libdingaling\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\w32\vsnet\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\iksemel\$(OutDir)&quot;"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_dingaling.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_dingaling.lib"
 				TargetMachine="1"
@@ -102,15 +102,15 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_Dingaling Release"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -146,11 +146,12 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libdingaling.lib Ws2_32.lib iksemel.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_dingaling.dll"
+				AdditionalDependencies="Ws2_32.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\libdingaling\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\w32\vsnet\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\iksemel\$(OutDir)&quot;"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/endpoints/mod_exosip/mod_exosip.c
==============================================================================
--- freeswitch/branches/james/src/mod/endpoints/mod_exosip/mod_exosip.c	(original)
+++ freeswitch/branches/james/src/mod/endpoints/mod_exosip/mod_exosip.c	Tue Sep  5 08:41:27 2006
@@ -77,7 +77,9 @@
 	TFLAG_VAD_OUT = ( 1 << 13),
 	TFLAG_VAD = ( 1 << 14),
 	TFLAG_TIMER = ( 1 << 15),
-	TFLAG_AA = (1 << 16)
+	TFLAG_AA = (1 << 16),
+	TFLAG_PRE_ANSWER = (1 << 17),
+	TFLAG_REINVITE = (1 << 18)
 } TFLAGS;
 
 
@@ -349,13 +351,7 @@
 		tech_set_codecs(tech_pvt);
 
 
-		sprintf(dbuf, "%u", tech_pvt->te);
-		sdp_message_m_payload_add(tech_pvt->local_sdp, 0, osip_strdup(dbuf));
-		sdp_add_codec(tech_pvt->sdp_config, SWITCH_CODEC_TYPE_AUDIO, tech_pvt->te, "telephone-event", 8000, 0);
-		sprintf(dbuf, "%u telephone-event/8000", tech_pvt->te);
-		sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "rtpmap", osip_strdup(dbuf));
-		sprintf(dbuf, "%u 0-15", tech_pvt->te);
-		sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "fmtp", osip_strdup(dbuf));
+
 		
 		if (tech_pvt->num_codecs > 0) {
 			int i, lastcode = -1;
@@ -365,7 +361,7 @@
 			for (i = 0; i < tech_pvt->num_codecs; i++) {
 				imp = tech_pvt->codecs[i];
 
-				while(NULL != imp) {
+				if (imp) {
 					uint32_t sps = imp->samples_per_second;
 
 					if (lastcode != imp->ianacode) {
@@ -381,14 +377,18 @@
 					snprintf(tmp, sizeof(tmp), "%u %s/%d", imp->ianacode, imp->iananame, sps);
 					sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "rtpmap", osip_strdup(tmp));
 					memset(tmp, 0, sizeof(tmp));
-					if (imp) {
-						imp = imp->next;
-					}
 				} 
 			}
 		}
 
 
+		sprintf(dbuf, "%u", tech_pvt->te);
+		sdp_message_m_payload_add(tech_pvt->local_sdp, 0, osip_strdup(dbuf));
+		sdp_add_codec(tech_pvt->sdp_config, SWITCH_CODEC_TYPE_AUDIO, tech_pvt->te, "telephone-event", 8000, 0);
+		sprintf(dbuf, "%u telephone-event/8000", tech_pvt->te);
+		sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "rtpmap", osip_strdup(dbuf));
+		sprintf(dbuf, "%u 0-15", tech_pvt->te);
+		sdp_message_a_attribute_add(tech_pvt->local_sdp, 0, "fmtp", osip_strdup(dbuf));
 
 		/* Setup our INVITE */
 		eXosip_lock();
@@ -490,7 +490,7 @@
 {
 	int loops = 0;//, sock = -1;
 
-	if (tech_pvt->rtp_session) {
+	if (switch_rtp_ready(tech_pvt->rtp_session)) {
 		while (loops < 10 && (switch_test_flag(tech_pvt, TFLAG_READING) || switch_test_flag(tech_pvt, TFLAG_WRITING))) {
 			switch_yield(10000);
 			loops++;
@@ -518,10 +518,13 @@
 	channel = switch_core_session_get_channel(tech_pvt->session);
 	assert(channel != NULL);
 
-	if (tech_pvt->rtp_session) {
+
+	if (tech_pvt->rtp_session && !switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
 		return SWITCH_STATUS_SUCCESS;
 	}
 
+
+
 	if (switch_test_flag(tech_pvt, TFLAG_USING_CODEC)) {
 		bw = tech_pvt->read_codec.implementation->bits_per_second;
 		ms = tech_pvt->read_codec.implementation->microseconds_per_frame;
@@ -557,6 +560,22 @@
 		flags |= SWITCH_RTP_FLAG_AUTOADJ;
 	}
 
+
+	if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
+		switch_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
+		
+		if (switch_rtp_set_remote_address(tech_pvt->rtp_session,
+										  tech_pvt->remote_sdp_audio_ip,
+										  tech_pvt->remote_sdp_audio_port,
+										  &err) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP REPORTS ERROR: [%s]\n", err);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP CHANGING DEST TO: [%s:%d]\n", 
+							  tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
+		}
+		return SWITCH_STATUS_SUCCESS;
+	}
+
 	tech_pvt->rtp_session = switch_rtp_new(tech_pvt->local_sdp_audio_ip,
 										   tech_pvt->local_sdp_audio_port,
 										   tech_pvt->remote_sdp_audio_ip,
@@ -568,7 +587,7 @@
 										   key,
 										   &err, switch_core_session_get_pool(tech_pvt->session));
 
-	if (tech_pvt->rtp_session) {
+	if (switch_rtp_ready(tech_pvt->rtp_session)) {
 		uint8_t vad_in = switch_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0;
 		uint8_t vad_out = switch_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0;
 		uint8_t inb = switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? 0 : 1;
@@ -821,7 +840,7 @@
 	switch_clear_flag_locked(tech_pvt, TFLAG_IO);
 	switch_set_flag_locked(tech_pvt, TFLAG_BYE);
 
-	if (tech_pvt->rtp_session) {
+	if (switch_rtp_ready(tech_pvt->rtp_session)) {
 		switch_rtp_kill_socket(tech_pvt->rtp_session);
 	}
 
@@ -1000,11 +1019,13 @@
 static int del_callback(void *pArg, int argc, char **argv, char **columnNames){
 	switch_event_t *s_event;
 
-	if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_EXPIRE) == SWITCH_STATUS_SUCCESS) {
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "key", "%s", argv[0]);
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "url", "%s", argv[1]);
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%d", argv[2]);
-		switch_event_fire(&s_event);
+	if (argc >=3 ) {
+		if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_EXPIRE) == SWITCH_STATUS_SUCCESS) {
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "key", "%s", argv[0]);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "url", "%s", argv[1]);
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%d", argv[2]);
+			switch_event_fire(&s_event);
+		}
 	}
 	return 0;
 }
@@ -1057,10 +1078,18 @@
 static switch_status_t exosip_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
 											 switch_core_session_t **new_session, switch_memory_pool_t *pool)
 {
+
+	if (!outbound_profile->destination_number) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid Destination!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
+
 	if ((*new_session = switch_core_session_request(&exosip_endpoint_interface, pool)) != 0) {
 		struct private_object *tech_pvt;
 		switch_channel_t *channel;
 
+
 		switch_core_session_add_stream(*new_session, NULL);
 		if ((tech_pvt =
 			 (struct private_object *) switch_core_session_alloc(*new_session, sizeof(struct private_object))) != 0) {
@@ -1215,6 +1244,7 @@
 
 		snprintf(name, sizeof(name), "Exosip/%s-%04x", event->request->from->url->username, rand() & 0xffff);
 		switch_channel_set_name(channel, name);
+		switch_channel_set_variable(channel, "endpoint_disposition", "INVITE");
 
 		if (osip_message_header_get_byname (event->request, "SrtpRealm", 0, &tedious)) {
 			tech_pvt->realm = switch_core_session_strdup(session, osip_header_get_value(tedious));
@@ -1325,7 +1355,7 @@
 			static const switch_codec_implementation_t *imp = NULL;
 
 			for (i = 0; i < tech_pvt->num_codecs; i++) {
-				for (imp = tech_pvt->codecs[i]; imp; imp = imp->next) {
+				if ((imp = tech_pvt->codecs[i])) {
 					sdp_add_codec(tech_pvt->sdp_config,
 								  tech_pvt->codecs[i]->codec_type,
 								  imp->ianacode,
@@ -1498,22 +1528,34 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "destroy %s\n", switch_channel_get_name(channel));
 	exosip_kill_channel(tech_pvt->session, SWITCH_SIG_KILL);
 
+
 	switch (event->type) {
 	case EXOSIP_CALL_RELEASED:
+		switch_channel_set_variable(channel, "endpoint_disposition", "RELEASED");
+		cause = SWITCH_CAUSE_NORMAL_CLEARING;
+		break;
 	case EXOSIP_CALL_CLOSED:
+		switch_channel_set_variable(channel, "endpoint_disposition", "CLOSED");
 		cause = SWITCH_CAUSE_NORMAL_CLEARING;
 		break;
 	case EXOSIP_CALL_NOANSWER:
+		switch_channel_set_variable(channel, "endpoint_disposition", "NO ANSWER");
 		cause = SWITCH_CAUSE_NO_ANSWER;
 		break;
 	case EXOSIP_CALL_REQUESTFAILURE:
+		switch_channel_set_variable(channel, "endpoint_disposition", "REQUEST FAILURE");
 		cause = SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL;
 		break;
 	case EXOSIP_CALL_SERVERFAILURE:
+		switch_channel_set_variable(channel, "endpoint_disposition", "SERVER FAILURE");
+		cause = SWITCH_CAUSE_CALL_REJECTED;
+		break;
 	case EXOSIP_CALL_GLOBALFAILURE:
+		switch_channel_set_variable(channel, "endpoint_disposition", "GLOBAL FAILURE");
 		cause = SWITCH_CAUSE_CALL_REJECTED;
 		break;
 	default:
+		switch_channel_set_variable(channel, "endpoint_disposition", "UNKNOWN");
 		cause = SWITCH_CAUSE_SWITCH_CONGESTION;
 		break;
 	}
@@ -1690,8 +1732,103 @@
 }
 
 
-static void handle_answer(eXosip_event_t * event)
+static int handle_call_transfer(eXosip_event_t *event)
 {
+    osip_message_t *sip = event->request;
+    osip_header_t *refer_hdr;
+	int res;
+
+    if (osip_message_header_get_byname (sip, "Refer-To", 0, &refer_hdr) < 0) {
+		eXosip_call_send_answer(event->tid, 400, NULL);
+		return 0;
+    }
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,  "Refer: %s\n", refer_hdr->hvalue);
+
+	res = eXosip_call_send_answer(event->tid, 202, NULL);
+    if (res) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "message_send_answer info failed! %d\n", event->tid);
+    }
+
+	{
+		osip_from_t *refer = NULL;
+		osip_uri_t *refer_uri = NULL;
+		char *refer_str = NULL;
+		
+		if (osip_from_init(&refer) < 0) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Memory error\n");
+			return -1;
+		}
+
+		if (osip_from_parse(refer, refer_hdr->hvalue) < 0) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parse error\n");
+			osip_from_free(refer);
+			refer = NULL;
+			return -1;
+		}
+
+		refer_uri = osip_from_get_url (refer);
+
+		if (osip_uri_to_str(refer_uri, &refer_str) < 0) {
+			osip_from_free(refer);
+			return -1;
+		}
+
+		printf("TEST %s\n", refer_str);
+#if 0
+
+		transfer_to = opbx_bridged_channel(p->owner);
+		if (transfer_to) {
+			/* 	    int extout = 0; */
+
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,  "Got SIP blind transfer, applying to '%s'\n", transfer_to->name);
+
+            /* Must release c's lock now, because it will not longer
+			   be accessible after the transfer! */
+			*nounlock = true;
+
+			/* 	    opbx_setstate(transfer_to, OPBX_STATE_RING); */
+			/* 	    hook_channel(transfer_to, NULL); */
+
+			opbx_mutex_unlock(&p->owner->lock);
+			/* 	    opbx_masq_park_call(p->owner, NULL, 0, &extout); */
+
+			/* 	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,  "Parked to %d\n", extout); */
+
+			opbx_async_goto(transfer_to, p->friend->context, refer_str, 1);
+
+			{
+				osip_message_t *req = NULL;
+				if (eXosip_call_build_notify(event->did,
+											 EXOSIP_SUBCRSTATE_ACTIVE,
+											 &req) < 0) {
+					opbx_log(LOG_WARNING, "eXosip_call_build_notify failed\n");
+				} else {
+					const char sip_frag[] = "SIP/2.0 100 Trying\r\n\r\n";
+					osip_message_set_header(req, osip_strdup("Event"),
+											osip_strdup("refer"));
+					osip_message_set_body(req, sip_frag, strlen(sip_frag));
+					osip_message_set_content_type(req, "message/sipfrag");
+					if (eXosip_call_send_request(event->did, req) < 0) {
+						opbx_log(LOG_WARNING,
+								 "eXosip_call_send_request failed\n");
+					} else {
+						opbx_log(LOG_DEBUG, "Notify ok\n");
+					}
+				}
+			}
+		} else {
+			opbx_log(LOG_WARNING, "No channel up!");
+		}
+#endif
+		osip_free(refer_str);
+		osip_from_free(refer);
+    }
+    return 0;
+}
+
+static void handle_answer(eXosip_event_t *event)
+{
 	osip_message_t *ack = NULL;
 	sdp_message_t *remote_sdp = NULL;
 	sdp_connection_t *conn = NULL;
@@ -1700,32 +1837,78 @@
 	char *dpayload = NULL, *dname = NULL, *drate = NULL;
 	switch_channel_t *channel;
 	const switch_codec_implementation_t *imp = NULL;
+	uint8_t pre_answer = 0, reinvite = 0, isack = 0;
 
+
 	if ((tech_pvt = get_pvt_by_call_id(event->cid)) == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cannot answer nonexistant call [%d]!\n", event->cid);
 		return;
 	}
 
+	if (event->type == EXOSIP_CALL_RINGING) {
+		pre_answer = 1;
+		if (switch_test_flag(tech_pvt, TFLAG_PRE_ANSWER)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "one pre-answer is enough for call [%d]!\n", event->cid);
+			return;
+		}
+	} else if (event->type == EXOSIP_CALL_REINVITE) {
+		reinvite = 1;
+	} else if (event->type == EXOSIP_CALL_ACK) {
+		isack = 1;
+	}
+
 	channel = switch_core_session_get_channel(tech_pvt->session);
 	assert(channel != NULL);
 
-	if (!event->response) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Someone answered... with no SDP information - WTF?!?\n");
-		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-		return;
-	}
 
-	/* Get all of the remote SDP elements... stuff */
-	if ((remote_sdp = eXosip_get_sdp_info(event->response)) == 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cant Find SDP?\n");
-		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-		return;
+	if (reinvite || isack) {
+		if ((remote_sdp = eXosip_get_sdp_info(event->request)) == 0) {
+			if (!isack) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cant Find SDP?\n");
+				switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+			}
+			return;
+		}
+	} else {
+
+		if (!event->response) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Someone answered... with no SDP information - WTF?!?\n");
+			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+			return;
+		}
+
+
+		/* Get all of the remote SDP elements... stuff */
+		if ((remote_sdp = eXosip_get_sdp_info(event->response)) == 0) {
+			/* Exosip is daft, they send the same event for both 180 and 183 WTF!!*/
+			if (!pre_answer) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cant Find SDP?\n");
+				switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "I am daft, don't mind me.\n");
+			}
+		
+			return;
+		}
 	}
 
+	switch_channel_set_variable(channel, "endpoint_disposition", "ANSWER");
 
 	conn = eXosip_get_audio_connection(remote_sdp);
 	remote_med = eXosip_get_audio_media(remote_sdp);
 
+	if (!strcmp(conn->c_addr, "0.0.0.0")) {
+		eXosip_lock();
+		eXosip_call_build_ack(event->did, &ack);
+		eXosip_call_send_ack(event->did, ack);
+		eXosip_unlock();
+
+		switch_safe_free(dname);
+		switch_safe_free(drate);
+		switch_safe_free(dpayload);
+		return;
+	}
+	
 	/* Grab IP/port */
 	tech_pvt->remote_sdp_audio_port = (switch_port_t)atoi(remote_med->m_port);
 	snprintf(tech_pvt->remote_sdp_audio_ip, 50, conn->c_addr);
@@ -1738,7 +1921,22 @@
 	/* Assign them thar IDs */
 	tech_pvt->did = event->did;
 	tech_pvt->tid = event->tid;
-	{
+
+	
+	if (switch_test_flag(tech_pvt, TFLAG_USING_CODEC) && strcasecmp(dname, tech_pvt->read_codec.implementation->iananame)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Changing Codec from %s to %s\n", tech_pvt->read_codec.implementation->iananame, dname);
+		switch_core_codec_destroy(&tech_pvt->read_codec);
+		switch_core_codec_destroy(&tech_pvt->write_codec);
+		switch_core_session_reset(tech_pvt->session);
+		switch_clear_flag_locked(tech_pvt, TFLAG_USING_CODEC);
+	}
+
+	if (reinvite || isack) {
+		switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
+	}
+
+	if (!switch_test_flag(tech_pvt, TFLAG_USING_CODEC)) {
+	
 		int rate = atoi(drate);
 		int ms = globals.codec_ms;
 
@@ -1785,7 +1983,7 @@
 		}
 	}
 
-
+	
 	eXosip_lock();
 	eXosip_call_build_ack(event->did, &ack);
 	eXosip_call_send_ack(event->did, ack);
@@ -1806,11 +2004,18 @@
 	if (switch_test_flag(tech_pvt, TFLAG_RTP)) {
 		channel = switch_core_session_get_channel(tech_pvt->session);
 		assert(channel != NULL);
-		switch_channel_answer(channel);
+		if (pre_answer) {
+			switch_set_flag_locked(tech_pvt, TFLAG_PRE_ANSWER);
+			switch_channel_pre_answer(channel);
+		} else {
+			switch_channel_answer(channel);
+		} 
 	}
 }
 
 
+
+
 static const char *event_names[] = {
       "EXOSIP_REGISTRATION_NEW",         
       "EXOSIP_REGISTRATION_SUCCESS",     
@@ -2171,14 +2376,15 @@
 			break;
 		case EXOSIP_CALL_REINVITE:
 			/* See what the reinvite is about - on hold or whatever */
-			//handle_reinvite(event);
+			handle_answer(event);
 			break;
 		case EXOSIP_CALL_MESSAGE_NEW:
 			if (event->request != NULL && MSG_IS_REFER(event->request)) {
-				//handle_call_transfer(event);
+				handle_call_transfer(event);
 			}
 			break;
 		case EXOSIP_CALL_ACK:
+			handle_answer(event);
 			/* If audio is not flowing and this has SDP - fire it up! */
 			break;
 		case EXOSIP_CALL_ANSWERED:
@@ -2188,7 +2394,7 @@
 			/* This is like a 100 Trying... yeah */
 			break;
 		case EXOSIP_CALL_RINGING:
-			//handle_ringing(event);
+			handle_answer(event);
 			break;
 		case EXOSIP_CALL_REDIRECTED:
 			break;

Modified: freeswitch/branches/james/src/mod/endpoints/mod_exosip/mod_exosip.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/endpoints/mod_exosip/mod_exosip.vcproj	(original)
+++ freeswitch/branches/james/src/mod/endpoints/mod_exosip/mod_exosip.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,15 +17,15 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_Exosip Debug"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -43,7 +43,7 @@
 				Name="VCCLCompilerTool"
 				AdditionalOptions="/D _CRT_SECURE_NO_DEPRECATE"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libs\include;..\..\..\..\libs\libeXosip2\include;..\..\..\..\libs\osip\include;..\..\..\..\libs\osip\src\osipparser2;."
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\libeXosip2-2.2.2\include&quot;;&quot;$(InputDir)..\..\..\..\libs\libosip2-2.2.2\include&quot;;&quot;$(InputDir)..\..\..\..\libs\libosip2-2.2.2\src\osipparser2&quot;;."
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
 				GeneratePreprocessedFile="0"
 				MinimalRebuild="true"
@@ -53,7 +53,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -67,15 +67,15 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="/NODEFAULTLIB:LIBCMT"
-				AdditionalDependencies="Ws2_32.lib Iphlpapi.lib libcpmt.lib eXosip.lib osipparser2.lib osip2.lib"
+				AdditionalDependencies="Ws2_32.lib Iphlpapi.lib libcpmt.lib"
 				ShowProgress="0"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_exosip.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\libeXosip2\platform\vsnet\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\osip\platform\vsnet\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\w32\vsnet\$(OutDir)&quot;"
 				IgnoreAllDefaultLibraries="false"
 				IgnoreDefaultLibraryNames=""
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_exosip.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_exosip.lib"
 				TargetMachine="1"
@@ -107,15 +107,15 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_Exosip Release"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -131,7 +131,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libs\include;..\..\..\..\libs\libeXosip2\include;..\..\..\..\libs\osip\include;..\..\..\..\libs\osip\src\osipparser2;."
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\libeXosip2-2.2.2\include&quot;;&quot;$(InputDir)..\..\..\..\libs\libosip2-2.2.2\include&quot;;&quot;$(InputDir)..\..\..\..\libs\libosip2-2.2.2\src\osipparser2&quot;;."
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
 				RuntimeLibrary="0"
 				UsePrecompiledHeader="0"
@@ -151,11 +151,12 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib Iphlpapi.lib libcpmt.lib eXosip.lib osipparser2.lib osip2.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_exosip.dll"
+				AdditionalDependencies="Ws2_32.lib Iphlpapi.lib libcpmt.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\libeXosip2\platform\vsnet\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\osip\platform\vsnet\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\w32\vsnet\$(OutDir)&quot;"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/endpoints/mod_iax/mod_iax.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/endpoints/mod_iax/mod_iax.vcproj	(original)
+++ freeswitch/branches/james/src/mod/endpoints/mod_iax/mod_iax.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,15 +17,15 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_iax Debug"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 				DisableSpecificWarnings="4201"
 			/>
 			<Tool
@@ -65,12 +65,12 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib Iphlpapi.lib libiax2.lib Winmm.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_iax.dll"
-				LinkIncremental="2"
+				AdditionalDependencies="Ws2_32.lib Iphlpapi.lib Winmm.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\iax\$(OutDir)&quot;;&quot;..\..\..\..\w32\vsnet\$(OutDir)&quot;"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_iax.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_iax.lib"
 				TargetMachine="1"
@@ -102,15 +102,15 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_iax Release"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -147,11 +147,12 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib Iphlpapi.lib libiax2.lib Winmm.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_iax.dll"
+				AdditionalDependencies="Ws2_32.lib Iphlpapi.lib Winmm.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\iax\$(OutDir)&quot;;&quot;..\..\..\..\w32\vsnet\$(OutDir)&quot;"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/endpoints/mod_portaudio/mod_PortAudio.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/endpoints/mod_portaudio/mod_PortAudio.vcproj	(original)
+++ freeswitch/branches/james/src/mod/endpoints/mod_portaudio/mod_PortAudio.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,15 +17,15 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_PortAudio Debug"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -42,7 +42,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\portaudio\pa_common&quot;;&quot;$(InputDir)..\..\..\..\libs\portaudio\pa_win_wmme&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\portaudio_v18_1\pa_common&quot;;&quot;$(InputDir)..\..\..\..\libs\portaudio_v18_1\pa_win_wmme&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -65,12 +65,12 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="/NODEFAULTLIB:LIMBCTD"
-				AdditionalDependencies="Ws2_32.lib Iphlpapi.lib  PAStaticWMMED.lib Winmm.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_PortAudio.dll"
-				LinkIncremental="2"
+				AdditionalDependencies="Ws2_32.lib Iphlpapi.lib  Winmm.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\portaudio\winvc\Lib&quot;;..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_PortAudio.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_PortAudio.lib"
 				TargetMachine="1"
@@ -102,15 +102,15 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_PortAudio Release"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -126,7 +126,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\portaudio\pa_common&quot;;&quot;$(InputDir)..\..\..\..\libs\portaudio\pa_win_wmme&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\portaudio_v18_1\pa_common&quot;;&quot;$(InputDir)..\..\..\..\libs\portaudio_v18_1\pa_win_wmme&quot;"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
 				RuntimeLibrary="0"
 				UsePrecompiledHeader="0"
@@ -146,11 +146,12 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="Ws2_32.lib Iphlpapi.lib  PAStaticWMME.lib Winmm.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_PortAudio.dll"
+				AdditionalDependencies="Ws2_32.lib Iphlpapi.lib Winmm.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\portaudio\winvc\Lib&quot;;..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/endpoints/mod_woomera/mod_woomera.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/endpoints/mod_woomera/mod_woomera.vcproj	(original)
+++ freeswitch/branches/james/src/mod/endpoints/mod_woomera/mod_woomera.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_woomera.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_woomera.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_woomera.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_woomera.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/event_handlers/mod_cdr/mod_cdr.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/event_handlers/mod_cdr/mod_cdr.vcproj	(original)
+++ freeswitch/branches/james/src/mod/event_handlers/mod_cdr/mod_cdr.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_cdr.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_cdr.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_cdr.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_cdr.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"
@@ -226,11 +227,11 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="mysqlclient.lib ws2_32.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_cdr.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="2"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\Debug;&quot;C:\Program Files\MySQL\MySQL Server 5.0\lib\debug&quot;"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_cdr.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_cdr.lib"
 				TargetMachine="1"
@@ -306,10 +307,11 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalDependencies="mysqlclient.lib ws2_32.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_cdr.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;..\..\..\..\w32\vsnet\Release&quot;;&quot;C:\Program Files\MySQL\MySQL Server 5.0\lib\opt&quot;"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.vcproj	(original)
+++ freeswitch/branches/james/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_event_multicast.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_event_multicast.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_event_multicast.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_event_multicast.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/branches/james/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	(original)
+++ freeswitch/branches/james/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	Tue Sep  5 08:41:27 2006
@@ -31,7 +31,6 @@
  */
 #include <switch.h>
 #define CMD_BUFLEN 1024 * 1000
-#define IS_BREAK(x) ((int)x || SWITCH_STATUS_BREAK || (int)x == 730035 || (int)x == 35)
 
 static const char modname[] = "mod_event_socket";
 static char *MARKER = "1";
@@ -58,7 +57,8 @@
 	uint32_t flags;
 	switch_log_level_t level;
 	char *retbuf;
-	uint8_t event_list[SWITCH_EVENT_ALL];
+	char *ebuf;
+	uint8_t event_list[SWITCH_EVENT_ALL+1];
 	switch_hash_t *event_hash;
 	struct listener *next;
 };
@@ -68,6 +68,7 @@
 static struct {
 	switch_socket_t *sock;
 	switch_mutex_t *mutex;
+	switch_mutex_t *sock_mutex;
 	listener_t *listeners;
 	uint8_t ready;
 } listen_list;
@@ -152,26 +153,29 @@
 
 
 static void close_socket(switch_socket_t **sock) {
-
+	switch_mutex_lock(listen_list.sock_mutex);
 	if (*sock) {
 		apr_socket_shutdown(*sock, APR_SHUTDOWN_READWRITE);
 		switch_socket_close(*sock);
 		*sock = NULL;
 	}
+	switch_mutex_unlock(listen_list.sock_mutex);
 }
 
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
 {
 	listener_t *l;
 
+	close_socket(&listen_list.sock);
+
 	switch_mutex_lock(listen_list.mutex);
 	for (l = listen_list.listeners; l; l = l->next) {
 		close_socket(&l->sock);
 	}
 	switch_mutex_unlock(listen_list.mutex);
 
-	close_socket(&listen_list.sock);
 
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -331,11 +335,15 @@
 					switch_event_t *event = (switch_event_t *) pop;
 					char *etype, *packet, *xmlstr = NULL;
 
+					if (!listener->ebuf) {
+						listener->ebuf = switch_core_alloc(listener->pool, CMD_BUFLEN);
+					}
+
 					do_sleep = 0;
 					if (listener->format == EVENT_FORMAT_PLAIN) {
 						etype = "plain";
-						switch_event_serialize(event, buf, sizeof(buf), NULL);
-						packet = buf;
+						switch_event_serialize(event, listener->ebuf, CMD_BUFLEN, NULL);
+						packet = listener->ebuf;
 					} else {
 						switch_xml_t xml;
 						etype = "xml";
@@ -646,7 +654,7 @@
 }
 
 
-/* Create a thread for the conference and launch it */
+/* Create a thread for the socket and launch it */
 static void launch_listener_thread(listener_t *listener)
 {
 	switch_thread_t *thread;
@@ -718,8 +726,9 @@
 	}
 
 	switch_mutex_init(&listen_list.mutex, SWITCH_MUTEX_NESTED, pool);
-
+	switch_mutex_init(&listen_list.sock_mutex, SWITCH_MUTEX_NESTED, pool);
 	
+	
 	for(;;) {
 		rv = switch_sockaddr_info_get(&sa, prefs.ip, APR_INET, prefs.port, 0, pool);
 		if (rv) goto fail;
@@ -767,11 +776,12 @@
 
 		listener->sock = inbound_socket;
 		listener->pool = listener_pool;
+		listener_pool = NULL;
 		listener->format = EVENT_FORMAT_PLAIN;
-		switch_mutex_init(&listener->flag_mutex, SWITCH_MUTEX_NESTED, listener_pool);
-		switch_core_hash_init(&listener->event_hash, listener_pool);
-
+		switch_mutex_init(&listener->flag_mutex, SWITCH_MUTEX_NESTED, listener->pool);
+		switch_core_hash_init(&listener->event_hash, listener->pool);
 		launch_listener_thread(listener);
+		
 	}
 
 	close_socket(&listen_list.sock);

Modified: freeswitch/branches/james/src/mod/event_handlers/mod_event_socket/mod_event_socket.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/event_handlers/mod_event_socket/mod_event_socket.vcproj	(original)
+++ freeswitch/branches/james/src/mod/event_handlers/mod_event_socket/mod_event_socket.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_event_socket.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_event_socket.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_event_socket.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_event_socket.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/event_handlers/mod_event_test/mod_event_test.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/event_handlers/mod_event_test/mod_event_test.vcproj	(original)
+++ freeswitch/branches/james/src/mod/event_handlers/mod_event_test/mod_event_test.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_event_test.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_event_test.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_event_test.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_event_test.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c
==============================================================================
--- freeswitch/branches/james/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c	(original)
+++ freeswitch/branches/james/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.c	Tue Sep  5 08:41:27 2006
@@ -148,7 +148,18 @@
 
 static int on_result(struct session *sess, ikspak * pak)
 {
+	iks *msg, *ctag;
 
+	msg = iks_make_pres (IKS_SHOW_AVAILABLE, "Available"); 
+	ctag = iks_insert(msg, "c");
+	iks_insert_attrib(ctag, "node", "http://www.freeswitch.org/xmpp/client/caps");
+	iks_insert_attrib(ctag, "ver", "1.0.0.1");
+	iks_insert_attrib(ctag, "client", "libdingaling");
+	iks_insert_attrib(ctag, "xmlns", "http://jabber.org/protocol/caps");
+
+	iks_send(sess->parser, msg);
+    iks_delete(msg);
+
 	return IKS_FILTER_EAT;
 }
 
@@ -218,6 +229,23 @@
 	return IKS_OK;
 }
 
+
+static int on_subscribe(void *user_data, ikspak *pak)
+{
+	char *from = iks_find_attrib(pak->x, "from");
+	struct session *sess = (struct session *) user_data;
+
+	iks *msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, from, "mod_xmpp_event"); 
+	iks_send(sess->parser, msg);
+	iks_delete(msg);
+		
+	msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, from, "mod_xmpp_event"); 
+	iks_send(sess->parser, msg);
+	iks_delete(msg);
+
+	return IKS_FILTER_EAT;
+}
+
 static int on_msg(void *user_data, ikspak * pak)
 {
 	char *cmd = iks_find_cdata(pak->x, "body");
@@ -225,6 +253,7 @@
 	switch_stream_handle_t stream = {0};
 	char retbuf[2048] = "";
 	char *p;
+	iks *msg;
 
 	if ((p = strchr(cmd, '\r')) != 0) {
 		*p++ = '\0';
@@ -242,6 +271,13 @@
 	stream.write_function = switch_console_stream_write;
 	switch_api_execute(cmd, arg, NULL, &stream);
 
+	
+	msg = iks_make_msg(IKS_TYPE_NONE, globals.target_jid, retbuf);
+	iks_insert_attrib(msg, "subject", "Reply");
+	iks_send(globals.session.parser, msg);
+	iks_delete(msg);
+	
+
 	return 0;
 }
 
@@ -276,6 +312,12 @@
 	iks_filter_add_rule(my_filter, on_error, sess,
 						IKS_RULE_TYPE, IKS_PAK_IQ,
 						IKS_RULE_SUBTYPE, IKS_TYPE_ERROR, IKS_RULE_ID, "auth", IKS_RULE_DONE);
+
+	iks_filter_add_rule(my_filter, on_subscribe, sess,
+						IKS_RULE_TYPE, IKS_PAK_S10N,
+						IKS_RULE_SUBTYPE, IKS_TYPE_SUBSCRIBE,
+						IKS_RULE_DONE);
+
 }
 
 static void xmpp_connect(char *jabber_id, char *pass)

Modified: freeswitch/branches/james/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.vcproj	(original)
+++ freeswitch/branches/james/src/mod/event_handlers/mod_xmpp_event/mod_xmpp_event.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,15 +17,15 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_XMPPEvent Debug"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -42,7 +42,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\iksemel\include&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\iksemel-1.2\include&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -64,12 +64,13 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="FreeSwitchCore.lib iksemel.lib Ws2_32.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_xmpp_event.dll"
-				LinkIncremental="2"
+				AdditionalDependencies="Ws2_32.lib"
+				ShowProgress="0"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;..\..\..\..\w32\vsnet\$(OutDir)&quot;;&quot;..\..\..\..\libs\iksemel\$(OutDir)&quot;"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_xmpp_event.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_xmpp_event.lib"
 				TargetMachine="1"
@@ -101,15 +102,15 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_XMPPEvent Release"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -125,7 +126,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\iksemel\include&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\iksemel-1.2\include&quot;"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
@@ -145,11 +146,13 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="FreeSwitchCore.lib iksemel.lib Ws2_32.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_xmpp_event.dll"
+				AdditionalDependencies="Ws2_32.lib"
+				ShowProgress="0"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;..\..\..\..\w32\vsnet\$(OutDir)&quot;;&quot;..\..\..\..\libs\iksemel\$(OutDir)&quot;"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.vcproj	(original)
+++ freeswitch/branches/james/src/mod/event_handlers/mod_zeroconf/mod_zeroconf.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,15 +17,15 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot;  Mod_zeroconf Debug"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -42,7 +42,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\howl\include&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\howl-1.0.0\include&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -64,12 +64,12 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies=" libhowld.lib libmDNSResponderd.lib Ws2_32.lib  iphlpapi.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_zeroconf.dll"
-				LinkIncremental="2"
+				AdditionalDependencies="Ws2_32.lib  iphlpapi.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\howl\src\lib\howl\Win32\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\howl\src\lib\mDNSResponder\Win32\$(OutDir)&quot;;&quot;..\..\..\..\w32\vsnet\$(OutDir)&quot;"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_zeroconf.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_zeroconf.lib"
 				TargetMachine="1"
@@ -101,15 +101,15 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot;  Mod_zeroconf Release"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -125,7 +125,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\howl\include&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\howl-1.0.0\include&quot;"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
 				RuntimeLibrary="0"
 				UsePrecompiledHeader="0"
@@ -145,11 +145,12 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies=" libhowl.lib libmDNSResponder.lib Ws2_32.lib iphlpapi.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_zeroconf.dll"
+				AdditionalDependencies="Ws2_32.lib iphlpapi.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\libs\howl\src\lib\howl\Win32\$(OutDir)&quot;;&quot;$(InputDir)..\..\..\..\libs\howl\src\lib\mDNSResponder\Win32\$(OutDir)&quot;;&quot;..\..\..\..\w32\vsnet\$(OutDir)&quot;"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/languages/mod_perl/fs_perl.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/languages/mod_perl/fs_perl.vcproj	(original)
+++ freeswitch/branches/james/src/mod/languages/mod_perl/fs_perl.vcproj	Tue Sep  5 08:41:27 2006
@@ -50,7 +50,7 @@
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,8 +63,9 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="$(OutDir)\Perl\$(ProjectName).dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/Perl/$(InputName).dll"
+				Version=""
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\w32\vsnet\$(ConfigurationName)&quot;"
 				GenerateDebugInformation="true"
 				SubSystem="2"
@@ -142,7 +143,8 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="$(OutDir)\Perl\$(ProjectName).dll"
+				OutputFile="$(SolutionDir)$(OutDir)/Perl/$(InputName).dll"
+				Version=""
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\..\..\w32\vsnet\$(ConfigurationName)&quot;"
 				GenerateDebugInformation="true"

Modified: freeswitch/branches/james/src/mod/languages/mod_perl/mod_perl.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/languages/mod_perl/mod_perl.vcproj	(original)
+++ freeswitch/branches/james/src/mod/languages/mod_perl/mod_perl.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -52,7 +52,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -65,11 +65,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_perl.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_perl.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_perl.lib"
 				TargetMachine="1"
@@ -101,8 +101,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -146,10 +146,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_perl.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/james/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/branches/james/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Tue Sep  5 08:41:27 2006
@@ -149,6 +149,262 @@
 };
 
 
+/* Event Object */
+/*********************************************************************************/
+static JSBool event_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	if (argc > 0) {
+		switch_event_t *event;
+		switch_event_types_t etype;
+		char *ename = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+
+		if (switch_name_event(ename, &etype) != SWITCH_STATUS_SUCCESS) {
+			*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+			return JS_TRUE;
+		}
+
+		if (etype == SWITCH_EVENT_CUSTOM) {
+			char *subclass_name;
+			if (argc < 1) {
+				*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+				return JS_TRUE;
+			}
+			
+			subclass_name = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+			if (switch_event_create_subclass(&event, etype, subclass_name) != SWITCH_STATUS_SUCCESS) {
+				*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+				return JS_TRUE;
+			}
+
+		} else {
+			if (!switch_event_create(&event, etype) != SWITCH_STATUS_SUCCESS) {
+				*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+				return JS_TRUE;
+			}
+		}
+
+		JS_SetPrivate(cx, obj, event);
+		return JS_TRUE;
+	}
+
+	return JS_FALSE;
+}
+
+static void event_destroy(JSContext *cx, JSObject *obj)
+{
+	switch_event_t *event = JS_GetPrivate(cx, obj);
+
+	if (event) {
+		switch_event_destroy(&event);
+	}
+}
+
+static JSBool event_add_header(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	switch_event_t *event = JS_GetPrivate(cx, obj);
+
+	if (!event) {
+		*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+		return JS_TRUE;
+	}
+
+	if (argc > 1) {
+		char *hname = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		char *hval = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, hname, hval);
+		*rval = BOOLEAN_TO_JSVAL( JS_TRUE );
+		return JS_TRUE;
+	}
+
+	*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+	return JS_TRUE;
+}
+
+static JSBool event_get_header(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	switch_event_t *event = JS_GetPrivate(cx, obj);
+
+	if (!event) {
+		*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+		return JS_TRUE;
+	}
+
+	if (argc > 0) {
+		char *hname = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		char *val = switch_event_get_header(event, hname);
+		*rval = STRING_TO_JSVAL (JS_NewStringCopyZ(cx, val));
+		return JS_TRUE;
+	}
+
+	*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+	return JS_TRUE;
+}
+
+static JSBool event_add_body(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	switch_event_t *event = JS_GetPrivate(cx, obj);
+
+	if (!event) {
+		*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+		return JS_TRUE;
+	}
+
+	if (argc > 0) {
+		char *body = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		switch_event_add_body(event, body);
+		*rval = BOOLEAN_TO_JSVAL( JS_TRUE );
+		return JS_TRUE;
+	}
+
+	*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+	return JS_TRUE;
+}
+
+static JSBool event_get_body(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	switch_event_t *event = JS_GetPrivate(cx, obj);
+
+	if (!event) {
+		*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+		return JS_TRUE;
+	}
+
+	*rval = STRING_TO_JSVAL (JS_NewStringCopyZ(cx, switch_event_get_body(event)));
+
+	return JS_TRUE;
+}
+
+static JSBool event_serialize(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	switch_event_t *event = JS_GetPrivate(cx, obj);
+	char buf[1024];
+	uint8_t isxml = 0;
+
+	if (!event) {
+		*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+		return JS_TRUE;
+	}
+
+	if (argc > 0) {
+		char *arg = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		if (!strcasecmp(arg, "xml")) {
+			isxml++;
+		}
+	}
+
+	if (isxml) {
+		switch_xml_t xml;
+		char *xmlstr;
+		if ((xml = switch_event_xmlize(event, NULL))) {
+            xmlstr = switch_xml_toxml(xml);
+			*rval = STRING_TO_JSVAL (JS_NewStringCopyZ(cx, xmlstr));
+			switch_xml_free(xml);
+            free(xmlstr);
+		} else {
+			*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+		}
+	} else {
+		switch_event_serialize(event, buf, sizeof(buf), NULL);
+		*rval = STRING_TO_JSVAL (JS_NewStringCopyZ(cx, buf));
+	}
+
+	return JS_TRUE;
+}
+
+static JSBool event_fire(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	switch_event_t *event = JS_GetPrivate(cx, obj);
+
+	if (event) {
+		switch_event_fire(&event);
+		JS_SetPrivate(cx, obj, NULL);
+		*rval = BOOLEAN_TO_JSVAL( JS_TRUE );
+		return JS_TRUE;
+	}
+
+	*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+	return JS_TRUE;
+}
+
+static JSBool event_destroy_(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	switch_event_t *event = JS_GetPrivate(cx, obj);
+
+	if (event) {
+		switch_event_destroy(&event);
+		JS_SetPrivate(cx, obj, NULL);
+		*rval = BOOLEAN_TO_JSVAL( JS_TRUE );
+		return JS_TRUE;
+	}
+
+	*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+	return JS_TRUE;
+}
+
+
+
+enum event_tinyid {
+	EVENT_READY
+};
+
+static JSFunctionSpec event_methods[] = {
+	{"addHeader", event_add_header, 1},
+	{"getHeader", event_get_header, 1},
+	{"addBody", event_add_body, 1},
+	{"getBody", event_get_body, 1},
+	{"serialize", event_serialize, 0},
+	{"fire", event_fire, 0},
+	{"destroy", event_destroy_, 0},
+	{0}
+};
+
+
+static JSPropertySpec event_props[] = {
+	{"ready", EVENT_READY, JSPROP_READONLY|JSPROP_PERMANENT}, 
+	{0}
+};
+
+
+static JSBool event_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+{
+	JSBool res = JS_TRUE;
+	switch_event_t *event = JS_GetPrivate(cx, obj);
+	char *name;
+	int param = 0;
+
+    if (!event) {
+        *vp = BOOLEAN_TO_JSVAL( JS_FALSE );
+		return JS_TRUE;
+    }
+
+	
+	name = JS_GetStringBytes(JS_ValueToString(cx, id));
+    /* numbers are our props anything else is a method */
+    if (name[0] >= 48 && name[0] <= 57) {
+        param = atoi(name);
+    } else {
+        return JS_TRUE;
+    }
+	
+	switch(param) {
+	case EVENT_READY:
+		*vp = BOOLEAN_TO_JSVAL( JS_TRUE );
+		break;
+	}
+
+	return res;
+}
+
+JSClass event_class = {
+	"Event", JSCLASS_HAS_PRIVATE, 
+	JS_PropertyStub,  JS_PropertyStub,	event_getProperty,  JS_PropertyStub, 
+	JS_EnumerateStub, JS_ResolveStub,	JS_ConvertStub,	  event_destroy, NULL, NULL, NULL,
+	event_construct
+};
+
+
+
+
 static void js_error(JSContext *cx, const char *message, JSErrorReport *report)
 {
 	if (message) {
@@ -200,7 +456,7 @@
 			for(d = dtmf; *d; d++) {
 				cb_state->ret_buffer[cb_state->ret_buffer_len++] = *d;
 				if ((cb_state->ret_buffer_len > cb_state->digit_count)||
-					(cb_state->ret_buffer_len > sizeof(cb_state->ret_buffer))||
+					(cb_state->ret_buffer_len > (int32_t) sizeof(cb_state->ret_buffer))||
 					(cb_state->ret_buffer_len >= cb_state->digit_count)
 					) {
 					return SWITCH_STATUS_FALSE;
@@ -317,7 +573,7 @@
 			for(d = dtmf; *d; d++) {
 				cb_state->ret_buffer[cb_state->ret_buffer_len++] = *d;
 				if ((cb_state->ret_buffer_len > cb_state->digit_count)||
-					(cb_state->ret_buffer_len > sizeof(cb_state->ret_buffer))||
+					(cb_state->ret_buffer_len > (int32_t) sizeof(cb_state->ret_buffer))||
 					(cb_state->ret_buffer_len >= cb_state->digit_count)
 					) {
 					return SWITCH_STATUS_FALSE;
@@ -386,7 +642,7 @@
 			for(d = dtmf; *d; d++) {
 				cb_state->ret_buffer[cb_state->ret_buffer_len++] = *d;
 				if ((cb_state->ret_buffer_len > cb_state->digit_count)||
-					(cb_state->ret_buffer_len > sizeof(cb_state->ret_buffer))||
+					(cb_state->ret_buffer_len > (int32_t) sizeof(cb_state->ret_buffer))||
 					(cb_state->ret_buffer_len >= cb_state->digit_count)
 					) {
 					return SWITCH_STATUS_FALSE;
@@ -418,6 +674,38 @@
 	
 }
 
+static JSBool session_flush_digits(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	struct js_session *jss = JS_GetPrivate(cx, obj);
+	switch_channel_t *channel;
+	char buf[256];
+	switch_size_t has;
+
+	channel = switch_core_session_get_channel(jss->session);
+    assert(channel != NULL);
+
+	if ((has = switch_channel_has_dtmf(channel))) {
+		switch_channel_dequeue_dtmf(channel, buf, has);
+	}
+
+	*rval = BOOLEAN_TO_JSVAL( JS_TRUE );
+    return JS_TRUE;
+}
+
+static JSBool session_flush_events(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	struct js_session *jss = JS_GetPrivate(cx, obj);
+	switch_event_t *event;
+
+	while (switch_core_session_dequeue_event(jss->session, &event) == SWITCH_STATUS_SUCCESS) {
+		switch_event_destroy(&event);
+	}
+	
+	*rval = BOOLEAN_TO_JSVAL( JS_TRUE );
+    return JS_TRUE;
+	
+}
+
 static JSBool session_recordfile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
@@ -515,6 +803,55 @@
 	return (switch_channel_ready(channel)) ? JS_TRUE : JS_FALSE;
 }
 
+static JSBool session_set_variable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	struct js_session *jss = JS_GetPrivate(cx, obj);
+    switch_channel_t *channel;
+
+	channel = switch_core_session_get_channel(jss->session);
+    assert(channel != NULL);
+
+	if (argc > 1) {
+		char *var, *val;
+
+		var = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		val = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+		switch_channel_set_variable(channel, var, val);
+		*rval = BOOLEAN_TO_JSVAL( JS_TRUE );
+	} else {
+		*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+	}
+ 	
+	return JS_TRUE;
+}
+
+static JSBool session_get_variable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	struct js_session *jss = JS_GetPrivate(cx, obj);
+    switch_channel_t *channel;
+
+	channel = switch_core_session_get_channel(jss->session);
+    assert(channel != NULL);
+
+	if (argc > 0) {
+		char *var, *val;
+		
+		var = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		val = switch_channel_get_variable(channel, var);
+
+		if (val) {
+			*rval = STRING_TO_JSVAL (JS_NewStringCopyZ(cx, val));
+		} else {
+			*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+		}
+	} else {
+		*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+	}
+ 	
+	return JS_TRUE;
+}
+
+
 static JSBool session_speak(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
@@ -681,7 +1018,53 @@
 	return JS_TRUE;
 }
 
+static JSBool session_get_event(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	struct js_session *jss = JS_GetPrivate(cx, obj);
+	switch_event_t *event;
 
+	if (switch_core_session_dequeue_event(jss->session, &event) == SWITCH_STATUS_SUCCESS) {
+		JSObject *Event;
+		if ((Event = JS_DefineObject(cx, obj, "Event", &event_class, NULL, 0))) {
+			if ((JS_SetPrivate(cx, Event, event) &&
+				 JS_DefineProperties(cx, Event, event_props) &&
+				 JS_DefineFunctions(cx, Event, event_methods))) {
+				*rval = OBJECT_TO_JSVAL ( Event );
+				return JS_TRUE;
+			}
+		}
+	}
+	
+	*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+    return JS_TRUE;
+	
+}
+
+static JSBool session_send_event(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	struct js_session *jss = JS_GetPrivate(cx, obj);
+	switch_event_t *event;
+	JSObject *Event;
+
+	if (argc > 0) {
+		if (JS_ValueToObject(cx, argv[0], &Event)) {
+			if ((event = JS_GetPrivate(cx, Event))) {
+				if (switch_core_session_receive_event(jss->session, &event) != SWITCH_STATUS_SUCCESS) {
+					*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+					return JS_TRUE;
+				}
+
+				JS_SetPrivate(cx, Event, NULL);
+			}
+		}
+	}
+
+	*rval = BOOLEAN_TO_JSVAL( JS_TRUE );
+    return JS_TRUE;
+	
+}
+
+
 static JSBool session_hangup(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
@@ -845,6 +1228,7 @@
 }
 #endif
 
+
 /* Session Object */
 /*********************************************************************************/
 enum session_tinyid {
@@ -855,11 +1239,17 @@
 static JSFunctionSpec session_methods[] = {
 	{"streamFile", session_streamfile, 1}, 
 	{"recordFile", session_recordfile, 1}, 
+	{"flushEvents", session_flush_events, 1}, 
+	{"flushDigits", session_flush_digits, 1}, 
 	{"speak", session_speak, 1}, 
+	{"setVariable", session_set_variable, 1}, 
+	{"getVariable", session_get_variable, 1}, 
 	{"getDigits", session_get_digits, 1},
 	{"answer", session_answer, 0}, 
 	{"ready", session_ready, 0}, 
 	{"waitForAnswer", session_wait_for_answer, 0}, 
+	{"getEvent", session_get_event, 0},
+	{"sendEvent", session_send_event, 0},
 	{"hangup", session_hangup, 0}, 
 	{"execute", session_execute, 0}, 
 	{0}
@@ -998,12 +1388,11 @@
 static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
 {
 	switch_memory_pool_t *pool = NULL;
-	if (argc > 2) {
+	if (argc > 1) {
 		struct js_session *jss = NULL;
 		JSObject *session_obj;
 		switch_core_session_t *session = NULL, *peer_session = NULL;
 		switch_caller_profile_t *caller_profile = NULL;
-		char *channel_type = NULL;
 		char *dest = NULL;
 		char *dialplan = NULL;
 		char *cid_name = "";
@@ -1014,6 +1403,7 @@
 		char *rdnis = "";
 		char *context = "";
 		char *username = NULL;
+		char *to = NULL;
 		*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
 
 		if (JS_ValueToObject(cx, argv[0], &session_obj)) {
@@ -1023,35 +1413,42 @@
 			}
 		}
 
-		channel_type = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
-		dest = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
+		dest = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
 
+		if (!strchr(dest, '/')) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid Channel String\n");
+			return JS_TRUE;
+		}
+
+		if (argc > 2) {
+			dialplan = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
+		}
 		if (argc > 3) {
-			dialplan = JS_GetStringBytes(JS_ValueToString(cx, argv[3]));
+			context = JS_GetStringBytes(JS_ValueToString(cx, argv[3]));
 		}
 		if (argc > 4) {
-			context = JS_GetStringBytes(JS_ValueToString(cx, argv[4]));
+			cid_name = JS_GetStringBytes(JS_ValueToString(cx, argv[4]));
 		}
 		if (argc > 5) {
-			cid_name = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
+			cid_num = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
 		}
 		if (argc > 6) {
-			cid_num = JS_GetStringBytes(JS_ValueToString(cx, argv[6]));
+			network_addr = JS_GetStringBytes(JS_ValueToString(cx, argv[6]));
 		}
 		if (argc > 7) {
-			network_addr = JS_GetStringBytes(JS_ValueToString(cx, argv[7]));
+			ani = JS_GetStringBytes(JS_ValueToString(cx, argv[7]));
 		}
 		if (argc > 8) {
-			ani = JS_GetStringBytes(JS_ValueToString(cx, argv[8]));
+			ani2 = JS_GetStringBytes(JS_ValueToString(cx, argv[8]));
 		}
 		if (argc > 9) {
-			ani2 = JS_GetStringBytes(JS_ValueToString(cx, argv[9]));
+			rdnis = JS_GetStringBytes(JS_ValueToString(cx, argv[9]));
 		}
 		if (argc > 10) {
-			rdnis = JS_GetStringBytes(JS_ValueToString(cx, argv[10]));
+			username = JS_GetStringBytes(JS_ValueToString(cx, argv[10]));
 		}
 		if (argc > 11) {
-			username = JS_GetStringBytes(JS_ValueToString(cx, argv[11]));
+			to = JS_GetStringBytes(JS_ValueToString(cx, argv[11]));
 		}
 		
 		
@@ -1060,20 +1457,32 @@
 			return JS_FALSE;
 		}
 
-		caller_profile = switch_caller_profile_new(pool, username, dialplan, cid_name, cid_num, network_addr, ani, ani2, rdnis, (char *)modname, context, dest);
-		if (switch_core_session_outgoing_channel(session, channel_type, caller_profile, &peer_session, pool) == SWITCH_STATUS_SUCCESS) {
-			jss = switch_core_session_alloc(peer_session, sizeof(*jss));
-			jss->session = peer_session;
-			jss->flags = 0;
-			jss->cx = cx;
-			jss->obj = obj;
-			JS_SetPrivate(cx, obj, jss);
-			switch_core_session_thread_launch(peer_session);
-			switch_set_flag(jss, S_HUP);
+		caller_profile = switch_caller_profile_new(pool,
+												   username,
+												   dialplan,
+												   cid_name,
+												   cid_num,
+												   network_addr,
+												   ani,
+												   ani2,
+												   rdnis,
+												   (char *)modname,
+												   context,
+												   dest);
+		
+		if (switch_ivr_originate(session, &peer_session, dest, to ? atoi(to) : 60, NULL, NULL, NULL, caller_profile) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot Create Outgoing Channel! [%s]\n", dest);
 			return JS_TRUE;
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Channel\n");			
 		}
+
+		jss = switch_core_session_alloc(peer_session, sizeof(*jss));
+		jss->session = peer_session;
+		jss->flags = 0;
+		jss->cx = cx;
+		jss->obj = obj;
+		JS_SetPrivate(cx, obj, jss);
+		switch_set_flag(jss, S_HUP);
+
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing Args\n");
 	}
@@ -1135,9 +1544,10 @@
 		}
 		switch_core_new_memory_pool(&pool);
 		if (switch_file_open(&fd, path, flags, SWITCH_FPROT_UREAD|SWITCH_FPROT_UWRITE, pool) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Open File!\n");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Open File: %s\n", path);
 			switch_core_destroy_memory_pool(&pool);
-			return JS_FALSE;
+			*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+			return JS_TRUE;
 		}
 		fio = switch_core_alloc(pool, sizeof(*fio));
 		fio->fd = fd;
@@ -1148,14 +1558,18 @@
 		return JS_TRUE;
 	}
 
-	return JS_FALSE;
+	return JS_TRUE;
 }
 static void fileio_destroy(JSContext *cx, JSObject *obj)
 {
 	struct fileio_obj *fio = JS_GetPrivate(cx, obj);
 
 	if (fio) {
-		switch_memory_pool_t *pool = fio->pool;
+		switch_memory_pool_t *pool;
+			if (fio->fd) {
+			switch_file_close(fio->fd);
+		}
+		pool = fio->pool;
 		switch_core_destroy_memory_pool(&pool);
 		pool = NULL;
 	}
@@ -1169,6 +1583,10 @@
 
 	*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
 
+	if (fio) {
+		return JS_TRUE;
+	}
+
 	if (!(fio->flags & SWITCH_FOPEN_READ)) {
 		return JS_TRUE;
 	}
@@ -1194,6 +1612,12 @@
 static JSBool fileio_data(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
 {
 	struct fileio_obj *fio = JS_GetPrivate(cx, obj);
+
+	if (!fio) {
+		*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+		return JS_TRUE;
+	}
+
 	*rval = STRING_TO_JSVAL (JS_NewStringCopyZ(cx, fio->buf));
 	return JS_TRUE;
 }
@@ -1204,6 +1628,11 @@
 	switch_size_t wrote = 0;
 	char *data = NULL;
 
+	if (!fio) {
+		*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
+		return JS_TRUE;
+	}
+
 	if (!(fio->flags & SWITCH_FOPEN_WRITE)) {
 		*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
 		return JS_TRUE;
@@ -1214,7 +1643,7 @@
 	}
 
 	if (data) {
-		wrote = 0;
+		wrote = strlen(data);
 		*rval = BOOLEAN_TO_JSVAL( (switch_file_write(fio->fd, data, &wrote) == SWITCH_STATUS_SUCCESS) ? JS_TRUE : JS_FALSE);
 	}
 
@@ -1223,7 +1652,7 @@
 }
 
 enum fileio_tinyid {
-	FILEIO_PATH
+	FILEIO_PATH, FILEIO_OPEN
 };
 
 static JSFunctionSpec fileio_methods[] = {
@@ -1236,6 +1665,7 @@
 
 static JSPropertySpec fileio_props[] = {
 	{"path", FILEIO_PATH, JSPROP_READONLY|JSPROP_PERMANENT}, 
+	{"open", FILEIO_OPEN, JSPROP_READONLY|JSPROP_PERMANENT}, 
 	{0}
 };
 
@@ -1257,8 +1687,15 @@
 	
 	switch(param) {
 	case FILEIO_PATH:
-		*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, fio->path));
+		if (fio) {
+			*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, fio->path));
+		} else {
+			*vp = BOOLEAN_TO_JSVAL( JS_FALSE );
+		}
 		break;
+	case FILEIO_OPEN:
+		*vp = BOOLEAN_TO_JSVAL( fio ? JS_TRUE : JS_FALSE );
+		break;
 	}
 
 	return res;
@@ -1787,6 +2224,11 @@
 
 /* Built-In*/
 /*********************************************************************************/
+static JSBool js_exit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+	return JS_FALSE;
+}
+
 static JSBool js_log(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
 {
 	char *level_str, *msg;
@@ -1875,7 +2317,6 @@
 {
 	struct js_session *jss_a = NULL, *jss_b = NULL;
 	JSObject *session_obj_a = NULL, *session_obj_b = NULL;
-	int32 timelimit = 60;
 
 	if (argc > 1) {
 		if (JS_ValueToObject(cx, argv[0], &session_obj_a)) {
@@ -1892,18 +2333,12 @@
 		} 
 	}
 	
-	if (argc > 3) {
-		if (!JS_ValueToInt32(cx, argv[3], &timelimit)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Convert to INT\n");
-			return JS_FALSE;
-		}
-	}
 	if (!(jss_a && jss_b)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure! %s %s\n", jss_a ? "y" : "n", jss_b ? "y" : "n");
 		return JS_FALSE;
 	}
 
-	switch_ivr_multi_threaded_bridge(jss_a->session, jss_b->session, timelimit, NULL, NULL, NULL);
+	switch_ivr_multi_threaded_bridge(jss_a->session, jss_b->session, NULL, NULL, NULL);
 	return JS_TRUE;
 }
 
@@ -2030,6 +2465,7 @@
 
 static JSFunctionSpec fs_functions[] = {
 	{"console_log", js_log, 2}, 
+	{"exit", js_exit, 0}, 
 	{"include", js_include, 1}, 
 	{"email", js_email, 2}, 
 	{"bridge", js_bridge, 2},
@@ -2124,6 +2560,18 @@
 				 db_methods,
 				 db_props,
 				 db_methods
+				 );
+
+	JS_InitClass(cx,
+				 javascript_object,
+				 NULL,
+				 &event_class,
+				 event_construct,
+				 3,
+				 event_props,
+				 event_methods,
+				 event_props,
+				 event_methods
 				 );
 
 	return 1;

Modified: freeswitch/branches/james/src/mod/languages/mod_spidermonkey/mod_spidermonkey.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/languages/mod_spidermonkey/mod_spidermonkey.vcproj	(original)
+++ freeswitch/branches/james/src/mod/languages/mod_spidermonkey/mod_spidermonkey.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,15 +17,15 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_SpiderMonkey Debug"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -42,7 +42,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\js\src&quot;;&quot;$(InputDir)..\..\..\..\libs\curl\include&quot;;&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\js20051231\src&quot;;&quot;$(InputDir)..\..\..\..\libs\curl-7.15.2\include&quot;;&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;XP_WIN;DEBUG;_X86_=1;JSFILE;EXPORT_JS_API;HAVE_CURL;CURL_STATICLIB"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -64,13 +64,13 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				LinkLibraryDependencies="false"
-				AdditionalDependencies="js32.lib curllib.lib ws2_32.lib winmm.lib sqlite.lib fdlibm.lib libnspr4.lib libplc4.lib libplds4.lib libteletone.lib FreeSwitchCore.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_spidermonkey.dll"
-				LinkIncremental="2"
-				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\js\src\$(OutDir)&quot;;&quot;..\..\..\..\libs\curl\lib\$(OutDir)&quot;;&quot;..\..\..\..\libs\sqlite\$(OutDir)&quot;;..\..\..\..\libs\js\nspr\lib;&quot;..\..\..\..\w32\vsnet\$(OutDir)&quot;;&quot;..\..\..\..\libs\libetpan\build-windows\libetpan\$(OutDir)&quot;"
+				LinkLibraryDependencies="true"
+				AdditionalDependencies="ws2_32.lib winmm.lib libnspr4.lib libplc4.lib libplds4.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\nspr-4.6.1.winnt5.$(OutDir)\nspr-4.6.1\lib&quot;"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_spidermonkey.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_spidermonkey.lib"
 				TargetMachine="1"
@@ -102,15 +102,15 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_SpiderMonkey Release"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -126,7 +126,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\js\src&quot;;&quot;$(InputDir)..\..\..\..\libs\curl\include&quot;;&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\js20051231\src&quot;;&quot;$(InputDir)..\..\..\..\libs\curl-7.15.2\include&quot;;&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;XP_WIN;_X86_=1;JSFILE;EXPORT_JS_API;HAVE_CURL;CURL_STATICLIB"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
@@ -146,12 +146,13 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				LinkLibraryDependencies="false"
-				AdditionalDependencies="js32.lib curllib.lib ws2_32.lib winmm.lib sqlite.lib fdlibm.lib libnspr4.lib libplc4.lib libplds4.lib libteletone.lib FreeSwitchCore.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_spidermonkey.dll"
+				LinkLibraryDependencies="true"
+				AdditionalDependencies="ws2_32.lib winmm.lib libnspr4.lib libplc4.lib libplds4.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
-				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\js\src\$(OutDir)&quot;;&quot;..\..\..\..\libs\curl\lib\$(OutDir)&quot;;&quot;..\..\..\..\libs\sqlite\$(OutDir)&quot;;..\..\..\..\libs\js\nspr\lib;&quot;..\..\..\..\w32\vsnet\$(OutDir)&quot;;&quot;..\..\..\..\libs\libetpan\build-windows\libetpan\$(OutDir)&quot;"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\libs\nspr-4.6.1.winnt5.$(OutDir)\nspr-4.6.1\lib&quot;"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/loggers/mod_console/mod_console.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/loggers/mod_console/mod_console.vcproj	(original)
+++ freeswitch/branches/james/src/mod/loggers/mod_console/mod_console.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_console.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_console.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_console.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_console.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/loggers/mod_syslog/mod_syslog.c
==============================================================================
--- freeswitch/branches/james/src/mod/loggers/mod_syslog/mod_syslog.c	(original)
+++ freeswitch/branches/james/src/mod/loggers/mod_syslog/mod_syslog.c	Tue Sep  5 08:41:27 2006
@@ -105,8 +105,8 @@
 
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **interface, char *filename)
 {
-	*interface = &console_module_interface;
 	switch_status_t status;
+	*interface = &console_module_interface;
 
 	if ((status=load_config()) != SWITCH_STATUS_SUCCESS) {
 		return status;

Modified: freeswitch/branches/james/src/mod/timers/mod_softtimer/mod_softtimer.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/timers/mod_softtimer/mod_softtimer.vcproj	(original)
+++ freeswitch/branches/james/src/mod/timers/mod_softtimer/mod_softtimer.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,8 +17,8 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -50,7 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -63,11 +63,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_softtimer.dll"
-				LinkIncremental="2"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_softtimer.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_softtimer.lib"
 				TargetMachine="1"
@@ -99,8 +99,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
@@ -142,10 +142,11 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_softtimer.dll"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj
==============================================================================
--- freeswitch/branches/james/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj	(original)
+++ freeswitch/branches/james/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj	Tue Sep  5 08:41:27 2006
@@ -17,15 +17,15 @@
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_XMLRpc Debug"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -42,7 +42,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c-1.03.14\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c-1.03.14&quot;;&quot;$(InputDir)..\..\..\..\libs\curl-7.15.2\include&quot;"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ABYSS_WIN32;CURL_STATICLIB"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
@@ -51,7 +51,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -64,12 +64,12 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="curllib.lib  Winmm.lib Ws2_32.lib xmlrpcD.lib Abyss.lib xml.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_xml_rpc.dll"
-				LinkIncremental="2"
+				AdditionalDependencies="Winmm.lib Ws2_32.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
+				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;..\..\..\..\w32\vsnet\$(OutDir)&quot;;..\..\..\..\libs\xmlrpc\lib;&quot;..\..\..\..\libs\xmlrpc\lib\abyss\src\$(OutDir)&quot;;&quot;..\..\..\..\libs\apr-util\xml\expat\lib\LibD&quot;"
 				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(OutDir)/mod_xml_rpc.pdb"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				ImportLibrary="$(OutDir)/mod_xml_rpc.lib"
 				TargetMachine="1"
@@ -101,15 +101,15 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="2"
 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			CharacterSet="2"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
-				CommandLine="cscript /nologo &quot;$(InputDir)..\..\..\..\w32\vsnet\getlibs.vbs&quot; Mod_XMLRpc Release"
+				CommandLine=""
 			/>
 			<Tool
 				Name="VCCustomBuildTool"
@@ -125,7 +125,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c-1.03.14\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c-1.03.14&quot;;&quot;$(InputDir)..\..\..\..\libs\curl-7.15.2\include&quot;"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ABYSS_WIN32;CURL_STATICLIB"
 				RuntimeLibrary="2"
 				UsePrecompiledHeader="0"
@@ -145,11 +145,12 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="curllib.lib  Winmm.lib Ws2_32.lib xmlrpc.lib Abyss.lib xml.lib"
-				OutputFile="..\..\..\..\w32\vsnet\$(OutDir)/mod/mod_xml_rpc.dll"
+				AdditionalDependencies="Winmm.lib Ws2_32.lib"
+				OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;..\..\..\..\w32\vsnet\$(OutDir)&quot;;..\..\..\..\libs\xmlrpc\lib;&quot;..\..\..\..\libs\xmlrpc\lib\abyss\src\$(OutDir)&quot;;&quot;..\..\..\..\libs\apr-util\xml\expat\lib\LibR&quot;"
 				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
 				SubSystem="2"
 				OptimizeReferences="2"
 				EnableCOMDATFolding="2"

Modified: freeswitch/branches/james/src/switch.c
==============================================================================
--- freeswitch/branches/james/src/switch.c	(original)
+++ freeswitch/branches/james/src/switch.c	Tue Sep  5 08:41:27 2006
@@ -31,85 +31,213 @@
  */
 
 #include <switch.h>
-#include <switch_version.h>
-#ifdef HAVE_MLOCKALL
-#include <sys/mman.h>
-#endif
 
+#define PIDFILE "freeswitch.pid"
+#define LOGFILE "freeswitch.log"
 static int RUNNING = 0;
+static char *lfile = LOGFILE;
+static char *pfile = PIDFILE;
+#define SERVICENAME "Freeswitch"
 
-static int handle_SIGPIPE(int sig)
+#ifdef __ICC
+#pragma warning (disable:167)
+#endif
+
+
+#ifdef WIN32
+#include <winsock2.h>
+#include <windows.h>
+static HANDLE shutdown_event;
+#endif
+
+	static int handle_SIGHUP(int sig)
 {
 	if(sig);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Sig Pipe!\n");
+	RUNNING = 0;
 	return 0;
 }
-#ifdef TRAP_BUS
-static int handle_SIGBUS(int sig)
+
+static void set_high_priority()
 {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Sig BUS!\n");
-	return 0;
+#ifdef WIN32
+	SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
+#else
+	nice(-20);
+#endif
 }
+
+static void freeswitch_runtime_loop(int bg)
+{
+	if (bg) {
+		bg = 0;
+#ifdef WIN32
+		WaitForSingleObject(shutdown_event, INFINITE);
+#else
+		RUNNING = 1;
+		while(RUNNING) {
+			switch_yield(10000);
+		}
 #endif
+	}  else {
+		/* wait for console input */
+		switch_console_loop();
+	}
+}
 
-/* no ctl-c mofo */
-static int handle_SIGINT(int sig)
+static int freeswitch_kill_background()
 {
-	if (sig);
+	FILE *f;
+	char path[256] = "";
+	pid_t pid = 0;
+	switch_core_set_globals();
+	snprintf(path, sizeof(path), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, pfile);
+	if ((f = fopen(path, "r")) == 0) {
+		fprintf(stderr, "Cannot open pid file %s.\n", path);
+		return 255;
+	}
+	fscanf(f, "%d", &pid);
+	if (pid > 0) {
+		fprintf(stderr, "Killing: %d\n", (int) pid);
+#ifdef WIN32
+		snprintf(path, sizeof(path), "Global\\Freeswitch.%d", pid);
+		shutdown_event = OpenEvent(EVENT_MODIFY_STATE, FALSE, path);
+		if (!shutdown_event) {
+			/* we can't get the event, so we can't signal the process to shutdown */
+			fprintf(stderr, "ERROR: Can't Shutdown: %d\n", (int) pid);
+		} else {
+			SetEvent(shutdown_event);
+		}
+		CloseHandle(shutdown_event);
+#else
+		kill(pid, SIGTERM);
+#endif
+	}
+
+	fclose(f);
 	return 0;
 }
 
+#ifdef WIN32
+SERVICE_STATUS_HANDLE hStatus;
+SERVICE_STATUS status;
 
-static int handle_SIGHUP(int sig)
+void WINAPI ServiceCtrlHandler( DWORD control )
 {
-	if(sig);
-	RUNNING = 0;
-	return 0;
+    switch( control )
+    {
+    case SERVICE_CONTROL_SHUTDOWN:
+    case SERVICE_CONTROL_STOP:
+        // do shutdown stuff here
+		switch_core_destroy();
+        status.dwCurrentState = SERVICE_STOPPED;
+        status.dwWin32ExitCode = 0;
+        status.dwCheckPoint = 0;
+        status.dwWaitHint = 0;
+        break;
+    case SERVICE_CONTROL_INTERROGATE:
+        // just set the current state to whatever it is...
+        break;
+    }
+
+    SetServiceStatus( hStatus, &status );
 }
 
+void WINAPI service_main( DWORD numArgs, char **args )
+{
+	const char *err = NULL;
+    // we have to initialize the service-specific stuff
+    memset( &status, 0, sizeof(SERVICE_STATUS) );
+    status.dwServiceType = SERVICE_WIN32;
+    status.dwCurrentState = SERVICE_START_PENDING;
+    status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
+
+    hStatus = RegisterServiceCtrlHandler( SERVICENAME, &ServiceCtrlHandler );
+
+    SetServiceStatus( hStatus, &status );
+	set_high_priority();
+	if (switch_core_init_and_modload(lfile, &err) != SWITCH_STATUS_SUCCESS) {
+	    status.dwCurrentState = SERVICE_STOPPED;
+	} else {
+		status.dwCurrentState = SERVICE_RUNNING;
+	}
+
+    SetServiceStatus( hStatus, &status );
+}
+
+#endif
+
 int main(int argc, char *argv[])
 {
-	char *lfile = "freeswitch.log";
-	char *pfile = "freeswitch.pid";
 	char path[256] = "";
 	char *ppath = NULL;
 	const char *err = NULL;
-	switch_event_t *event;
 	int bg = 0;
 	FILE *f;
+	pid_t pid = 0;
+
 #ifdef WIN32
-	SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
-#else
-	int pid;
-	nice(-20);
-#endif
+    SERVICE_TABLE_ENTRY dispatchTable[] =
+    {
+        { SERVICENAME, &service_main },
+        { NULL, NULL }
+    };
 
-#ifndef WIN32
-	if (argv[1] && !strcmp(argv[1], "-stop")) {
-		pid_t pid = 0;
-		switch_core_set_globals();
-		snprintf(path, sizeof(path), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, pfile);
-		if ((f = fopen(path, "r")) == 0) {
-			fprintf(stderr, "Cannot open pid file %s.\n", path);
-			return 255;
+	if (argv[1] && !strcmp(argv[1], "-service")) {
+		if(StartServiceCtrlDispatcher( dispatchTable ) == 0 )
+		{
+			//Not loaded as a service
+			fprintf(stderr, "Error Freeswitch loaded as a console app with -service option\n");
+			fprintf(stderr, "To install the service load freeswitch with -install\n");
 		}
-		fscanf(f, "%d", &pid);
-		if (pid > 0) {
-			fprintf(stderr, "Killing %d\n", (int) pid);
-			kill(pid, SIGTERM);
-		}
+		exit(0);
+	}
+	if (argv[1] && !strcmp(argv[1], "-install")) {
+		char exePath[1024];
+	    char servicePath[1024];
 
-		fclose(f);
-		return 0;
+		SC_HANDLE handle = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS );
+		GetModuleFileName( NULL, exePath, 1024 );
+		snprintf(servicePath, sizeof(servicePath), "%s -service", exePath);
+		CreateService(
+			handle,
+			SERVICENAME,
+			SERVICENAME,
+			GENERIC_READ | GENERIC_EXECUTE,
+			SERVICE_WIN32_OWN_PROCESS,
+			SERVICE_AUTO_START,
+			SERVICE_ERROR_IGNORE,
+			servicePath,
+			NULL,
+			NULL,
+			NULL,
+			NULL,
+			NULL
+		);
+		exit(0);
 	}
+	if (argv[1] && !strcmp(argv[1], "-uninstall")) {
+		SC_HANDLE handle = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS );
+		SC_HANDLE service = OpenService( handle, SERVICENAME, DELETE );
+		if( service != NULL )
+		{
+			// remove the service!
+			DeleteService( service );
+		}
+		exit(0);
+	}
 #endif
 
+	set_high_priority();
+
+	if (argv[1] && !strcmp(argv[1], "-stop")) {
+		return freeswitch_kill_background();
+	}
+
 	if (argv[1] && !strcmp(argv[1], "-nc")) {
 		bg++;
 	}
 
 	if (bg) {
-		//snprintf(path, sizeof(path), "%s%c%s", SWITCH_GLOBAL_dirs.log_dir, sep, lfile);
 		ppath = lfile;
 
 		signal(SIGHUP, (void *) handle_SIGHUP);
@@ -117,111 +245,31 @@
 
 #ifdef WIN32
 		FreeConsole();
+		snprintf(path, sizeof(path), "Global\\Freeswitch.%d", getpid());
+		shutdown_event = CreateEvent(NULL, FALSE, FALSE, path);		
 #else
 		if ((pid = fork())) {
 			fprintf(stderr, "%d Backgrounding.\n", (int)pid);
 			exit(0);
 		}
 #endif
-	
 	}
 
-
-	if (switch_core_init(ppath, &err) != SWITCH_STATUS_SUCCESS) {
+	if (switch_core_init_and_modload(ppath, &err) != SWITCH_STATUS_SUCCESS) {
 		fprintf(stderr, "Cannot Initilize [%s]\n", err);
 		return 255;
 	}
 
-
-#ifdef __ICC
-#pragma warning (disable:167)
-#endif
-
-	/* set signal handlers */
-	//signal(SIGINT, (void *) handle_SIGINT);
-#ifdef SIGPIPE
-	signal(SIGPIPE, (void *) handle_SIGPIPE);
-#endif
-#ifdef TRAP_BUS
-	signal(SIGBUS, (void *) handle_SIGBUS);
-#endif
-
-
-
-
-
-
 	snprintf(path, sizeof(path), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, pfile);
 	if ((f = fopen(path, "w")) == 0) {
 		fprintf(stderr, "Cannot open pid file %s.\n", path);
 		return 255;
 	}
 
-	fprintf(f, "%d", getpid());
+	fprintf(f, "%d", pid = getpid());
 	fclose(f);
-	
-	if (!err) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Bringing up environment.\n");
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Loading Modules.\n");
-		if (switch_loadable_module_init() != SWITCH_STATUS_SUCCESS) {
-			err = "Cannot load modules";
-		}
-	}
 
-	if (err) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Error: %s", err);
-		exit(-1);
-	}
+	freeswitch_runtime_loop(bg);
 
-	if (switch_event_create(&event, SWITCH_EVENT_STARTUP) == SWITCH_STATUS_SUCCESS) {
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Info", "System Ready");
-		switch_event_fire(&event);
-	}
-
-#ifdef HAVE_MLOCKALL
-	mlockall(MCL_CURRENT|MCL_FUTURE);
-#endif
-
-
-#ifdef CRASH_PROT
-#define __CP "ENABLED"
-#else
-#define __CP "DISABLED"
-#endif
-
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "freeswitch Version %s Started. Crash Protection [%s] Max Sessions[%u]\n\n", SWITCH_VERSION_FULL, __CP, switch_core_session_limit(0));
-	snprintf(path, sizeof(path), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, pfile);
-
-	if (bg) {
-		bg = 0;
-		RUNNING = 1;
-		while(RUNNING) {
-#ifdef WIN32
-		bg++;
-		if(bg == 100) {
-			if ((f = fopen(path, "r")) == 0) {
-				break;
-			}
-			fclose(f);
-			bg = 0;
-		}
-#endif
-			switch_yield(10000);
-		}
-	}  else {
-		/* wait for console input */
-		switch_console_loop();
-	}
-	
-	if (switch_event_create(&event, SWITCH_EVENT_SHUTDOWN) == SWITCH_STATUS_SUCCESS) {
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Info", "System Shutting Down");
-		switch_event_fire(&event);
-	}
-
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "End existing sessions\n");
-	switch_core_session_hupall();
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clean up modules.\n");
-	switch_loadable_module_shutdown();
-	switch_core_destroy();
-	return 0;
+	return switch_core_destroy();
 }

Modified: freeswitch/branches/james/src/switch_event.c
==============================================================================
--- freeswitch/branches/james/src/switch_event.c	(original)
+++ freeswitch/branches/james/src/switch_event.c	Tue Sep  5 08:41:27 2006
@@ -99,6 +99,8 @@
 	"CHANNEL_EXECUTE",
 	"CHANNEL_BRIDGE",
 	"CHANNEL_UNBRIDGE",
+	"CHANNEL_PROGRESS",
+	"CHANNEL_OUTGOING",
 	"API",
 	"LOG",
 	"INBOUND_CHAN",
@@ -113,6 +115,7 @@
 	"MODULE_LOAD",
 	"DTMF",
 	"MESSAGE",
+	"CODEC",
 	"ALL"
 };
 
@@ -393,6 +396,15 @@
 	return NULL;
 }
 
+SWITCH_DECLARE(char *) switch_event_get_body(switch_event_t *event)
+{
+	if (event) {
+		return event->body;
+	}
+
+	return NULL;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, switch_stack_t stack, char *header_name,
 													  char *fmt, ...)
 {
@@ -623,7 +635,7 @@
 			switch_xml_t xbody = NULL;
 
 			add_xml_header(xml, "Content-Length", blena, off++);
-			if ((xbody = switch_xml_add_child_d(xml, "body", 0))) {
+			if ((xbody = switch_xml_add_child_d(xml, "body", off++))) {
 				switch_xml_set_txt_d(xbody, body);
 			}
 		}
@@ -659,7 +671,7 @@
 	switch_event_add_header(*event, SWITCH_STACK_TOP, "Event-Calling-Function", func);
 	switch_event_add_header(*event, SWITCH_STACK_TOP, "Event-Calling-File", switch_cut_path(file));
 	switch_time_exp_lt(&tm, switch_time_now());
-	switch_strftime(date, &retsize, sizeof(date), "%a, %d-%b-%Y %X", &tm);
+	switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
 	switch_event_add_header(*event, SWITCH_STACK_TOP, "Event-Date-Local", date);
 	switch_rfc822_date(date, switch_time_now());
 	switch_event_add_header(*event, SWITCH_STACK_TOP, "Event-Date-GMT", date);



More information about the Freeswitch-branches mailing list